Skip to content

Commit a86ab4e

Browse files
committed
Remove broken exclusion of activities from traceable denominator
#21 This was meant to exclude activities that were only referenced by themselves from the denominator, but the calculation was at the publisher level, where we don't know if other publishers will reference them yet.
1 parent cf1c33e commit a86ab4e

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

Diff for: stats/analytics.py

+2-13
Original file line numberDiff line numberDiff line change
@@ -1840,15 +1840,6 @@ def provider_activity_id_without_own(self):
18401840
out = {k: v for k, v in self.aggregated['provider_activity_id'].items() if k not in self.aggregated['iati_identifiers']}
18411841
return out
18421842

1843-
@returns_numberdict
1844-
def provider_activity_id_own_only(self):
1845-
out = defaultdict(int)
1846-
for activity_id, provider_activity_ids in self.aggregated['provider_activity_id_by_activity_id'].items():
1847-
if all(x in self.aggregated['iati_identifiers'] for x in provider_activity_ids):
1848-
for provider_activity_id, count in provider_activity_ids.items():
1849-
out[provider_activity_id] += count
1850-
return out
1851-
18521843
@returns_numberdictdict
18531844
def sum_commitments_and_disbursements_by_activity_id_by_publisher_id_usd(self):
18541845
# These 2 by_publisher_id functions produce similar data to the invert
@@ -1915,8 +1906,7 @@ def traceable_sum_commitments_and_disbursements_by_publisher_id_denominator(self
19151906
out = defaultdict(Decimal)
19161907
for publisher_id, d in self.aggregated['sum_commitments_and_disbursements_by_activity_id_by_publisher_id_usd'].items():
19171908
for k, v in d.items():
1918-
if k not in self.aggregated['provider_activity_id_own_only']:
1919-
out[publisher_id] += v
1909+
out[publisher_id] += v
19201910
return out
19211911

19221912
@returns_numberdict
@@ -1933,6 +1923,5 @@ def traceable_activities_by_publisher_id_denominator(self):
19331923
out = defaultdict(int)
19341924
for publisher_id, iati_identifiers_counts in self.aggregated['iati_identifiers_by_publisher_id'].items():
19351925
for iati_identifier, count in iati_identifiers_counts.items():
1936-
if iati_identifier not in self.aggregated['provider_activity_id_own_only']:
1937-
out[publisher_id] += count
1926+
out[publisher_id] += count
19381927
return out

0 commit comments

Comments
 (0)