Skip to content

Fix Record Treatment link to pass schedule slot date as scheduledDate - #730

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

Fix Record Treatment link to pass schedule slot date as scheduledDate#730
labkey-martyp merged 3 commits into
release26.7-SNAPSHOTfrom
26.7_fb_treatment_schedule_link

Conversation

@labkey-martyp

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

Copy link
Copy Markdown
Contributor

Rationale

The Record Treatment link on study.treatment_order passed the order's start date as the scheduledDate URL parameter, so every treatment recorded through it carried the same scheduledDate regardless of which schedule slot was being recorded. The second recording against an order then tripped the duplicate-treatment trigger in study/drug.js ("A treatment has already been entered for this order for this date and time.") while the treatmentSchedule grid still showed the slot as unrecorded, since its status join compares the computed slot time against the stored scheduledDate.

Related Pull Requests

Changes

  • Extract the inline Record Treatment display column into TreatmentDisplayColumnFactory with an includeScheduledDate flag; emit scheduledDate only when set, ISO-formatted via DateUtil.formatIsoDateShortTime() instead of Date.toString(); add a null guard on category.
  • The treatment_order Record Treatment link no longer passes scheduledDate; new customizeTreatmentSchedule() adds a treatmentRecord link column to study.treatmentSchedule that passes the slot's date.
  • treatmentSchedule.sql: drop the t1.treatmentRecord passthrough column inherited from treatment_order.
  • treatmentSchedule.query.xml: apply the module customizer via javaCustomizer so the new column is added.

The Record Treatment link on study.treatment_order passed the order's start date as scheduledDate, so every recording against an order got the same value and the second one tripped the duplicate-treatment trigger in study/drug.js while the schedule still showed the slot as unrecorded. The link on treatment_order no longer passes scheduledDate; a new link column on study.treatmentSchedule passes the actual slot date, ISO-formatted, replacing the passthrough column previously inherited from treatment_order. The inline display column is extracted to TreatmentDisplayColumnFactory, which also gains a null guard on category.

Claude-Session: https://claude.ai/code/session_01TPAAEmPYGaFTG31hRvq358
The title sat in the category column, so the lookup rendered uncategorized and titled "value" with no description.
labkey-martyp added a commit to LabKey/nbriEHRModules that referenced this pull request Jul 29, 2026
…#4)

## Rationale

The Record Treatment link on study.treatment_order passed the order's
start date as the scheduledDate URL parameter, so every treatment
recorded through it carried the same scheduledDate regardless of which
schedule slot was being recorded. The second recording against an order
then tripped the duplicate-treatment trigger in study/drug.js ("A
treatment has already been entered for this order for this date and
time.") while the treatmentSchedule grid still showed the slot as
unrecorded, since its status join compares the computed slot time
against the stored scheduledDate.

## Related Pull Requests

- LabKey/johnsHopkinsEHRModules#667 (same fix
for jhu_ehr)
- LabKey/nircEHRModules#730 (same fix for
nirc_ehr)

## Changes

- Extract the inline Record Treatment display column into
TreatmentDisplayColumnFactory with an includeScheduledDate flag; emit
scheduledDate only when set, ISO-formatted via
DateUtil.formatIsoDateShortTime() instead of Date.toString(); add a null
guard on category.
- The treatment_order Record Treatment link no longer passes
scheduledDate; new customizeTreatmentSchedule() adds a treatmentRecord
link column to study.treatmentSchedule that passes the slot's date.
- treatmentSchedule.sql: drop the t1.treatmentRecord passthrough column
inherited from treatment_order.
- treatmentSchedule.query.xml: apply the module customizer via
javaCustomizer so the new column is added.
@labkey-martyp
labkey-martyp merged commit 7fd8527 into release26.7-SNAPSHOT Jul 29, 2026
4 of 5 checks passed
@labkey-martyp
labkey-martyp deleted the 26.7_fb_treatment_schedule_link branch July 29, 2026 04:18
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