Radiology - Ability to write 'final report'#7967
Conversation
There was a problem hiding this comment.
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-reportzambda that patches the relatedDiagnosticReporttofinaland 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.
| 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, | ||
| }); |
There was a problem hiding this comment.
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.
alexwillingham
left a comment
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
| <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> |
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.
|
|
It shouldn't happen so I'm not worried about it. And overwriting is probably the best outcome if it does happen. |
https://linear.app/zapehr/issue/OTR-1924/radiology-ability-to-write-final-report-in-ottehr