Skip to content

Commit

Permalink
refactor/feat: added topic and attribute names to the description of …
Browse files Browse the repository at this point in the history
…the attribute completeness plot #828
  • Loading branch information
JanReifenrath authored and Gigaszi committed Nov 12, 2024
1 parent 049e678 commit 2a1e9db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(
self.attribute_key = attribute_key
self.absolute_value_1 = None
self.absolute_value_2 = None
self.description = None

async def preprocess(self) -> None:
attribute = build_attribute_filter(self.attribute_key, self.topic.key)
Expand All @@ -69,26 +70,28 @@ def calculate(self) -> None:
if self.result.value is None:
self.result.description += " No features in this region"
return
description = Template(self.templates.result_description).substitute(
self.description = Template(self.templates.result_description).substitute(
result=round(self.result.value, 2),
all=round(self.absolute_value_1, 1),
matched=round(self.absolute_value_2, 1),
topic=self.topic.name,
tag=self.attribute_key[0],
)

if self.result.value >= self.threshold_yellow:
self.result.class_ = 5
self.result.description = (
description + self.templates.label_description["green"]
self.description + self.templates.label_description["green"]
)
elif self.threshold_yellow > self.result.value >= self.threshold_red:
self.result.class_ = 3
self.result.description = (
description + self.templates.label_description["yellow"]
self.description + self.templates.label_description["yellow"]
)
else:
self.result.class_ = 1
self.result.description = (
description + self.templates.label_description["red"]
self.description + self.templates.label_description["red"]
)

def create_figure(self) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ label_description:
undefined: >-
The quality level could not be calculated for this indicator.
result_description: >-
The ratio of the features (all: $all) compared to features with
expected tags (matched: $matched) is $result.
The ratio of the topic $topic in the selected area (all: $all) compared to the topic $topic with the
expected tag "$tag" (matched: $matched) is $result.

0 comments on commit 2a1e9db

Please sign in to comment.