-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BI-2308 - Field Book BrAPI Integration - Importing Fields #402
Conversation
src/main/java/org/breedinginsight/brapi/v2/BrAPIGermplasmController.java
Outdated
Show resolved
Hide resolved
// convert dbIds to DeltaBreed UUID | ||
BrAPIGermplasmListResponse response = brapiGermplasm.getBody().getLeft().get(); | ||
List<BrAPIGermplasm> germplasm = response.getResult().getData(); | ||
germplasm.forEach(g -> setDbIdsAndStripProgramKeys(g, programKey)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
germplasm.forEach(g -> setDbIdsAndStripProgramKeys(g, programKey)); | |
batchProcessGermplasm(germplasm, programKey); |
src/main/java/org/breedinginsight/brapi/v2/BrAPIGermplasmController.java
Outdated
Show resolved
Hide resolved
/** | ||
* \s*: Matches zero or more whitespace characters before the opening bracket. | ||
* \[: Matches the opening square bracket [. The backslash is used to escape the special meaning of [ in regex. | ||
* .*?: Matches any character (except newline) zero or more times, non-greedily. | ||
* . matches any character except newline. | ||
* * means "zero or more times". | ||
* ? makes the matching non-greedy, so it stops at the first closing bracket. | ||
* \]: Matches the closing square bracket ]. Again, the backslash is used to escape it. | ||
* \s*: Matches zero or more whitespace characters after the closing bracket. | ||
* @param original | ||
* @param programKey | ||
* @return | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests for this method covering these cases with specific assertions for the expected format of synonyms and pedigree strings aster stripping would be helpful when testing for regressions later. New edge cases found could be added along with tests for very large fields or complex pedigrees.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created card BI-2325
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setDbIdsAndStripProgramKeys method in BrAPIGermplasmController.java processes each germplasm item individually. For large datasets, this could potentially impact performance. I've added a method for processing a germplasm batch that only compiles the regex once and uses parallel streams if possible.
For clarity, I extracted the logic for replacing delta ids with dbIds into a private method to keep the body of the controller method lean.
I also think unit tests for removeProgramKeyAndUnknownAdditionalData
are a good idea, but probably exceeds the effort level estimate for this card, but adding it to the card that checks for regressions in other places this method is used should include writing the tests.
[BI-2317] System Admin Must Retain Full Read Access To All Programs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested locally with Field Book version 5.6.24.
The first test passed, I was able to load fields at around 1000 germplasm/minute which seems fast enough for now.
The second test is less clear to me, I'm not sure where I'm meant to see synonym or pedigree info, but I didn't see any. The germplasm names in the collect screen didn't have the program key which is good.
Also, using wireshark, I see there was one request made from bi-api to brapi-server to the /brapi/v2/search/germplasm POST endpoint with an external reference and a list of germplasmDbIds. A get is then made for the search results (/brapi/v2/search/germplasm/{searchResultDbId}) but what's odd is the results are not ready when this request is made, and the client (bi-api) never seems to make a subsequent request, so I'm not sure what's happening there.
src/main/java/org/breedinginsight/brapi/v2/BrAPIGermplasmController.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just re-submitting initial request
If you included synonyms and pedigree information in the germplasm you should be able to tap the attributes on the collect page to open a dialog to increase the number of attributes shown and select the attributes you would like displayed. Synonyms and pedigree should be selectable options in the list.
From what I was seeing the BrAPI server will give an immediate response if the number of dbIds being searched is below a certain threshold then switch to the searchResultDbId after that point. Field Book should make requests until it gets the result data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the Field Book bug (I see your issue), this is working as expected.
Description
Story: BI-2308
removeProgramKeyAndUnknownAdditionalData
as regex seemed incorrect and was removing until the second ] and resulting pedigree string was incorrect. The method is used a bunch if different places so should make sure there aren't regressions. Not sure if issues have been noticed in the past?Dependencies
Testing
GIVEN have selected a field on the FieldBook Fields page to import
WHEN field is import is started
THEN field should successfully load in a time proportional to the amount of data, not hang indefinitely, and not get an error message
GIVEN have imported a Field with germplasm containing synonyms and pedigree
WHEN the attributes are viewed on the collect page
THEN should see synonyms and pedigree string with program keys & accession numbers stripped out
Checklist: