Skip to content

feat: climate risk from cmip cordex - #18

Open
jdroenner wants to merge 22 commits into
mainfrom
cmip_cordex
Open

feat: climate risk from cmip cordex#18
jdroenner wants to merge 22 commits into
mainfrom
cmip_cordex

Conversation

@jdroenner

Copy link
Copy Markdown
Member

No description provided.

@coveralls

coveralls commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 85.899% (-0.3%) from 86.221% — cmip_cordex into main

@jdroenner jdroenner changed the title feat: climeate rist from cmip cordex feat: climate risk from cmip cordex Jul 8, 2026

@ChristianBeilschmidt ChristianBeilschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Konnte das aus Gründen (Karte) nicht anwenden. Aber hier schon mal meine Kommentare.

Comment thread k8s/pod.yaml Outdated
volumeMounts:
- name: pgdata
mountPath: /var/lib/postgresql/data
mountPath: /var/lib/postgresql/18/docker

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warum ist das anders, obwohl sich sonst nichts an der Container-Config geändert hat?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also ich hab das nochmal versucht aber mit dem neusten Image geht das einfach nicht anders :(

Comment thread rust-toolchain.toml Outdated
Comment thread backend/Cargo.toml Outdated
Comment thread backend/src/processes/climate_cordex_cmip5.rs Outdated
Comment thread backend/src/processes/climate_cordex_cmip5.rs Outdated
Comment thread backend/src/processes/climate_cordex_cmip5.rs Outdated
Comment thread rust-toolchain.toml Outdated
@@ -0,0 +1 @@
./backend/rust-toolchain.toml No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage am besten > 80% lassen.

Comment thread backend/src/processes/climate_cordex_cmip5.rs Outdated
Comment thread backend/src/processes/climate_cordex_cmip5.rs Outdated
Comment thread frontend/src/app/create-new-auto/simple-form-field.ts

@ChristianBeilschmidt ChristianBeilschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich konnte jetzt erst einmal nur Code-only anschauen. Müssen noch mal wegen der Daten sprechen.

Comment on lines +41 to +47
/// Name of a row property that carries the cell color (hex) for this column.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub color_field: Option<String>,
/// Name of a row property that carries a ready-to-display label for this column.
/// When set, the frontend renders it instead of the raw value.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub label_field: Option<String>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check: Sind das validate table schema Felder (https://datapackage.org/standard/table-schema/)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ich hab das nochmal neu gemacht / machen lassen. Es müsste jetzt korrekt sein

String,
Number,
Integer,
Percentage,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Es gibt keinen Percentage-Typ bei TableSchema: https://datapackage.org/standard/table-schema/#field-types

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Percentage ist jetzt nur noch ein Units-Helfer und taucht nicht mehr als Table-Schema-Feld-Typ auf. Die Prozent-Anzeige (z.B. "+10 days (+20 %)") läuft über die biois-Extension (labelField/colorField).

Comment thread backend/src/processes/parameters/units.rs Outdated
Comment thread backend/src/processes/parameters/units.rs Outdated
Comment thread backend/src/processes/climate_cordex_cmip5.rs Outdated
</td>
}
}
@case (ColumnType.Percentage) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Den Typ gibt es ja nicht in TableSchema

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

das gibt es jetzt nicht mehr

<mat-chip class="cell-content">
<span
class="color-dot"
[style.background-color]="element[column.colorField]"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Irgendwie fühlt es sich falsch an, eine Spalte mit Farbwerten zu haben.
Evtl. finden wir andere Felder für Metadaten oder müssen eine Extension machen (https://datapackage.org/standard/extensions/).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Die Farb-/Label-Werte sind jetzt hiddenFields und über eine Table-Schema-Extension (biois.display mit kind/labelField/colorField) an die Datenfelder gebunden. Keine sichtbare Farbwert-Spalte mehr.

Comment thread frontend/src/app/result/result.component.ts Outdated
Comment thread backend/src/processes/climate_cordex_cmip5.rs Outdated
Comment thread backend/Cargo.toml Outdated

@ChristianBeilschmidt ChristianBeilschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alles bis auf Tabelle

crs: Crs,
}

