Skip to content

BI-1855 - Create germplasm list not working#281

Merged
nickpalladino merged 15 commits intorelease/0.8from
bug/BI-1855-tep46
Aug 18, 2023
Merged

BI-1855 - Create germplasm list not working#281
nickpalladino merged 15 commits intorelease/0.8from
bug/BI-1855-tep46

Conversation

@nickpalladino
Copy link
Member

@nickpalladino nickpalladino commented Aug 8, 2023

Description

Story: BI-1855

  • Germplasm update logic changed:
  • Allow empty pedigree values to enable creating a new germplasm list without requiring the original pedigree values
  • Only require parent gids to be entered when updating a germplasm pedigree rather than gid and entry number
  • Various bug fixes found when testing against Breedbase

Dependencies

  • release/0.8 bi-web

Testing

  • Test different combinations of updating pedigrees, synonyms, and not allowed pedigree changes
  • Test files used in development, number indicates order ascending: 1855-tep46-np398.zip

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: <please include a link to TAF run>

@github-actions github-actions bot added the bug Something isn't working label Aug 8, 2023
@nickpalladino nickpalladino changed the title BI-1855 2 BI-1855 - Create germplasm list not working Aug 8, 2023
Copy link
Contributor

@mlm483 mlm483 left a comment

Choose a reason for hiding this comment

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

Getting a NullPointerException. To reproduce, try to upload the attached germplasm file. It works on develop but on bug/BI-1855-tep46 I get a NullPointerException during the "Upload and Validate" process.

100 Germplasm.xlsx

@davedrp
Copy link
Contributor

davedrp commented Aug 15, 2023

Passed Developer testing!

senario 1: has existing pedigree and file pedigree is different and not empty.
result: showed error.
PASSED

senario 2: no existing pedigree and file different pedigree.
result: no error.
PASSED

senario 3: existing pedigree and file pedigree samee.
result: no error.
PASSED

senario 4: existing pedigree and file pedigree empty.
result: no error.
PASSED

Copy link
Contributor

@davedrp davedrp left a comment

Choose a reason for hiding this comment

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

The code and logic seem great to me. I left some comments on minor cosmetic changes.

@nickpalladino
Copy link
Member Author

Getting a NullPointerException. To reproduce, try to upload the attached germplasm file. It works on develop but on bug/BI-1855-tep46 I get a NullPointerException during the "Upload and Validate" process.

100 Germplasm.xlsx

Pushed a fix for this

@mlm483 mlm483 self-requested a review August 16, 2023 14:02
@nickpalladino nickpalladino requested a review from davedrp August 16, 2023 14:06
Copy link
Contributor

@mlm483 mlm483 left a comment

Choose a reason for hiding this comment

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

Thanks for the test files, super helpful!


The file 3_new list-wrongped - fail.xls is expected to produce an error, but I noticed it says "See details below" when there are no details to be seen below. Possibly out of scope, but I recommend either (1) providing details in this error case or (2) if it's truly exceptional, removing "See details below". Could make a new story.

image

FWIW I'm seeing "The following parental GIDs were not found in the database: 5, 6, 7, 8." being sent from the server, so it might be as simple as showing that message on the frontend.


Here's the story I created to refactor processGermplasmForDisplay, BI-1881.


Assuming the missingParentalDbIds and missingDbIds business is sorted out and you feel good about it, I'm OK to merge.

Comment on lines +243 to +247
// TODO: hack for now, probably should update breedbase
// Breedbase will return NA/NA for no pedigree or NA/father, mother/NA
// strip NAs before saving RAW_PEDIGREE, if there was a germplasm with name NA it would be in format NA [program key]
// so that case should be ok if we just strip NA/NA, NA/, or /NA<\0>
private String processBreedbasePedigree(String pedigree) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a story for the change to BreedBase? I think that story should have removing this code as part of it's acceptance criteria. You could also potentially link to that story in the TODO comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

I created a story BI-1883 and updated the comment.

Comment on lines +191 to +192
String pedigree = processBreedbasePedigree(germplasm.getPedigree());
additionalInfo.addProperty(BrAPIAdditionalInfoFields.GERMPLASM_RAW_PEDIGREE, pedigree);
Copy link
Contributor

Choose a reason for hiding this comment

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

Will we want to clean this up eventually once BreedBase is handling pedigree correctly?
Just want to make sure we're documenting future work with Jira stories and TODOs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a comment

Comment on lines +144 to +145
List<String> missingParentalDbIds = germplasmDBIDs.entrySet().stream().filter(Map.Entry::getValue).map(Map.Entry::getKey).collect(Collectors.toList());
List<String> missingDbIds = germplasmDBIDs.entrySet().stream().filter(Map.Entry::getValue).map(Map.Entry::getKey).collect(Collectors.toList());
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that missingParentalDbIds and missingDbIds contain the same values, the way they are used doesn't make sense. See my comment below.

Copy link
Member Author

Choose a reason for hiding this comment

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

I looked into this more and did some testing. I ended up changing List<String> missingDbIds = germplasmDBIDs.entrySet().stream().filter(Map.Entry::getValue).map(Map.Entry::getKey).collect(Collectors.toList()); to List<String> missingDbIds = germplasmDBIDs.entrySet().stream().filter(entry -> !entry.getValue()).map(Map.Entry::getKey).collect(Collectors.toList());. The map is setup with values of true for parent gids and false for update gids. So now these lists are filtered appropriately from the map and will have different values.

Comment on lines +200 to +203
//GID existence check
if (missingDbIds.size() > 0) {
throw new HttpStatusException(HttpStatus.UNPROCESSABLE_ENTITY,
String.format(missingDbIdsMsg,
Copy link
Contributor

Choose a reason for hiding this comment

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

This code will never be reached because if missingDbIds.size() > 0, missingParentalDbIds.size() > 0 as well, because they have the same values and are mutated in the same ways, so the exception will always be thrown above for missingParentalDbIds.

Copy link
Member Author

Choose a reason for hiding this comment

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

With the change that has been made this has been resolved.

@nickpalladino
Copy link
Member Author

nickpalladino commented Aug 17, 2023

Thanks for the test files, super helpful!

The file 3_new list-wrongped - fail.xls is expected to produce an error, but I noticed it says "See details below" when there are no details to be seen below. Possibly out of scope, but I recommend either (1) providing details in this error case or (2) if it's truly exceptional, removing "See details below". Could make a new story.

image

FWIW I'm seeing "The following parental GIDs were not found in the database: 5, 6, 7, 8." being sent from the server, so it might be as simple as showing that message on the frontend.

Here's the story I created to refactor processGermplasmForDisplay, BI-1881.

Assuming the missingParentalDbIds and missingDbIds business is sorted out and you feel good about it, I'm OK to merge.

The notification message displays on release/0.8 as it is sent from bi-api so I think we can hold off on this until things are merged into develop and have a new card to address it at that point. Created a card: BI-1882

@nickpalladino nickpalladino merged commit 93cfd44 into release/0.8 Aug 18, 2023
@nickpalladino nickpalladino deleted the bug/BI-1855-tep46 branch August 18, 2023 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants