Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions hydamo_validation/logical_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"invalid",
"invalid_critical",
"invalid_non_critical",
"invalid_auto_fixable",
"invalid_manual_fixable",
"ignored",
"summary",
"tags_assigned",
Expand Down Expand Up @@ -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
Expand All @@ -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}"
Expand Down Expand Up @@ -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]
Expand All @@ -328,6 +342,7 @@ def execute(
critical=critical,
tags=tags,
tags_indices=tags_indices,
auto_fixable=auto_fixable,
)

except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion hydamo_validation/summaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down