Skip to content

GraphQL API for bene-reach statistic (Dashboard)#2794

Draft
pylipp wants to merge 7 commits into
masterfrom
bene-reached-graphql-api
Draft

GraphQL API for bene-reach statistic (Dashboard)#2794
pylipp wants to merge 7 commits into
masterfrom
bene-reached-graphql-api

Conversation

@pylipp

@pylipp pylipp commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.16%. Comparing base (4ddb69e) to head (416a035).
⚠️ Report is 1 commits behind head on master.

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              
Flag Coverage Δ
backend 99.65% <ø> (+<0.01%) ⬆️
frontend 69.99% <ø> (ø)
sharedComponents 68.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 supporting BeneficiaryReach* types and BeneficiaryReachType enum.
  • Implement the backend resolver + statistics CRUD query logic to assemble reach “facts” and related dimensions (beneficiaries, tags).
  • Add an endpoint test asserting the expected beneficiaryReach response.

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")
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.

2 participants