Skip to content

Radiology - Ability to write 'final report'#7967

Merged
szaccagni merged 4 commits into
developfrom
szaccagni/otr-1924-radiology-ability-to-write-final-report-in-ottehr
Jun 9, 2026
Merged

Radiology - Ability to write 'final report'#7967
szaccagni merged 4 commits into
developfrom
szaccagni/otr-1924-radiology-ability-to-write-final-report-in-ottehr

Conversation

@szaccagni

Copy link
Copy Markdown
Contributor

Copilot AI 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.

Pull request overview

Adds support for saving a final radiology report directly from the EHR (instead of always sending to teleradiology), and refactors shared radiology Task/resource parsing logic to be reused across zambdas.

Changes:

  • Introduces a new radiology-save-final-report zambda that patches the related DiagnosticReport to final and creates a completed “Review Radiology Final Results” Task.
  • Refactors PACS webhook + order list logic to reuse shared radiology helpers (resource parsing, “most recent report”, Task config).
  • Updates EHR UI/hooks/API/types to support saving either a preliminary or final report and to display “reviewed” status/history.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/zambdas/src/ehr/radiology/shared/index.ts New shared helpers for resource parsing/validation and for configuring the radiology “review final result” Task.
packages/zambdas/src/ehr/radiology/save-preliminary-report/validation.ts Renames request body type/field to the new generic SaveRadiologyReportZambdaInput + report.
packages/zambdas/src/ehr/radiology/save-preliminary-report/index.ts Updates preliminary-report zambda to consume report and return renamed output type.
packages/zambdas/src/ehr/radiology/save-final-report/validation.ts New validation for the final-report zambda.
packages/zambdas/src/ehr/radiology/save-final-report/index.ts New final-report zambda: fetches related DR, writes final HTML report, marks DR final, creates completed review Task.
packages/zambdas/src/ehr/radiology/pacs-webhook/index.ts Uses new shared helpers and shared Task config when PACS DR transitions to final.
packages/zambdas/src/ehr/radiology/order-list/index.ts Uses shared “most recent report” helper; adjusts provider name formatting; adds reviewed history row.
packages/utils/lib/types/api/radiology/index.ts Renames preliminary-report types to generic radiology report types (SaveRadiologyReport*).
config/oystehr-core/zambdas.json Registers new radiology-save-final-report zambda.
apps/ehr/src/features/radiology/pages/RadiologyOrderDetails.tsx UI toggle + textbox to author final report locally and save it as final instead of sending to telerad.
apps/ehr/src/features/radiology/components/usePatientRadiologyOrders.ts Consolidates “save report” handling for preliminary/final and wires to new API.
apps/ehr/src/api/api.ts Adds saveFinalReport client call; updates preliminary report call to new type names.
.vscode/custom-dictionaries/medical-terms.txt Adds “teleradiology” to custom dictionary.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/zambdas/src/ehr/radiology/save-final-report/validation.ts
Comment thread packages/zambdas/src/ehr/radiology/save-final-report/index.ts
Comment thread packages/zambdas/src/ehr/radiology/shared/index.ts
Comment on lines +427 to +435
if (finalReviewTask && finalReviewTask.status === 'completed') {
const date =
finalReviewTask.owner?.extension?.find((ext) => ext.url === TASK_ASSIGNED_DATE_TIME_EXTENSION_URL)
?.valueDateTime ?? '';
history.push({
status: RadiologyOrderStatus.reviewed,
performer: finalReviewTask.owner?.display ?? '',
date,
});

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.

This is a valid flag - unfortunately, it looks like we aren't time stamping when the "completed" action is taken. When Complete is clicked from DetailTaskCard the task status is updated and thats all. I think using this date is okay as its the best we can get. When the user enters the final report this task is created as completed and in those instances the assignment date time will accurately reflect the completed date time.

Comment thread apps/ehr/src/features/radiology/pages/RadiologyOrderDetails.tsx
@szaccagni szaccagni requested a review from alexwillingham June 5, 2026 18:40

@alexwillingham alexwillingham 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.

What happens if a final report magically comes back from AdvaPACS after a final report was written in the EHR? Is it buried or does it replace the final report that was written in the EHR? Or something worse 😅 ?

setFinalReportByUser(!finalReportByUser);
}}
/>
<Typography>Don't send to teleradiology, I will write the final report myself</Typography>

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.

Suggested change
<Typography>Don't send to teleradiology, I will write the final report myself</Typography>
<Typography>Don't send to teleradiology, I will write the final report myself.</Typography>

@szaccagni

Copy link
Copy Markdown
Contributor Author

What happens if a final report magically comes back from AdvaPACS after a final report was written in the EHR? Is it buried or does it replace the final report that was written in the EHR? Or something worse 😅 ?

As long as the report that comes back is able to be matched to the diagnostic report, it will overwrite the final report. I see no reason it would not be matched since the logic for adding the advapacs id hasn't changed.

What is not so great about this, is that the order history won't reflect this change. No additional final review task gets created either so I'm not sure how anyone would know about it.

  1. We can fix the history issue by adding an extension to the diagnostic report anytime a final report comes in when the status is already final and then have the order history look for it.
  2. We could also update the logic for creating the final review task. Right now we only create it when the status is changing to final - it could just create anytime its final (not sure if this is overkill though).

@alexwillingham

Copy link
Copy Markdown
Contributor

It shouldn't happen so I'm not worried about it. And overwriting is probably the best outcome if it does happen.

@szaccagni szaccagni merged commit 43d33c7 into develop Jun 9, 2026
15 checks passed
@szaccagni szaccagni deleted the szaccagni/otr-1924-radiology-ability-to-write-final-report-in-ottehr branch June 9, 2026 00: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.

3 participants