Skip to content

[BI-1606] Allow germplasm records to be in multiple lists#224

Merged
dmeidlin merged 19 commits intodevelopfrom
feature/BI-1606
Feb 9, 2023
Merged

[BI-1606] Allow germplasm records to be in multiple lists#224
dmeidlin merged 19 commits intodevelopfrom
feature/BI-1606

Conversation

@dmeidlin
Copy link
Contributor

@dmeidlin dmeidlin commented Nov 10, 2022

Description

Story: BI-1606

Instead of using the list name(which may or may not be unique in the future) as the key for the mapping described in the card, a UUID is created for new lists and stored as an entry in the list's external references.

  1. Updated Germplasm#constructBrAPIList to add a new external reference with referenceSource set to <BRAPI_BASE_URL>/lists and referenceId set to a randomly generated UUID.

  2. Updated Germplasm#constructBrAPIGermplasm(Program, BreedingMethodEntity, User, boolean, String, Supplier) to accept an argument of UUID germplasmListId

  3. Updated Germplasm#constructBrAPIGermplasm(BreedingMethodEntity, User) to accept an argument of UUID germplasmListId

  4. Updated the code in Germplasm#constructBrAPIGermplasm(BreedingMethodEntity, User) that currently sets GERMPLASM_IMPORT_ENTRY_NUMBER as follows

    a. Created a Map<String, String> and add an entry where:

     i. key → germplasmListId (from list external reference)
     ii. value → import entry number
    

    b. Set the map in the additionalInfo of the germplasm with a key of listEntryNumbers

  5. Updated BrAPIGermplasmService#processData

    a. Method now accepts an argument of UUID germplasmListId
    b. updated the logic to set the entry number to either look in the map of import entry numbers for the specific germplasmListId or, for germplasm already created in the old format, look in additionalInfo.importEntryNumber

  6. Updated the sorting of germplasm in BrAPIGermplasmService#exportGermplasmList to fetch the entry number for the list name that’s either within the map of list entry numbers or stored in additionalInfo.importEntryNumber.

  7. Updated GermplasmProcessor#process to get the ID for the import list and pass it to Germplasm#constructBrAPIGermplasm.

Dependencies

biweb develop branch

Testing

  1. Import germplasm with user-supplied entry numbers.

  2. Go to the Germpasm Lists tab and use the dev tools console to inspect the list object in the response and verify there is an external reference entry for /lists and note the UUID stored as the refernceID.

  3. Then view all imported germplasm and use the dev tools console to inspect the germplasm objects in the response from bi-api. Verify the additionalInfo field "listEntryNumbers" exists and the value is a Map with the imported list ID from step 2 as the key and entry number as value.

  4. Import germplasm without user-supplied entry numbers and repeat process above.

  5. Download the imported germplasm and verify the exported file records match what is stored.

  6. Download a list of previously imported germplasm that store entry number values in additionalInfo.imortEntryNumber and verify the exported file records match what is stored.

Checklist:

  • I have performed a self-review of my own code
  • I have tested my code and ensured it meets the acceptance criteria of the story
  • I have tested that my code works with both the brapi-java-server and BreedBase
  • I have create/modified unit tests to cover this change
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to documentation
  • I have run TAF: #136

@dmeidlin dmeidlin requested review from a team, davedrp and timparsons and removed request for a team November 23, 2022 02:03
@dmeidlin dmeidlin marked this pull request as ready for review November 23, 2022 02:03
Copy link
Member

@timparsons timparsons left a comment

Choose a reason for hiding this comment

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

When testing, the display of the list entry number did not show on the List Detail page (it did show correctly in the downloaded file, though)
Screen Shot 2022-12-13 at 5 56 58 PM

Comment on lines +228 to +240
private boolean hasListExternalReference(BrAPIListDetails listData) {
return listData.getExternalReferences().stream()
.anyMatch(e -> referenceSource.concat("/lists").equals(e.getReferenceSource()));
}

private boolean hasListExternalReference(BrAPIListNewRequest importList) {
return importList.getExternalReferences().stream()
.anyMatch(e -> referenceSource.concat("/lists").equals(e.getReferenceSource()));
}
Copy link
Member

Choose a reason for hiding this comment

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

I think you could consolidate these methods together to accept List<ExternalReference> as a parameter (just check that the list isn't null before streaming over it)

Copy link
Member

@timparsons timparsons left a comment

Choose a reason for hiding this comment

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

Looks good!

@dmeidlin dmeidlin merged commit ed86f5e into develop Feb 9, 2023
@dmeidlin dmeidlin deleted the feature/BI-1606 branch February 9, 2023 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants