Skip to content

feat: biodiversity impact#14

Open
ChristianBeilschmidt wants to merge 16 commits into
mainfrom
feat/esrs-e4-b5
Open

feat: biodiversity impact#14
ChristianBeilschmidt wants to merge 16 commits into
mainfrom
feat/esrs-e4-b5

Conversation

@ChristianBeilschmidt
Copy link
Copy Markdown
Member

No description provided.

@ChristianBeilschmidt ChristianBeilschmidt force-pushed the feat/esrs-e4-b5 branch 4 times, most recently from 28151a4 to f697ec2 Compare May 7, 2026 14:35
Comment thread api-client/typescript/models/DocumentationSource.ts Fixed
Comment thread api-client/typescript/models/FeatureCollectionGeoJsonInput.ts Fixed
Comment thread api-client/typescript/models/GeoJSONFeatureCollection.ts Fixed
Comment thread api-client/typescript/models/GeoJSONFeature.ts Fixed
Comment thread api-client/typescript/models/GeoJSONFeatureId.ts Fixed
Comment thread api-client/typescript/models/GeoJSONFeatureGeometry.ts Fixed
Comment thread api-client/typescript/models/GeoJSONGeometryCollection.ts Fixed
@ChristianBeilschmidt ChristianBeilschmidt marked this pull request as ready for review May 19, 2026 10:04
Comment thread api-client/typescript/models/BiodiversitySensitiveAreasProcessOutputs.ts Dismissed
Comment thread api-client/typescript/models/DataResource.ts Fixed
Comment thread api-client/typescript/models/GeoJSONLineString.ts Fixed
Comment thread backend/src/processes/biodiversity_sensitive_areas/mod.rs Outdated
Comment thread backend/src/processes/biodiversity_sensitive_areas/input_site_type_property.md Outdated
Comment thread backend/src/processes/biodiversity_sensitive_areas/input_location_property.md Outdated
Comment thread backend/src/processes/biodiversity_sensitive_areas/input_sites.md Outdated
Comment thread backend/src/processes/biodiversity_sensitive_areas/input_location_property.md Outdated
SELECT
r.location,
r.area_m2 / 10_000 AS area_ha,
-- TODO: or union first over all intersections?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

does it really make sense to sum the intersections? if sensitive areas overlap they would be counted multiple times

maybe it would make sense to have for each location a list of all intersections with individual sensitive areas.

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.

But if I have one entry per Nature 2000 area, there is no good one overview entry per company site.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

true. but it is not really very readable if I get a text that concatenates all matching biodiversity areas after each other either. A list would be better. I mean, you have the info in a structured manner and then put it all in a string, giving up the structure.

I guess best would be to have for each site some global info like number and total area of all intersections, and then a list of all indiviual intersections. But that's just my opinion. We can leave it like it is.

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.

Comment thread backend/src/processes/biodiversity_sensitive_areas/mod.rs Outdated
Comment thread backend/src/processes/biodiversity_sensitive_areas/mod.rs Outdated
Comment thread backend/src/processes/biodiversity_sensitive_areas/mod.rs Outdated
Comment thread api-client/typescript/models/GeoJSONGeometryCollection.ts Fixed
Comment thread api-client/typescript/models/GeoJSONLineString.ts Fixed
@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented May 20, 2026

Coverage Status

coverage: 80.779% (+0.2%) from 80.558% — feat/esrs-e4-b5 into main

Comment thread api-client/typescript/models/BiodiversitySensitiveAreasProcessInputs.ts Dismissed
Comment thread api-client/typescript/models/GeoJSONGeometryCollection.ts Fixed
Comment thread api-client/typescript/models/AnyField.ts Dismissed
Comment thread api-client/typescript/models/ArrayField.ts Dismissed
Comment thread api-client/typescript/models/BooleanField.ts Dismissed
Comment thread api-client/typescript/models/Constraints.ts Dismissed
Comment thread api-client/typescript/models/Constraints1.ts Dismissed
Comment thread api-client/typescript/models/Constraints10.ts Dismissed
Comment thread api-client/typescript/models/Constraints10Enum.ts Dismissed
Comment thread api-client/typescript/models/Constraints12.ts Fixed
Comment thread api-client/typescript/models/Constraints11.ts Fixed
@@ -0,0 +1,55 @@
WITH reference AS (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

does this file need to be commited?

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.

site_inputs.push(SiteInput {
location,
was_point: was_point(feature),
buffer_size_km: site_specification.buffer_distance(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

name the field also distance maybe

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.

Comment thread backend/src/processes/path_info.rs Outdated
/// Process execution (Biodiversity Sensitive Areas – ESRS E4 B5)
#[allow(unused, reason = "Placeholder for spec only")]
#[derive(Deserialize, ToSchema, Debug)]
pub struct ImpactMetricsProcessParams {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe more consistent naming ImpactMetrics vs BiodiviersitySesnsitieAreas? can we just use one?

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.

/**
* The following constraints are supported for `geojson` fields.
*/
export class Constraints11 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe check naming, there are lots of constraints here with no apparent meaning

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.

I generate the schema by just inputting https://datapackage.org/profiles/2.0/dataresource.json. Thus, I don't have much influence on that :-/.

import { TableSchemaForeignKeyOneOfReference } from '../models/TableSchemaForeignKeyOneOfReference';
import { HttpFile } from '../http/http';

export class TableSchemaForeignKeyOneOf {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe try to avoid OneOf types names?

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.

I generate the schema by just inputting https://datapackage.org/profiles/2.0/dataresource.json. Thus, I don't have much influence on that :-/.

@@ -1,28 +1,12 @@
<div>
<h1 class="mat-h1">Result {{ processId() }}</h1>
<h1 class="mat-h1">Result {{ resultId() }}</h1>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe hide Errors if there aren't any

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.

How? Errors are just an output.

<mat-card-header>
<mat-card-title>
Results
@for (result of results(); track result.key) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe show result first and then documentation and inputs last

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.

How? I don't have an order.

COALESCE(ST_AREA(ST_INTERSECTION(s_in.geom, r.geom)), 0) > 0 AS site_in_biodiversity_sensitive_area,
ST_AREA(ST_INTERSECTION(s_out.geom, r.buffered_geom)) > 0 AS site_near_biodiversity_sensitive_area,
ST_AREA(ST_INTERSECTION(s_out.geom, r.buffered_geom)) AS biodiversity_sensitive_area_m2,
'Type: ' || r.specification || E'\n'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is the type not part of the input rather than of the output? For Marburger Unistation it will always be office on any intersecting area

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.

Well, it is part of the description why the results are how they are. What would you propose?

<mat-nav-list>
<a mat-list-item [routerLink]="['/app/results']"><mat-icon>assessment</mat-icon>Results</a>
<a mat-list-item [routerLink]="['/app/create']"><mat-icon>add</mat-icon>Create new</a>
<a mat-list-item [routerLink]="['/app/results']">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not related to this line: the text in the BioIS logo is so small that it cannot be read

<fieldset>
<legend>Inputs</legend>

@for (input of inputs(); track input.key) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the order of the inputs appears to be random. the orders is different each time for me. maybe make it alphabetically or specify a fixed order.

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.

JSON object order is not fixed unforunately. I have not a real idea how to solve this. I can make this alphabetical by now.

}

let site_table: Vec<SiteRow> = sql_query(formatdoc! {r#"
WITH reference AS (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

unrelated to this line:

I took your example json with the Marbuger [sic!] Unistation and duplciated the feature and changed the properties to

"properties": {
	  "location": "Marbuger Mine",
	  "siteType": "mining"
	}

I get this error:

2026-05-22T15:41:34.850820Z ERROR biois::processes::biodiversity_sensitive_areas: error: Failed to query Natura2000.naturasite_polygon

Caused by:
lwgeom_intersection_prec: GEOS Error: TopologyException: side location conflict at 4196987.1835999992 3037753.4884000057. This can occur if the input geometry is invalid.
at src/processes/biodiversity_sensitive_areas/mod.rs:772
in biois::processes::biodiversity_sensitive_areas::compute_biodiversity_sensitive_areas with natura2000_schema: "Natura2000", sites: FeatureCollectionGeoJsonInput { value: GeoJsonFeatureCollection(FeatureCollection { bbox: None, features: [Feature { bbox: None, geometry: Some(Geometry { bbox: None, value: Polygon { coordinates: [[Position([8.77366548049784, 50.803270291022386]), Position([8.773649409958182, 50.8024374636156]), Position([8.774613642351255, 50.80241207230304]), Position([8.774597571811597, 50.803255056507936]), Position([8.77366548049784, 50.803270291022386])]] }, foreign_members: None }), id: None, properties: Some({"location": String("Marbuger Unistadion"), "siteType": String("office")}), foreign_members: None }, Feature { bbox: None, geometry: Some(Geometry { bbox: None, value: Polygon { coordinates: [[Position([8.77366548049784, 50.803270291022386]), Position([8.773649409958182, 50.8024374636156]), Position([8.774613642351255, 50.80241207230304]), Position([8.774597571811597, 50.803255056507936]), Position([8.77366548049784, 50.803270291022386])]] }, foreign_members: None }), id: None, properties: Some({"location": String("Marbuger Mine"), "siteType": String("mining")}), foreign_members: None }], foreign_members: None }), media_type: GeoJson }, location_property: "location", site_type_property: "siteType", unit_for_area: Hectare

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.

Cannot reproduce this. Can you give me the whole input?

Comment thread api-client/typescript/models/Constraints12Enum.ts Fixed
Comment thread api-client/typescript/models/BiodiversitySensitiveAreasProcessParams.ts Dismissed
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