feat: climate risk from cmip cordex - #18
Conversation
ChristianBeilschmidt
left a comment
There was a problem hiding this comment.
Konnte das aus Gründen (Karte) nicht anwenden. Aber hier schon mal meine Kommentare.
| volumeMounts: | ||
| - name: pgdata | ||
| mountPath: /var/lib/postgresql/data | ||
| mountPath: /var/lib/postgresql/18/docker |
There was a problem hiding this comment.
Warum ist das anders, obwohl sich sonst nichts an der Container-Config geändert hat?
There was a problem hiding this comment.
There was a problem hiding this comment.
Also ich hab das nochmal versucht aber mit dem neusten Image geht das einfach nicht anders :(
| @@ -0,0 +1 @@ | |||
| ./backend/rust-toolchain.toml No newline at end of file | |||
There was a problem hiding this comment.
Coverage am besten > 80% lassen.
ChristianBeilschmidt
left a comment
There was a problem hiding this comment.
Ich konnte jetzt erst einmal nur Code-only anschauen. Müssen noch mal wegen der Daten sprechen.
| /// 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>, |
There was a problem hiding this comment.
Check: Sind das validate table schema Felder (https://datapackage.org/standard/table-schema/)
There was a problem hiding this comment.
ich hab das nochmal neu gemacht / machen lassen. Es müsste jetzt korrekt sein
| String, | ||
| Number, | ||
| Integer, | ||
| Percentage, |
There was a problem hiding this comment.
Es gibt keinen Percentage-Typ bei TableSchema: https://datapackage.org/standard/table-schema/#field-types
There was a problem hiding this comment.
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).
| </td> | ||
| } | ||
| } | ||
| @case (ColumnType.Percentage) { |
There was a problem hiding this comment.
Den Typ gibt es ja nicht in TableSchema
There was a problem hiding this comment.
das gibt es jetzt nicht mehr
| <mat-chip class="cell-content"> | ||
| <span | ||
| class="color-dot" | ||
| [style.background-color]="element[column.colorField]" |
There was a problem hiding this comment.
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/).
There was a problem hiding this comment.
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.
ChristianBeilschmidt
left a comment
There was a problem hiding this comment.
Alles bis auf Tabelle
| crs: Crs, | ||
| } | ||
|
|
||
| pub fn nearest_containing<T>( |
| /// BioIS-specific metadata for rendering a standard Table Schema field. | ||
| #[derive(Serialize, Deserialize, Debug, Clone)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub struct BioisTableSchemaExtension { |
There was a problem hiding this comment.
| pub struct BioisTableSchemaExtension { | |
| pub struct BioISTableSchemaExtension { |
| pub min: f64, | ||
| pub max: f64, | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub occurrence_probability: Option<f64>, |
There was a problem hiding this comment.
Der Typ serialisiert doch nach String.
| pub mean: f64, | ||
| pub median: f64, | ||
| pub min: f64, | ||
| pub max: f64, |
There was a problem hiding this comment.
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>, |
There was a problem hiding this comment.
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)] |
There was a problem hiding this comment.
Dann kann also #[allow(clippy::too_many_lines)] weg?
| 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(), | ||
| ); | ||
| } |
There was a problem hiding this comment.
Das ist genau der gleiche Code wie bisher.
| // 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); | ||
| } | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
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); |
| @if (type() === FieldType.Boolean) { | ||
| <mat-checkbox [checked]="value()" (change)="value.set($event.checked)" | ||
| >True/False</mat-checkbox | ||
| > | ||
| } @else { |
There was a problem hiding this comment.
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)
… extracted logging helpers, docs
…putation id tracking, DbHandle processor
# 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'; |

No description provided.