Skip to content

Scope cage lookups to the EHR study container in housing tables - #9

Merged
labkey-martyp merged 3 commits into
release26.7-SNAPSHOTfrom
26.7_fb_cage_container_scope
Jul 29, 2026
Merged

Scope cage lookups to the EHR study container in housing tables#9
labkey-martyp merged 3 commits into
release26.7-SNAPSHOTfrom
26.7_fb_cage_container_scope

Conversation

@labkey-martyp

@labkey-martyp labkey-martyp commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

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

  • LabKey/nircEHRModules, branch 26.7_fb_cage_container_scope — the identical fix in the NIRC customizer.

Changes

  • Scope every cage lookup behind the housing room and days-in-room columns to a single container, preferring the EHR study container and falling back to the current one when it is not configured.
  • Fix a null dereference that could occur while building the room sort field.

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-martyp
labkey-martyp merged commit 1b8b14f into release26.7-SNAPSHOT Jul 29, 2026
1 check passed
@labkey-martyp
labkey-martyp deleted the 26.7_fb_cage_container_scope branch July 29, 2026 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants