From 7999265032e5453d2b8392960d3ced2533de917d Mon Sep 17 00:00:00 2001 From: Overmeen Date: Mon, 8 Dec 2025 11:20:08 +0100 Subject: [PATCH] Add two additional columns to results gpkg --- hydamo_validation/logical_validation.py | 15 +++++++++++++++ hydamo_validation/summaries.py | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hydamo_validation/logical_validation.py b/hydamo_validation/logical_validation.py index 1e93fa3..051c098 100644 --- a/hydamo_validation/logical_validation.py +++ b/hydamo_validation/logical_validation.py @@ -12,6 +12,8 @@ "invalid", "invalid_critical", "invalid_non_critical", + "invalid_auto_fixable", + "invalid_manual_fixable", "ignored", "summary", "tags_assigned", @@ -93,6 +95,7 @@ def gdf_add_summary( critical, tags, tags_indices, + auto_fixable=False, separator=LIST_SEPARATOR, ): gdf.loc[gdf[variable] == False, "rating"] -= penalty @@ -106,6 +109,15 @@ def gdf_add_summary( gdf.loc[gdf[variable] == False, "invalid_non_critical"] += ( f"{rule_id}{separator}" ) + if auto_fixable: + gdf.loc[gdf[variable] == False, "invalid_auto_fixable"] += ( + f"{rule_id}{separator}" + ) + else: + gdf.loc[gdf[variable] == False, "invalid_manual_fixable"] += ( + f"{rule_id}{separator}" + ) + if tags is not None: gdf.loc[tags_indices, ("tags_assigned")] += f"{tags}{separator}" gdf.loc[gdf[variable] == False, "tags_invalid"] += f"{tags}{separator}" @@ -316,6 +328,8 @@ def execute( else: tags = None + auto_fixable = rule.get("auto_fixable", False) + exceptions += filter_indices _valid_indices = object_gdf[~object_gdf.index.isna()].index tags_indices = [i for i in _valid_indices if i not in exceptions] @@ -328,6 +342,7 @@ def execute( critical=critical, tags=tags, tags_indices=tags_indices, + auto_fixable=auto_fixable, ) except Exception as e: diff --git a/hydamo_validation/summaries.py b/hydamo_validation/summaries.py index 03c715f..677ca10 100644 --- a/hydamo_validation/summaries.py +++ b/hydamo_validation/summaries.py @@ -86,7 +86,7 @@ def join_gdf(self, gdf, layer): setattr( self, layer, - results_gdf.join(gdf), + results_gdf.join(gdf, how="left", rsuffix="_right"), ) def export(self, results_path, output_types=OUTPUT_TYPES):