Skip to content

[DT-3063, DT-3065] Store relationship between DARs/Progress Reports and DAAs, Flag DARs/PRs for SO approval when user not pre authorized for DAAs#2859

Open
otchet-broad wants to merge 23 commits intodevelopfrom
otchet-dt-3063-find-daas-for-dataset-ids
Open

[DT-3063, DT-3065] Store relationship between DARs/Progress Reports and DAAs, Flag DARs/PRs for SO approval when user not pre authorized for DAAs#2859
otchet-broad wants to merge 23 commits intodevelopfrom
otchet-dt-3063-find-daas-for-dataset-ids

Conversation

@otchet-broad
Copy link
Copy Markdown
Contributor

@otchet-broad otchet-broad commented Apr 8, 2026

Addresses

https://broadworkbench.atlassian.net/browse/DT-3063
https://broadworkbench.atlassian.net/browse/DT-3065

Summary

  • Provides an API for obtaining the mapping of the DAAs to a list of datasets so that the client can display the relationship
  • Validates the DAAs submitted match the DAR or Progress Report (when not a closeout) expected DAAs and routes the DAR to either the SO or the DAC.
  • Stores the relationship between data_access_request table entries with DAAs on DAR or Progress Report (when not a closeout) submission

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

@otchet-broad otchet-broad marked this pull request as ready for review April 8, 2026 22:24
@otchet-broad otchet-broad requested a review from a team as a code owner April 8, 2026 22:24
@otchet-broad otchet-broad requested review from eweitz, fboulnois, kevinmarete and rushtong and removed request for a team April 8, 2026 22:24
@otchet-broad otchet-broad marked this pull request as draft April 8, 2026 22:41
@otchet-broad otchet-broad changed the title [DT-3063] Store relationship between DARs/Progress Reports and DAAs [DT-3063, DT-3065] Store relationship between DARs/Progress Reports and DAAs Apr 9, 2026
@otchet-broad otchet-broad changed the title [DT-3063, DT-3065] Store relationship between DARs/Progress Reports and DAAs [DT-3063, DT-3065] Store relationship between DARs/Progress Reports and DAAs, Flag DARs/PRs for SO approval when user not pre authorized for DAAs Apr 9, 2026
@otchet-broad otchet-broad marked this pull request as ready for review April 9, 2026 21:56
Copy link
Copy Markdown
Contributor

@rushtong rushtong left a comment

Choose a reason for hiding this comment

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

Still reviewing functionally, but wanted to get this first pass of feedback out in the meantime.

}

@Override
public Stream<Entry<Integer, Set<Integer>>> stream(Map<Integer, Set<Integer>> container) {
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.

This looks super useful 👍🏽

Comment on lines +250 to +259
Integer darId =
dataAccessRequestDAO.insertDataAccessRequest(
collectionId,
referenceId,
user.getUserId(),
now,
now,
now,
darData,
user.getEraCommonsId());
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.

It would be nice if these were both in a single transaction. I have some WITH examples that might serve as a template for this in one of my open PRs.

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.

I might go with a slightly different approach to see how we like it, but it will be in one transaction.

Copy link
Copy Markdown
Contributor Author

@otchet-broad otchet-broad Apr 10, 2026

Choose a reason for hiding this comment

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

Coming back to this one. It looks like there were already multiple database updates in this method that should effectively unwind if there's an error here, but because of the number of elements involved, I'm wondering if we should make a ticket for this and come back to it later. Would that be acceptable? There are also other methods in this class (and related services) that need to be linked as well, hence my hesitation to add this to the scope of this ticket.

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.

Sure thing - it would be nice to tighten this up separately

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.

DT-3176 created.

// We need to set the new DAAs that were in place on the DAR because the DAAs may have been
// updated
// from the original DAR.
originalDataCopy.setDaaIds(newData.getDaaIds());
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.

Just clarifying that I think we're planning on the FE to populate these values on submission. If not, these will be empty.

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.

Exactly. It's the next ticket I'm grabbing. :-)

Comment thread src/main/java/org/broadinstitute/consent/http/db/DaaDAO.java
"""
INSERT INTO dar_daa (dar_id, daa_id) VALUES (:darId, :daaId)
""")
void insertDarDAARelationship(@Bind("darId") Integer darId, @Bind("daaId") Set<Integer> daaIds);
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.

Copilot caught this for me - I was unaware of this detail. See current jdbi doc for reference.

In JDBI 3, all @SqlBatch parameters are expected to be iterable. A non-iterable scalar must be annotated with @SingleValue to be held constant per row. Without it, behavior is undefined across JDBI point-releases and the batch will fail if the set has more than one element.

Fix:

void insertDarDAARelationship(@Bind("darId") @SingleValue Integer darId,
                              @Bind("daaId") Set<Integer> daaIds);

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.

I want to spend some time looking at this because I think I wrote a test that ends up proving this works. See testStoreDarDAARelationshipForPR in DaaDAOTest.java

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.

I've updated the method and added the @SingleValue decoration. No change in the test result. Looking at the docs, they all are using the @SingleValue decoration on Collection parameters. That's different than what I've got in the code. darId is a single integer value. I've added an assertion to the testStoreDarDAARelationshipForPR to confirm multiple rows are being inserted as expected.

Comment thread src/main/resources/assets/paths/daaDatasets.yaml Outdated
Comment thread src/main/resources/assets/paths/daaDatasets.yaml Outdated
Comment thread src/main/java/org/broadinstitute/consent/http/db/DaaDAO.java Outdated
Copy link
Copy Markdown
Contributor

@rushtong rushtong left a comment

Choose a reason for hiding this comment

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

Thank you for the updates 👍🏽

…lationships and record new ones based on the object submitted.
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants