Group scheduled observations by order with a new task per group#707
Merged
labkey-martyp merged 4 commits intoJun 18, 2026
Merged
Conversation
When clinical observations are entered from the observation schedule and multiple orders match on category and scheduled date/time, group the resulting clinical_observations entries by their originating order's taskid and assign one task per group. The first order group reuses the form's own task; each additional distinct order group gets a freshly created task cloned from the form task. This means no order's existing schedule task id is reused, while the form task is reused for the first group so it is never left empty. Also add the caseId/problemCategory column to the clinical_observations default view.
Augments testClinicalObservation to assert that observations entered from the schedule for an animal with a single clinical case stay grouped under one task with no empty task left behind. Adds testScheduledObservationTaskGrouping, which creates two concurrent clinical cases for the same animal so each scheduled category matches two orders, then verifies the entries are grouped into two tasks (one per originating order taskid) with two entries per category and no empty task created.
labkey-bpatel
approved these changes
Jun 18, 2026
Provision the dedicated task-grouping test animal (alive demographics, current housing, active assignment) in createTestSubjects so the clinical case form raises no unknown-animal warnings that would keep the validation banner from clearing and time out the submit. Acknowledge the 'Similar Case Exists' confirmation when finalizing the second case for the same animal and problem area; createClinicalCase now takes the expected finalize-confirmation window title rather than always assuming 'Finalize'. Query the EHR study folder explicitly (ContainerFilter.Current against getContainerPath) in the observation/task verification helpers, since the study datasets and ehr.tasks are defined there rather than in the project root targeted by the default selectRows overload.
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
When a clinical observation is entered from the observation schedule and multiple orders match on category and scheduled date/time, an entry is created in clinical_observations for each matching order. Previously the duplicate entries reused the originating order's existing schedule task id, so the entered observations were tied back to the schedule order tasks instead of a task representing the recording session. This change groups the entries by their originating order's taskid and assigns one task per group.
Related Pull Requests
Changes