Skip to content

Add shared project and protocol at time lookup columns - #1248

Merged
labkey-martyp merged 2 commits into
release26.7-SNAPSHOTfrom
26.7_fb_assignment_at_time
Nov 22, 2026
Merged

labkey-martyp merged 2 commits into
release26.7-SNAPSHOTfrom
26.7_fb_assignment_at_time

Conversation

@labkey-martyp

@labkey-martyp labkey-martyp commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Rationale

Gives EHR center modules a shared way to show which projects and protocols an animal was assigned to on each dataset record's date, alongside the existing Housing At Time column. Protocol comes from the protocol assignment dataset rather than the project's protocol, so it suits centers that assign the two independently. Each center opts in from its own table customizer, so modules that don't call it are unaffected.

Related Pull Requests

None.

Changes

  • New Project At Time and Protocol At Time columns that look up ehr.project and ehr.protocol and can hold several values per record.
  • Assignments match by full timestamp with an exclusive end date, like Housing At Time, so a record on a transfer day shows whichever assignment was active at that moment.

Multi-valued lookups to the projects and protocols an animal held on each record's date, added by the center customizers that opt in.
Also resolves values through each target's title column, skips the source dataset itself, and lists study tables once per dataset.

@labkey-bpatel labkey-bpatel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved, but please review my comment on the intended behavior.

public TableInfo getLookupTableInfo()
{
QueryDefinition qd = QueryService.get().createQueryDef(targetSchema.getUser(), targetSchema.getContainer(), targetSchema, queryName + "_" + name);
// Full timestamps with an exclusive end, like housingAtTime; AssignmentAtTimeForeignKey matches by date instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the end date intended to be exclusive or inclusive? The PR's Changes section says, "Assignments match by date with the end date inclusive, so a transfer day shows both the old and new values." Depending on the intended behavior, may need to update the SQL below or clarify the PR description.

@labkey-martyp labkey-martyp left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the PR description. The comment and code were the correct behavior.

@labkey-martyp
labkey-martyp merged commit 321d4c8 into release26.7-SNAPSHOT Nov 22, 2026
9 checks passed
@labkey-martyp
labkey-martyp deleted the 26.7_fb_assignment_at_time branch November 22, 2026 21:41
labkey-martyp added a commit to LabKey/nbriEHRModules that referenced this pull request Nov 23, 2026
## Rationale

Shows the projects and protocols an animal was assigned to on each
dataset record's date, alongside Housing At Time.

## Related Pull Requests

-
[LabKey/ehrModules#1248](LabKey/ehrModules#1248)
(shared columns; merge together)

## Changes

- Every dataset except demographics gets Project At Time and Protocol At
Time, each value linking to its project or protocol details.
- New test covering a move between projects and protocols, including the
transfer day.

Tested locally: the new test passes, every weight and daily health log
row matched values computed from the assignment data, and the columns
display, link, and filter correctly in the grid.
labkey-martyp added a commit to LabKey/nircEHRModules that referenced this pull request Nov 23, 2026
## Rationale

Shows the projects and protocols an animal was assigned to on each
dataset record's date, alongside Housing At Time.

## Related Pull Requests

-
[LabKey/ehrModules#1248](LabKey/ehrModules#1248)
(shared columns; merge together)

## Changes

- Every dataset except demographics gets Project At Time and Protocol At
Time, each value linking to its project or protocol details.
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