Skip to content

BI-2053 - Fixed Scale Units Bug#331

Merged
mlm483 merged 4 commits intorelease/0.9from
bug/BI-2053
Mar 5, 2024
Merged

BI-2053 - Fixed Scale Units Bug#331
mlm483 merged 4 commits intorelease/0.9from
bug/BI-2053

Conversation

@mlm483
Copy link
Contributor

@mlm483 mlm483 commented Feb 14, 2024

Description

Story: https://breedinginsight.atlassian.net/browse/BI-2053

What was wrong:

The ScaleEntity class was missing a units field. The BrAPI Scale object has a units field, but our code was not previously using it. We were using scaleName to store units, but only numeric scale classes have units, and scaleName is a required BrAPI field, so we were just filling it with the scale class when units were not present.

What this PR does:

  • Our code now stores scale units in the units field of the BrAPI Scale and bi-api internal ScaleEntity objects.
  • Since scaleName is required, and it doesn't actually exist in our Ontology template, I made the executive decision to set scaleName to units if provided, otherwise it falls back to the scale class (a.k.a. dataType). This logic is in TraitFileParser.java.
  • The flyway (SQL) migration to add the units field to ScaleEntity also updates any existing numeric scales, setting units to the scale_name. I don't think this will do anything in production (we're wiping out brapi-server data), but it might help QA/rel-test go smoother.
  • Per Shawn's guidance, attempting to upload an ontology file with Units specified with non-numeric scale classes now results in the tabular error message in row #5 (as of writing) on this page.
  • Updates integration/unit tests, including test ontology (trait) files. I added a test for the new validation.
  • I made a TAF PR, it is untested, I recommend keeping it open until TAF is in better working order, I don't think it should hold up merging this PR.

Note: if a Trait has the "Computation" method class, the scale class is ignored and overwritten with "Numerical", therefore units are allowed and indeed required. I don't know how well documented this is.

Dependencies

bi-api: bug/BI-2053 branch
bi-web: release/v0.9 branch

Testing

[Developers Only] Because the schema changes, I had to run the following first, then run bi-api.

clean validate flyway:repair flyway:migrate install -D maven.test.skip=true --settings settings.xml
  1. Try uploading AlexC_Active_Ontology_ERROR.xls and confirm you see a tabular error message for the non-numerical rows with units.
  2. Try uploading AlexC_Active_Ontology_SUCCESS.xls and confirm the preview, list view, etc. all look OK.
  3. Download the ontology uploaded in step 2. and confirm that only numerical rows have units.
  4. Try uploading Ont_Comp_SUCCESS.xlsx and ensure that it succeeds and the "text" scale class (2nd row) is overwritten to be "Numerical".

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 Feb 14, 2024
@mlm483 mlm483 changed the title [BI-2053] - fixed scale units bug BI-2053 - Fixed Scale Units Bug Feb 14, 2024
@mlm483 mlm483 marked this pull request as ready for review February 16, 2024 17:09
@mlm483 mlm483 requested review from a team, davedrp and dmeidlin and removed request for a team February 16, 2024 17:11
@nickpalladino nickpalladino requested review from nickpalladino and removed request for dmeidlin February 29, 2024 18:12
@davedrp davedrp assigned davedrp and unassigned dmeidlin Mar 1, 2024
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.

Developer testing passed

Copy link
Member

@nickpalladino nickpalladino left a comment

Choose a reason for hiding this comment

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

Don't remember why units wasn't used previously, maybe Breedbase didn't store them, but wouldn't really matter since stored in bi db.

@mlm483
Copy link
Contributor Author

mlm483 commented Mar 5, 2024

Don't remember why units wasn't used previously, maybe Breedbase didn't store them, but wouldn't really matter since stored in bi db.

I saw that in an older import template version there was a "Scale Name" column, that was dropped at some point and "Units" was added. 🤷

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