Skip to content

Commit 7b91c19

Browse files
authored
feat: remove size restriction and improve description for user activity (#955)
* feat: remove size restriction and improve description * fix: revert quality dimension to none * chore: rerun cassettes
1 parent 27d019d commit 7b91c19

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

ohsome_quality_api/indicators/indicators.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@ user-activity:
8484
- bkg
8585
quality_dimension: none
8686
description: >-
87-
User activity over time.
87+
Shows the count of unique mappers per month for the selected topic. None-quality indicator.

ohsome_quality_api/indicators/user_activity/indicator.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@ def create_figure(self):
9393
weights = np.arange(1, window + 1)
9494
weighted_avg = []
9595

96-
for i in range(len(values)):
96+
values_for_mean = values[1:]
97+
for i in range(len(values_for_mean) + 1):
98+
if i == 0:
99+
continue
97100
start = max(0, i - window + 1)
98-
window_vals = values[start : i + 1]
101+
window_vals = values_for_mean[start : i + 1]
99102
window_weights = weights[-len(window_vals) :]
100103
avg = np.dot(window_vals, window_weights) / window_weights.sum()
101104
weighted_avg.append(avg)

ohsome_quality_api/oqt.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ async def create_indicator(
4040
"attribute-completeness",
4141
"land-cover-thematic-accuracy",
4242
"land-cover-completeness",
43+
"user-activity",
4344
]:
4445
validate_area(feature)
4546
tasks.append(

tests/approvals/integrationtests/indicators/test_user_activity.py-TestFigure-test_create_figure.approved.json

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,18 +1538,16 @@
15381538
"2007-10-01T00:00:00Z"
15391539
],
15401540
"y": [
1541-
0.0,
1542-
10.434782608695652,
1543-
14.303030303030303,
1544-
14.833333333333334,
1545-
18.76,
1546-
19.12280701754386,
1547-
18.634920634920636,
1548-
18.441176470588236,
1549-
18.291666666666668,
1550-
18.813333333333333,
1551-
18.961038961038962,
1552-
19.71794871794872,
1541+
20.52173913043478,
1542+
18.87878787878788,
1543+
22.333333333333332,
1544+
21.8,
1545+
20.596491228070175,
1546+
19.904761904761905,
1547+
19.36764705882353,
1548+
19.59722222222222,
1549+
19.466666666666665,
1550+
19.974025974025974,
15531551
20.115384615384617,
15541552
21.166666666666668,
15551553
21.358974358974358,
@@ -1753,7 +1751,8 @@
17531751
1.7692307692307692,
17541752
1.358974358974359,
17551753
1.1153846153846154,
1756-
0.7564102564102564
1754+
0.7564102564102564,
1755+
0.6363636363636364
17571756
]
17581757
},
17591758
{

0 commit comments

Comments
 (0)