GraphQL API for bene-reach statistic (Dashboard)#2794
Draft
pylipp wants to merge 7 commits into
Draft
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2794 +/- ##
==========================================
+ Coverage 77.13% 77.16% +0.02%
==========================================
Files 327 327
Lines 23458 23486 +28
Branches 2355 2358 +3
==========================================
+ Hits 18095 18123 +28
Misses 5315 5315
Partials 48 48
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new protected GraphQL statistics query (beneficiaryReach) to power the dashboard’s “beneficiary reach” statistic, including new schema types/enums, backend computation logic, and an endpoint test to validate the response structure and contents.
Changes:
- Extend the GraphQL schema with
beneficiaryReach(baseId: Int!)plus supportingBeneficiaryReach*types andBeneficiaryReachTypeenum. - Implement the backend resolver + statistics CRUD query logic to assemble reach “facts” and related dimensions (beneficiaries, tags).
- Add an endpoint test asserting the expected
beneficiaryReachresponse.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| graphql/generated/schema.graphql | Adds generated schema types/unions/enums for beneficiaryReach. |
| graphql/generated/graphql-env.d.ts | Updates generated TS introspection types for the new query/types. |
| back/test/endpoint_tests/test_statistics.py | Adds endpoint test coverage for beneficiaryReach. |
| back/boxtribute_server/graph_ql/enums.py | Registers BeneficiaryReachType for GraphQL enum mapping. |
| back/boxtribute_server/graph_ql/definitions/protected/queries.graphql | Exposes beneficiaryReach on the protected Query type. |
| back/boxtribute_server/graph_ql/definitions/basic/types.graphql | Adds BeneficiaryReachData/Result/Dimensions and updates unions. |
| back/boxtribute_server/graph_ql/definitions/basic/enums.graphql | Adds GraphQL enum BeneficiaryReachType. |
| back/boxtribute_server/enums.py | Introduces backend BeneficiaryReachType enum. |
| back/boxtribute_server/business_logic/statistics/queries.py | Adds resolver beneficiaryReach with authorization + DB replica usage. |
| back/boxtribute_server/business_logic/statistics/crud.py | Implements compute_beneficiary_reach and beneficiary dimension generation. |
Comment on lines
+330
to
+334
| dimensions = _generate_dimensions("beneficiary", facts=facts) | ||
| for b in dimensions["beneficiary"]: | ||
| b["tag_ids"] = sorted(convert_ids(b["tag_ids"])) | ||
| dimensions.update(_generate_dimensions("tag", facts=dimensions["beneficiary"])) | ||
| return DataCube(facts=facts, dimensions=dimensions, type="BeneficiaryReachData") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://trello.com/c/GJBuu7rx