Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quality_data: overview: Fix incorrect field summing passing grants #247

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

michaelwood
Copy link
Member

When calculating the overview stats for /api/dashboard/overview?mode=grants the logic of fail/pass was being used to count the total number of grants which passed by just using the total number of grants that are in the source file.

This is only correct some of the time because it just so happens that if a publisher is likely to be missing a field (such as company number) then they will miss it out of all of their datasets so the calculation is coincidentally correct. Some publishers however do add such fields for some of their grants which makes this calculation completely incorrect for certain metrics.

This change makes sure we use the total count from the DQT (library) rather than the aggregated data.

Updates basic test data to corrected value.

Fixes: #246

@michaelwood
Copy link
Member Author

@mariongalley the impact of this fix is that three metrics will be corrected significantly on https://qualitydashboard.threesixtygiving.org/alldata#grants :

  • "Includes recipient locations codes" goes to 65% from 80%
  • "Includes at least one charity or company no." goes to 54% from 108%
  • "Includes grant duration" goes to 47% from 52%

@michaelwood
Copy link
Member Author

I've created #248 as we need some worse quality test data to get better nuances on automated quality tests in the datastore for this, currently the totals generally add up to either 0% or 100% which can too easily coincidentally happen.

When calculating the overview stats for /api/dashboard/overview?mode=grants
the logic of fail/pass was being used to count the total number of
grants which passed by just using the total number of grants that are in
the source file.

This is only correct some of the time because it just so happens that if a
publisher is likely to be missing a field (such as company number) then they
will miss it out of all of their datasets so the calculation is coincidentally
correct. Some publishers however do add such fields for _some_ of their
grants which makes this calculation completely incorrect for certain
metrics.

This change makes sure we use the total count from the DQT (library)
rather than the aggregated data.

Updates basic test data to corrected value.

Fixes: #246
@michaelwood michaelwood force-pushed the mw/fix_quality_grants_overview_stats branch from 35ad43a to f0beb5c Compare December 16, 2024 14:25
@michaelwood michaelwood requested a review from R2ZER0 December 16, 2024 14:26
Copy link
Contributor

@R2ZER0 R2ZER0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@michaelwood michaelwood merged commit 8f6cdb0 into live Dec 16, 2024
4 of 6 checks passed
@michaelwood michaelwood deleted the mw/fix_quality_grants_overview_stats branch December 16, 2024 14:35
@michaelwood
Copy link
Member Author

deployed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quality Dashboard shows > 100% org IDs
2 participants