Skip to content

BI-1832 - Treatment factors not being stored in BreedBase#272

Merged
nickpalladino merged 5 commits intorelease/0.8from
bug/BI-1832-2
Aug 1, 2023
Merged

BI-1832 - Treatment factors not being stored in BreedBase#272
nickpalladino merged 5 commits intorelease/0.8from
bug/BI-1832-2

Conversation

@nickpalladino
Copy link
Member

@nickpalladino nickpalladino commented Jul 18, 2023

Description

Story: BI-1832

  • Storing treatments properly in Breedbase so that they are in the right spot to be reflected in the Breedbase UI was larger in scope than anticipated for this card so a new card was made to do that BI-1850
  • This card bi-api stores the treatments in additionalInfo and it will be saved in Breedbase through that mechanism and then bi-api populated the treatments property of the observation unit from the additional info data if the treatements property is empty

Dependencies

Testing

  • Import an experiment with treatments specified in the file to programs on the BrAPI test server and Breedbase and ensure the downloaded experiment data contains the specified treatments. An example file is available in the card.

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 Jul 18, 2023
@nickpalladino nickpalladino changed the title BI-1832 BI-1832 - Treatment factors not being stored in BreedBase Jul 18, 2023
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.

Haven't tested it yet, but one small code change

Comment on lines +293 to +295

// Store treatments in additionalinfo as well for temporary BreedBase workaround
observationUnit.putAdditionalInfoItem(BrAPIAdditionalInfoFields.TREATMENTS, List.of(treatment));
Copy link
Member

Choose a reason for hiding this comment

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

This may be better to do in the BrAPIObservationUnitDAO to encapsulate that logic only there.

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved and pushed changes

@timparsons timparsons self-assigned this Jul 19, 2023
@davedrp
Copy link
Contributor

davedrp commented Jul 20, 2023

If a treatment factor is empty when the experiment is imported, "No ManagementFactor" is still being reported in the download file (it should be blank).

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.

Couple small questions


private void processObservationUnits(List<BrAPIObservationUnit> brapiObservationUnits) {

// if has treatments in additionalInfo but not treatments property, copy to treatments property
Copy link
Member

Choose a reason for hiding this comment

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

The code doesn't match this comment fully. Looks like the code checks if there's the treatments property in the additionalInfo, and if so, replace whatever could be in the Treatments field of the OU. Doesn't look like it's checking to see if there is any value in the Treatments field in the OU before calling setTreatments. Is this the desired logic?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated comment to match code, intent is to just overwrite the treatments property if one exists in the additionalInfo

// treatments field
BrAPIObservationUnit ou1 = new BrAPIObservationUnit();
ou1.setObservationUnitName("test1");
ou1.putAdditionalInfoItem(BrAPIAdditionalInfoFields.TREATMENTS, List.of(testTreatment));
Copy link
Member

Choose a reason for hiding this comment

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

Should this test be updated to set the treatments in the Treatments field rather than in the additionalInfo?

Copy link
Member Author

Choose a reason for hiding this comment

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

In this test I wanted to simulate what breedbase would do which would be to only have the treatments in the additionalinfo and not the treatments field.

@nickpalladino
Copy link
Member Author

nickpalladino commented Jul 24, 2023

If a treatment factor is empty when the experiment is imported, "No ManagementFactor" is still being reported in the download file (it should be blank).

This is due to no additionalInfo property entry being saved when a treatment factor is blank in the import file. BreedBase always returns "No ManagementFactor" in the treatments property regardless. I will update the bi-api processing logic to clear the treatments property if there is no treatments additionalInfo property. This won't affect existing BreedBase data because nothing was saved anyways but it would affect data saved to the BrAPI test server as any existing treatments would be cleared out since additionalInfo is missing. Would require a migration of data to work in that case if required. @timparsons Has any treatment data been saved that must be kept or can we just assume having the additionalinfo in there going forward is fine?

Ended up modifying Breedbase to return no treatments rather than "No ManagementFactor" to resolve this

@nickpalladino nickpalladino merged commit b2d016b into release/0.8 Aug 1, 2023
@nickpalladino nickpalladino deleted the bug/BI-1832-2 branch August 1, 2023 19:28
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.

3 participants