[DT-3939] DAC Dashboard API. - #3013
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new DAC Dashboard Summary API endpoint and refactors existing dashboard services to share Elasticsearch aggregation/query logic in a single place.
Changes:
- Introduces
/api/dac/dashboard-summary(resource, service, DAO) plus OpenAPI path/schema and tests. - Extracts shared Elasticsearch aggregation/query logic into
DashboardSearchServiceand shared async join handling intoDashboardServiceSupport. - Updates Researcher and Signing Official dashboards to use the shared search service and shared response fragments (
DashboardSummaryrecords).
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/org/broadinstitute/consent/http/resources/DacDashboardResource.java | Adds the DAC dashboard summary endpoint (authenticated, role-gated). |
| src/main/java/org/broadinstitute/consent/http/service/DacDashboardService.java | Implements DAC summary aggregation across DB + Elasticsearch. |
| src/main/java/org/broadinstitute/consent/http/db/DacDashboardDAO.java | Adds one-roundtrip SQL aggregation for DAC dashboard counts. |
| src/main/java/org/broadinstitute/consent/http/service/DashboardSearchService.java | Centralizes shared Elasticsearch aggregation/query + parsing. |
| src/main/java/org/broadinstitute/consent/http/service/DashboardServiceSupport.java | Centralizes async join/exception-unwrapping behavior. |
| src/main/java/org/broadinstitute/consent/http/service/ResearcherDashboardService.java | Refactors to use DashboardSearchService. |
| src/main/java/org/broadinstitute/consent/http/service/SigningOfficialDashboardService.java | Refactors to use DashboardSearchService. |
| src/main/java/org/broadinstitute/consent/http/models/DashboardSummary.java | Adds shared response fragments (records) for dashboards. |
| src/main/java/org/broadinstitute/consent/http/models/DacDashboardSummary.java | Adds DAC dashboard response model. |
| src/main/java/org/broadinstitute/consent/http/models/ResearcherDashboardSummary.java | Switches to shared response fragments. |
| src/main/java/org/broadinstitute/consent/http/models/SigningOfficialDashboardSummary.java | Switches to shared response fragments. |
| src/main/java/org/broadinstitute/consent/http/ConsentModule.java | Wires up new services via Guice providers. |
| src/main/java/org/broadinstitute/consent/http/ConsentApplication.java | Registers the new DAC dashboard resource. |
| src/main/resources/assets/api-docs.yaml | Adds OpenAPI path reference for the new endpoint. |
| src/main/resources/assets/paths/dacDashboardSummary.yaml | Defines the OpenAPI operation for DAC dashboard summary. |
| src/main/resources/assets/schemas/DacDashboardSummary.yaml | Defines the OpenAPI schema for DAC dashboard summary. |
| src/test/java/org/broadinstitute/consent/http/service/DacDashboardServiceTest.java | Adds service-level tests for DAC dashboard behavior. |
| src/test/java/org/broadinstitute/consent/http/db/DacDashboardDAOTest.java | Adds DAO integration tests for DAC dashboard SQL counts. |
| src/test/java/org/broadinstitute/consent/http/resources/DacDashboardResourceTest.java | Adds resource-level tests for DAC dashboard endpoint. |
| src/test/java/org/broadinstitute/consent/http/service/ResearcherDashboardServiceTest.java | Updates wiring to the shared search service. |
| src/test/java/org/broadinstitute/consent/http/service/SigningOfficialDashboardServiceTest.java | Updates wiring to the shared search service. |
| src/test/java/org/broadinstitute/consent/http/resources/ResearcherDashboardResourceTest.java | Updates imports to shared response fragments. |
| src/test/java/org/broadinstitute/consent/http/resources/SigningOfficialDashboardResourceTest.java | Updates imports to shared response fragments. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
kevinmarete
left a comment
There was a problem hiding this comment.
Nice work, one blocking issue, matching the concern in the DUOS UI PR.
P1 — Dual-role users lose member-scoped DAR counts
A user with both Chairperson and Member roles is always evaluated as a Chairperson here. Since DacDashboardDAO.getCounts() filters user_role by that single role ID, DARs and pending votes from DACs where the user is only a member are omitted.
This also makes the response internally inconsistent: getDacIds(user) supplies associations from both roles to the Elasticsearch counts, while the relational DAR counts include only Chairperson associations.
Could we aggregate both role scopes for dual-role users, deduplicating collections that overlap, or otherwise let the caller select a role? This needs to preserve the different awaitingMyVote semantics for chairs and members.
|



Addresses
https://broadworkbench.atlassian.net/browse/DT-3939
Summary
Have you read CONTRIBUTING.md lately? If not, do that first.