Skip to content

[BI-2919]: Study Cache 2 - Untangle bi-generated exRefIds from BrAPI studyDbIds - #549

Open
humsika wants to merge 6 commits into
epic/BI-2862from
feature/BI-2919
Open

[BI-2919]: Study Cache 2 - Untangle bi-generated exRefIds from BrAPI studyDbIds#549
humsika wants to merge 6 commits into
epic/BI-2862from
feature/BI-2919

Conversation

@humsika

@humsika humsika commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

Story: BI-2919

Updates the study-related BI API flows to consistently use the real BrAPI studyDbId instead of the BI-generated ID stored in /studies external references.

This change:

  • Preserves the real BrAPI studyDbId in study, observation unit, and observation API responses.
  • Updates single-study retrieval to search directly by studyDbId.
  • Removes obsolete study lookups that searched through BI-generated study external-reference IDs.
  • Updates observation-unit searches to use the BrAPI studyDbIds search field.
  • Updates observation and dataset filtering to compare real BrAPI studyDbId values.
  • Removes unnecessary study-ID translation from observation tables and observation levels.
  • Removes the import-time assignment that temporarily overwrote observation.studyDbId with studyPIO.getId().
  • Retains study external-reference creation and usages required for pending-import and cache-post correlation.

Dependencies

Testing

Added and updated unit and integration-test coverage to use real BrAPI studyDbId values instead of extracting study IDs from /studies external references.

Unit/integration testing:

  • Added/updated BrAPIStudyDAOUnitTest to verify studies are looked up using the real BrAPI studyDbId.
  • Updated Study controller integration tests to verify the returned studyDbId is the BrAPI ID and is not replaced by the BI /studies external-reference ID.
  • Updated Observation Unit tests to verify filtering uses the real studyDbId.
  • Updated experiment export tests to verify environment-specific exports filter by the real studyDbId.
  • Ran mvn clean install and confirmed all unit and integration tests pass.

Manual testing:

  1. Start bi-api and bi-web, then sign in and open a program containing an existing experiment.

  2. Open the browser developer tools, select the Network tab, and navigate to the Experiments tab.

  3. Find the /studies request and inspect its response.

  • Verify every Study contains a non-empty studyDbId.
  • Verify the returned studyDbId is the real BrAPI Study ID.
  • If the Study has a BI /studies external reference, verify its referenceId is different from the returned studyDbId.
  1. Select an experiment/environment in the UI.
  • Verify the experiment details load without errors.
  • Verify Env, Env Location, and Env Year display correctly.
  1. Inspect the Study-related requests in the Network tab.
  • Verify requests for studies, observation units, observations, observation variables, and observation levels use the real studyDbId.
  • Verify none of these requests uses the BI /studies external-reference ID as the studyDbId.
  1. Filter or open the Observation Units for one environment.
  • Verify only Observation Units belonging to the selected Study are displayed.
  • Verify each returned Observation Unit has the selected real studyDbId.
  1. Open the observations table for the same environment.
  • Verify the table loads successfully.
  • Verify only observations belonging to the selected Study are returned.
  • Verify the request and response use the same real studyDbId.
  1. Download/export one environment.
  • Verify the download completes successfully.
  • Verify the export contains only data for the selected environment.
  • Verify environment name, location, and year remain correctly populated.
  1. Import a new experiment containing at least one environment.
  • Verify the import completes successfully.
  • Verify the new experiment appears on the Experiments tab.
  • Verify no duplicate or missing Study/environment records are created.
  • Inspect /studies and verify the imported Study exposes its real BrAPI studyDbId.
  1. Append data to an existing experiment.
  • Verify the append completes successfully.
  • Verify the appended data remains associated with the correct Study/environment.
  • Verify no duplicate Study or environment is created.

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 created/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

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.

1 participant