Scope cage lookups to the EHR study container in housing tables - #734
Merged
labkey-martyp merged 3 commits intoJul 29, 2026
Conversation
ehr_lookups.cage is unique on (Container, Location), so the unscoped subqueries behind the housing room and daysInRoom columns returned one row per EHR folder and failed on any server hosting more than one.
Skipping the room and daysInRoom columns broke study.demographicsCurLocation and ehr_lookups.roomUtilization, which both reference them; DefaultEHRCustomizer already defaults to the current container in this case.
labkey-bpatel
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
Scope the housing cage lookups to a single container so housing grids, and the queries built on them, keep working on a server with more than one EHR folder. The cage lookup is keyed by container and location together, but the room and days-in-room columns matched on location alone, so a second EHR folder defining the same cage location makes those subqueries match more than one row and the query returns a database error instead of results. Production installations run a single EHR folder per server, so the effect is limited to test and development environments where several EHR folders coexist.
Related Pull Requests
26.7_fb_cage_container_scope— the identical fix in the NBRI customizer.Changes