pub fn nearest_containing<T>(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gerne kurze Docs

/// BioIS-specific metadata for rendering a standard Table Schema field.
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct BioisTableSchemaExtension {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub struct BioisTableSchemaExtension {
pub struct BioISTableSchemaExtension {

pub min: f64,
pub max: f64,
#[serde(skip_serializing_if = "Option::is_none")]
pub occurrence_probability: Option<f64>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Der Typ serialisiert doch nach String.

Comment on lines +349 to +352
pub mean: f64,
pub median: f64,
pub min: f64,
pub max: f64,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Year wird doch auch typisiert, wieso nicht Tage?

#[serde(skip_serializing_if = "Option::is_none")]
pub occurrence_probability: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub anomaly: Option<f64>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja, aber wieso kein Tage-Typ, damit man in Rust typsicher ist?
Im Table-Schema steht es immerhin im Titel.

"0.1.0"
}

#[allow(clippy::too_many_lines)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dann kann also #[allow(clippy::too_many_lines)] weg?

Comment on lines +788 to +822
if let Some(items) = schema.get_mut("items").and_then(|i| i.as_object_mut())
&& let Some(enum_values) = items.get("enum").and_then(|e| e.as_array())
{
let enum_names: Vec<String> = enum_values
.iter()
.filter_map(|v| v.as_str())
.map(|model_value| {
CordexModel::ALL
.iter()
.find(|m| {
serde_json::to_value(m)
.ok()
.and_then(|v| v.as_str().map(|s| s == model_value))
.unwrap_or(false)
})
.map_or_else(
|| model_value.to_string(),
|m| {
let props = m.properties();
let scenarios = props
.scenarios
.iter()
.map(|s| s.properties().name)
.collect::<Vec<_>>()
.join(", ");
format!("{} ({})", props.name, scenarios)
},
)
})
.collect();
items.insert(
"enumNames".to_string(),
serde_json::to_value(enum_names).unwrap_or_default(),
);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das ist genau der gleiche Code wie bisher.

Comment on lines +102 to +127
// Resolve nullable primitives like {"anyOf": [{"$ref": ...}, {"type": "null"}]} to their type
if (!type && (schema.anyOf || schema.oneOf)) {
const branches = (schema.anyOf ?? schema.oneOf) as JSONSchema[];
const nonNull = branches.find(
(branch) =>
typeof branch !== 'object' ||
branch === null ||
(branch as BaseJSONSchema)['type'] !== 'null',
);
if (nonNull) {
const resolved = resolveSchemaRef(schema, nonNull);
const resolvedType =
typeof resolved === 'object' && resolved !== null
? (resolved as BaseJSONSchema)['type']
: undefined;
if (
resolvedType === 'string' ||
resolvedType === 'number' ||
resolvedType === 'integer' ||
resolvedType === 'boolean'
) {
return typeFromSchema(resolved);
}
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aber sollte man das dann nicht da unten machen, wenn man einmal festgestellt hat !type? Dann macht man mit items das da oben und ohne return FieldType.NestedJson;

if (typeof example === 'string') return example;
}

return firstEnumOrFallback(schema, fallback);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Da ist kein doc

grafik

Comment on lines +19 to +23
@if (type() === FieldType.Boolean) {
<mat-checkbox [checked]="value()" (change)="value.set($event.checked)"
>True/False</mat-checkbox
>
} @else {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das beantwortet nicht die Frage; evtl. eigene Component?

…y→Days rename

- Consolidate 56 tests to 39 via table-driven tests (item 9)
- Move tests inline into mod.rs, types.rs, compute.rs, workflow.rs; delete tests.rs (item 10)
- Document DAYS_PER_JULIAN_YEAR constant (item 11)
- Rename Day → Days to reserve Day for a future concrete calendar day type
- Extract boolean-field component (item 7)
- Move nullable schema resolution to !type guard (item 5)
- Add JSDoc to firstEnumOrFallback (item 6)
- Add doc comment to nearest_containing (item 1)
- Rename to BioISTableSchemaExtension (item 2)
- Remove #[allow(clippy::too_many_lines)] via build_inputs/build_outputs extraction (item 3)
- Extract model_display_name helper (item 4)
# Conflicts:
#	backend/src/handler.rs
#	backend/src/processes/climate_risk/compute.rs
#	backend/src/processes/climate_risk/mod.rs
#	backend/src/processes/climate_risk/types.rs
#	backend/src/processes/climate_risk/workflow.rs
#	backend/src/processes/parameters/data_resource.rs
#	backend/src/processes/parameters/mod.rs
#	backend/src/processes/parameters/units.rs
#	backend/src/server.rs
#	frontend/src/app/create/create.component.spec.ts
#	frontend/src/app/create/schema-info.ts
#	frontend/src/app/create/simple-form-field.ts

import { ClimateRiskInputs } from '../models/ClimateRiskInputs';
import { Response } from '../models/Response';
import { HttpFile } from '../http/http';

import { ClimateRiskInputs } from '../models/ClimateRiskInputs';
import { DataResource } from '../models/DataResource';
import { HttpFile } from '../http/http';
import { CordexModel } from '../models/CordexModel';
import { CordexRegion } from '../models/CordexRegion';
import { PointGeoJsonInput } from '../models/PointGeoJsonInput';
import { HttpFile } from '../http/http';
* Do not edit the class manually.
*/

import { HttpFile } from '../http/http';
* Do not edit the class manually.
*/

import { HttpFile } from '../http/http';
* Do not edit the class manually.
*/

import { HttpFile } from '../http/http';
import { ClimateRiskInputs } from '../models/ClimateRiskInputs';
import { ClimateRiskOutputs } from '../models/ClimateRiskOutputs';
import { ClimateRiskProcessParams } from '../models/ClimateRiskProcessParams';
import { ClimateVariable } from '../models/ClimateVariable';
import { Constraints7 } from '../models/Constraints7';
import { Constraints8 } from '../models/Constraints8';
import { Constraints9 } from '../models/Constraints9';
import { CordexModel } from '../models/CordexModel';
import { Constraints8 } from '../models/Constraints8';
import { Constraints9 } from '../models/Constraints9';
import { CordexModel } from '../models/CordexModel';
import { CordexRegion } from '../models/CordexRegion';
import { BiodiversitySensitiveAreasProcessParams } from '../models/BiodiversitySensitiveAreasProcessParams';
import { BooleanField } from '../models/BooleanField';
import { BoundingBox } from '../models/BoundingBox';
import { ClimateRiskInputs } from '../models/ClimateRiskInputs';
@jdroenner
jdroenner changed the base branch from main to v1 August 24, 2026 09:27
@jdroenner
jdroenner changed the base branch from v1 to main August 24, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants