BI-1881 - Store Parent UUIDs in Germplasm AdditionalInfo#290
Conversation
e7a2a8c to
0ec6b35
Compare
nickpalladino
left a comment
There was a problem hiding this comment.
Can we remove these lines from BrAPIGermplasmDAO?
no longer need to pass all germplasm in program to processGermplasmForDisplay
Yes, thank you for catching this! I removed that and tested against BJTS and BreedBase. |
made it consistent with how it was before changed for BI-1855
timparsons
left a comment
There was a problem hiding this comment.
Looks good overall, just some small changes
| if(germplasm.getAdditionalInfo() != null && germplasm.getAdditionalInfo().has(GERMPLASM_RAW_PEDIGREE) | ||
| && !(germplasm.getAdditionalInfo().get(GERMPLASM_RAW_PEDIGREE).isJsonNull())) { | ||
| germplasm.setPedigree(germplasm.getAdditionalInfo().get(GERMPLASM_RAW_PEDIGREE).getAsString()); |
There was a problem hiding this comment.
This is a personal preference, but I prefer to see BrAPIAdditionalInfoFields.<constant> as it tells me when I'm reading the code where the constant is located. If I see a constant as you've changed it to, I'm expecting that constant to be defined in this class.
There was a problem hiding this comment.
I changed it back. I could go either way, do we have a convention on this?
There was a problem hiding this comment.
No, but worth discussing as a group!
| uuidPedigreeString = additionalInfo.has(GERMPLASM_FEMALE_PARENT_UUID) ? additionalInfo.get(GERMPLASM_FEMALE_PARENT_UUID).getAsString() : ""; | ||
| // Throw a descriptive error if femaleParentUUID is absent. | ||
| if (!additionalInfo.has(GERMPLASM_FEMALE_PARENT_UUID)) { | ||
| log.debug("The germplasm data in your backing BrAPI service needs to be updated: https://github.com/Breeding-Insight/bi-api/pull/290"); |
There was a problem hiding this comment.
It will be more helpful to have the log message reference the program in error instead of "your"
| uuidPedigreeString += "/" + (additionalInfo.has(GERMPLASM_MALE_PARENT_UUID) ? additionalInfo.get(GERMPLASM_MALE_PARENT_UUID).getAsString() : ""); | ||
| // Throw a descriptive error if maleParentUUID is absent. | ||
| if (!additionalInfo.has(GERMPLASM_MALE_PARENT_UUID)) { | ||
| log.debug("The germplasm data in your backing BrAPI service needs to be updated: https://github.com/Breeding-Insight/bi-api/pull/290"); |
There was a problem hiding this comment.
Same as the above review comment
qualified constants, improved log messages
Description
Story: https://breedinginsight.atlassian.net/browse/BI-1881
Previously,
BrAPIGermplasmDAO::processGermplasmForDisplayrequired parentBrAPIGermplasmobjects to be available in order to add thepedigreeByUUIDandpedigreeByNamekeys toadditionalInfoon eachBrAPIGermplasm. This required some hacks, passing all germplasm in the program for example.To make the code more efficient and avoid having to pass all program germplasm into
processGermplasmForDisplay, I made changes toBrAPIGermplasminadditionalInfoon create,processGermplasmForDisplayto build the required pedigree string ("/"),additionalInfo, that's in this PR on breedbase_configs.Dependencies
If you checkout this branch and run it against BJTS or BreedBase with existing germplasm records, it will break. In the case of BJTS, the only option currently is to wipe out the database. For BreedBase, germplasm records can be upgraded in place by running
breedbase-deploy.shfrom thebug/BI-1881-mlm483branch. See this PR for details.Testing
Steps 1-10 focus on BreedBase, step 11 is for BJTS.
germplasm_with_additional_info (click to expand)
developbranch for bothbi-apiandbreedbase_configs.breedbase_deploy.sh) and start up all the services needed for DeltaBreed, then runbi-apiandbi-web.bug/BI-1881-mlm483branch ofbi-api. Oops, start over!bi-apiand checkoutbug/BI-1881-mlm483. If you restart before performing the next step, you'll see some exceptions saying "Germplasm has a female parent but femaleParentUUID is missing.".bug/BI-1881-mlm483branch ofbreedbase_configsand runbreedbase_deploy.sh(without the--reinstallflag). The flyway docker container will be pulled, start up, wait for the breedbase_db container to be healthy and then run the migrations in the ./flyway/sql directory.bi-apiand ensure it runs without the exception and germplasm list, detail and pedigree views work as expected.brapi/v2/germplasmendpoint as well to see that the "femaleParentUUID" and/or "maleParentUUID" fields are present inadditionalInfo.Checklist: