Skip to content

DT-3047: Save DAA IDs when submitting a DAR or PR#2850

Merged
rushtong merged 10 commits intodevelopfrom
gr-DT-3047-save-dar-daaIds
Apr 3, 2026
Merged

DT-3047: Save DAA IDs when submitting a DAR or PR#2850
rushtong merged 10 commits intodevelopfrom
gr-DT-3047-save-dar-daaIds

Conversation

@rushtong
Copy link
Copy Markdown
Contributor

@rushtong rushtong commented Apr 2, 2026

Addresses

https://broadworkbench.atlassian.net/browse/DT-3047

Summary

This PR adds the DAA IDs for the datasets in a DAR or PR when the entity is saved. These ids are stored in the DAR's json data package and can be referred to in other workflows.


Have you read CONTRIBUTING.md lately? If not, do that first.

  • Label PR with a Jira ticket number and include a link to the ticket
  • Label PR with a security risk modifier [no, low, medium, high]
  • PR describes scope of changes
  • Get a minimum of one thumbs worth of review, preferably two if enough team members are available
  • Get PO sign-off for all non-trivial UI or workflow changes
  • Verify all tests go green
  • Test this change deployed correctly and works on dev environment after deployment

@rushtong rushtong marked this pull request as ready for review April 2, 2026 20:08
@rushtong rushtong requested a review from a team as a code owner April 2, 2026 20:08
@rushtong rushtong requested review from Copilot, kevinmarete and otchet-broad and removed request for a team April 2, 2026 20:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds persistence of Data Access Agreement (DAA) IDs into the stored JSON “data package” for Data Access Requests (DARs) and Progress Reports (PRs), so downstream workflows can reference the DAAs that applied at submission time.

Changes:

  • Add daaIds to DataAccessRequestData and populate it during DAR submission and PR submission.
  • Introduce DaaDAO.findDaaIdsByDatasetIds(...) to resolve DAAs from dataset IDs via DAC associations.
  • Extend unit/integration tests to cover the new DAO query and (partially) the new service behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/main/java/org/broadinstitute/consent/http/service/DataAccessRequestService.java Sets daaIds on DAR/PR submission by querying DAAs for relevant dataset IDs.
src/main/java/org/broadinstitute/consent/http/models/DataAccessRequestData.java Adds List<Integer> daaIds with getter/setter for JSON persistence.
src/main/java/org/broadinstitute/consent/http/db/DaaDAO.java Adds SQL query to fetch DAA IDs for a list of dataset IDs.
src/main/java/org/broadinstitute/consent/http/db/DAOContainer.java Wires DaaDAO into the shared DAO container.
src/main/java/org/broadinstitute/consent/http/ConsentModule.java Provides DaaDAO into DAOContainer for DI construction of services.
src/test/java/org/broadinstitute/consent/http/service/DataAccessRequestServiceTest.java Updates service tests to include DaaDAO wiring and verify DAA lookup on DAR submission.
src/test/java/org/broadinstitute/consent/http/models/DataAccessRequestDataTest.java Adds extensive getter/setter coverage including daaIds.
src/test/java/org/broadinstitute/consent/http/db/DaaDAOTest.java Adds integration tests for findDaaIdsByDatasetIds behavior across association scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

List<Integer> datasetIds = dataAccessRequest.getDatasetIds();

// Save the agreed upon DAAs at the time of DAR submission
List<Integer> daaIds = daaDAO.findDaaIdsByDatasetIds(datasetIds);
Copy link
Copy Markdown
Contributor

@otchet-broad otchet-broad Apr 3, 2026

Choose a reason for hiding this comment

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

Could we add the DAA IDs that were agreed to to the DataAccessRequestData object and store those values?

We have other tickets to verify the value in DataAccessRequestData contains the full list needed. I expect that we'll call something in DataAccessRequestService on submission (not draft) that verifies the list contains the needed elements or we'll reject the creation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When a DAR comes into the service layer, there are no DAA id values in the DataAccessRequestData. The UI does not populate that value in the POST request. A different approach would be to populate the values in the DatasetService.enforceDAARestrictions method, but that would be overloading (in the colloquial sense) that method's intention.

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.

I think we should add the DAAs to the DataAccessRequestData object so we know what IDs were loaded when the client submitted the DARs. If we just add them at submission time, how can we be sure they were actually reviewed by the client?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Per conversation, we're removing the explicit set values and relying on the UI to populate correct values.


// Save the agreed upon DAAs at the time of PR submission
DataAccessRequestData darData = progressReport.getData();
List<Integer> daaIds = daaDAO.findDaaIdsByDatasetIds(new ArrayList<>(progressReportDatasetIds));
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.

Same here. Why not just save the DAAs provided in DataAccessRequestData?

@otchet-broad
Copy link
Copy Markdown
Contributor

Thanks for the updates! Looks good!

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@otchet-broad otchet-broad left a comment

Choose a reason for hiding this comment

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

👍

@rushtong rushtong merged commit 0471821 into develop Apr 3, 2026
14 checks passed
@rushtong rushtong deleted the gr-DT-3047-save-dar-daaIds branch April 3, 2026 17:26
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.

4 participants