Skip to content

Commit

Permalink
feat: slightly changed plot description and its tests #841 #828
Browse files Browse the repository at this point in the history
  • Loading branch information
JanReifenrath authored and Gigaszi committed Nov 12, 2024
1 parent 652e625 commit 9fefad7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def create_description(self):
raise ValueError("Invalid aggregation_type")

self.description = Template(self.templates.result_description).substitute(
result=round(self.result.value, 2),
result=round(self.result.value, 4) * 100,
all=all,
matched=matched,
topic=self.topic.name.lower(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
label_description:
red: >-
Less than 25% of the features match the expected tags.
The attribute completeness is low (<25%).
yellow: >-
Around 25-75% of the features match the expected tags.
The attribute completeness is medium (25%-75%).
green: >-
More than 75% of the features match the expected tags.
The attribute completeness is high (>75%).
undefined: >-
The quality level could not be calculated for this indicator.
result_description: >-
The ratio of the topic $topic in the selected area (all: $all) compared to the topic $topic with the
expected $tags (matched: $matched) is $result.
$result% of all "$topic" features (all: $all) in your area of interest have the selected additional $tags (matched: $matched).
20 changes: 9 additions & 11 deletions tests/integrationtests/indicators/test_attribute_completeness.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,9 @@ def indicator(
asyncio.run(indicator.preprocess())
indicator.calculate()
assert indicator.description == (
"The ratio of the topic building count in the "
"selected area (all: 30237 elements) compared to"
" the topic building count with the expected attribute"
" height of buildings (matched: 11948 elements) is 0.4. "
'39.51% of all "building count" features (all: 30237 elements) in your '
"area of interest have the selected additional attribute height of "
"buildings (matched: 11948 elements)."
)
return indicator

Expand All @@ -141,10 +140,9 @@ def test_create_description():
indicator.absolute_value_2 = 2
indicator.create_description()
assert indicator.description == (
"The ratio of the topic building count in"
" the selected area (all: 10 elements) compared"
" to the topic building count with the expected "
"attribute height of buildings (matched: 2 elements) is 0.2. "
'20.0% of all "building count" features (all: 10 elements) in your area of '
"interest have the selected additional attribute height of buildings "
"(matched: 2 elements)."
)


Expand All @@ -159,9 +157,9 @@ def test_create_description_multiple_attributes():
indicator.absolute_value_2 = 2
indicator.create_description()
assert indicator.description == (
"The ratio of the topic building count in the selected area (all: 10 elements)"
" compared to the topic building count with the expected attributes height of"
" buildings, house number, street address (matched: 2 elements) is 0.2. "
'20.0% of all "building count" features (all: 10 elements) in your area of '
"interest have the selected additional attributes height of buildings, house "
"number, street address (matched: 2 elements)."
)


Expand Down

0 comments on commit 9fefad7

Please sign in to comment.