Skip to content

[BI-2778] Deprecate additionalinfo usage for level and use obs unit lvl#500

Open
HMS17 wants to merge 11 commits intodevelopfrom
feature/BI-2778
Open

[BI-2778] Deprecate additionalinfo usage for level and use obs unit lvl#500
HMS17 wants to merge 11 commits intodevelopfrom
feature/BI-2778

Conversation

@HMS17
Copy link
Contributor

@HMS17 HMS17 commented Mar 6, 2026

Description

Story: BI-2778 - Deprecate additionalinfo usage for level and use obs unit level

Removed calls to set observation level info in additionalInfo and replaced calls to get observation level info from additionalInfo with calls to the observation level associated with the observation object.

This should not be merged until after the migration of BI-2779 is merged.

Dependencies

bi-web: feature/BI-2778 (old)
bi-web: feature/BI-2778 (new)

Testing

Test areas related to experiments to ensure nothing is broken:

-- Upload experiment
-- Create sub entity dataset
-- View experiment
-- Download top level experiment dataset
-- Download sub entity experiment dataset
-- Download case mentioned in comments of 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 create/modified unit and/or integration tests to cover this change or tests are not applicable
  • I have commented my code, particularly in hard-to-understand areas
  • I have either updated the source of truth or arranged for update with product owner if needed https://breedinginsight.atlassian.net/wiki/spaces/BI/pages/1559953409/Source+of+Truth

@HMS17 HMS17 marked this pull request as ready for review March 9, 2026 23:08
@HMS17 HMS17 requested review from a team, davedrp and jloux-brapi and removed request for a team and davedrp March 9, 2026 23:08
if (isSubEntityDataset(ous)) {
Comparator<BrAPIObservationUnit> subUnitComparator = Comparator.comparing(BrAPIObservationUnit::getObservationUnitName, new IntOrderComparator());
Comparator<BrAPIObservationUnit> ouNameComparator = Comparator.comparing(row -> (row.getAdditionalInfo().get(BrAPIAdditionalInfoFields.EXP_UNIT_ID).toString()), new IntOrderComparator());
Comparator<BrAPIObservationUnit> ouNameComparator = Comparator.comparing(row -> (getTopLevel(row).getLevelName()), new IntOrderComparator());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it ok to swap the logic for exp unit id with level name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not think so, EXP_UNIT and EXP_UNIT_ID are two separate values. For the sort, we want to know the top level dataset observation unit associated with the sub entity unit, not just the level name.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then I'm confused, why is this comparing level name then instead of exp_unit_id. And if it is comparing level name, why is it using an IntOrderComparator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I don't know why for some reason I interpreted this as you suggesting a change rather than pointing out my change was invalid. Good catch, I'll fix that.

row.put(topLvlName + " " + OBSERVATION_UNIT_ID_SUFFIX, topLvlOuId);
}
row.put(ExperimentObservation.Columns.EXP_UNIT_ID, ou.getAdditionalInfo().get(BrAPIAdditionalInfoFields.EXP_UNIT_ID).getAsString());
row.put(ExperimentObservation.Columns.EXP_UNIT_ID, StringUtils.capitalize(getTopLevel(ou).getLevelName()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it ok to swap the logic for exp unit id with level name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For EXP_UNIT column in a row we want level name. EXP_UNIT_ID column meanwhile is the id of the specific observation unit from the top level dataset.

Copy link
Collaborator

Choose a reason for hiding this comment

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

RIght, but this new commit is putting the level name in the exp unit id column is it not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I misinterpreted, yeah good catch this is incorrect.

@HMS17 HMS17 requested a review from jloux-brapi March 10, 2026 19:27
Copy link
Collaborator

@jloux-brapi jloux-brapi left a comment

Choose a reason for hiding this comment

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

Definitely some things going wrong with the testing, not quite sure what.

The changes I suggested seemed to introduce an NPE, when I reverted that, I am still noticing some issues with the UI I have never seen before.

For example, the sub entity data Obs Unit Id column says Undefined Obs Unit Id where it should say the level name.

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.

2 participants