Shared Surfaces
Each surface that embeds CriticalNotificationButton — trigger condition, always_notify enforcement, onSuccess contract, and file map.
Shared Surfaces
CriticalNotificationButton is a single reusable component embedded on every surface where a critical report can appear. Each surface is responsible only for deciding when to show the button and what to do on success — all modal logic lives inside the button and modal themselves.
How the button works
On mount, the button auto-shows a tooltip for 3 seconds: "This report contains critical values. Notify these critical results to physicians, providers, or other recipients." This is suppressed with ignoreTooltip: true on surfaces where it would be disruptive (e.g. the worklist grid).
Entry points
1. ReportEntryFooter — Lab login report entry
File: reusable/Modals/Report/ReportEntryFooter.tsx
The button appears in the footer of the lab report entry form.
Visibility condition:
completedTests === 1 AND criticalValues ∈ CRITICAL_CALLOUT_VALUESalways_notify enforcement: Yes. When always_notify is on, clicking Save and Sign intercepts the action. The component calls getCriticalNotificationLogsData(labReportId) — if no existing logs are found, it sets isCriticalNotificationModalOpen = true and holds the save. Once the user completes the callout (onNotify fires), saveReportValues and redirectReport are called.
onSuccess: Not used here (Pushers update data on screen) — sign flow is handled via onNotify.
2. DoctorFooter — Doctor login report view
File: reusable/Modals/Report/DoctorFooter.tsx
The button appears in the footer of the report view panel on the doctor login.
Visibility condition:
completedTests === 1 AND criticalValues ∈ CRITICAL_CALLOUT_VALUESalways_notify enforcement: Yes. The intercepted buttons are Approve and Approve and Submit. If all conditions are met and no existing logs exist, the modal opens programmatically. Once onNotify fires, the original button operation (handleClick(buttonOperations)) is executed.
onSuccess: Not used (Pushers update data on screen) — approve flow is handled via onNotify.
3. TestInfoCard — Test Waiting List
File: reusable/TestWaitingList/TestInfoCard.tsx
Button shown on each test card in the waiting list.
Visibility condition: criticalValues ∈ CRITICAL_CALLOUT_VALUES
onSuccess: Updates the report's criticalValues in the parent waiting list state so the badge and button update without a full refresh.
always_notify enforcement: No.
4. ReportTitle — Patient Test List
File: reusable/ParticularPatientsTestList/ReportTitle.tsx
Button shown in the title row of each report in the patient test list.
Visibility condition: criticalValues ∈ CRITICAL_CALLOUT_VALUES
onSuccess: Refreshes the report row's callout status locally.
always_notify enforcement: No.
5. DoctorLogin WaitingList
File: DoctorLogin/WaitingList/index.tsx
Button shown in the doctor's patient waiting list rows.
Visibility condition: criticalValues ∈ CRITICAL_CALLOUT_VALUES
onSuccess: Updates the local criticalValues for the matching report in the list.
always_notify enforcement: No.
6. PatientWiseReportList
File: DoctorLogin/PatientWiseReportList/index.tsx
Button shown in the patient-wise report list under doctor login.
Visibility condition: criticalValues ∈ CRITICAL_CALLOUT_VALUES
onSuccess: Updates report status in local state.
always_notify enforcement: No.
7. PreviewModalFooter — Reports Trends
File: reusable/Modals/ReportsTrends/PreviewModalFooter.tsx
Button shown in the footer of the Reports Trends preview modal.
Visibility condition: criticalValues ∈ CRITICAL_CALLOUT_VALUES
onSuccess: Refreshes the modal's report data.
always_notify enforcement: No.
8. CriticalCalloutWorklist — Operations (new)
File: Operations/CriticalCalloutWorklist/index.tsx
Button rendered in the Action column of the AG Grid. This surface uses the customised label/colour and suppresses the tooltip:
onSuccess: Refreshes the worklist row's callout status and re-evaluates the bill-level billCriticalCallout aggregated value.
always_notify enforcement: No — the worklist is a dedicated callout surface, not a sign/approve flow.
labReportStatusUtils
File: reusable/PatientsWaitingList/labReportStatusUtils.ts
Used by all waiting list surfaces to resolve badge text and determine whether the callout action should be visible, based on the criticalValues integer.
Updated in this feature to recognise CALLOUT_ATTEMPTED = 4:
criticalValues | Badge text | Action visible |
|---|---|---|
| 1 | Callout Pending | Yes |
| 4 | Callout Attempted | Yes |
| 2 | Callout Done | No |
The isCritical() check uses CRITICAL_CALLOUT_VALUES — an array constant ([1, 2, 4]) — to populate the criticalReportList bucket in getStateWiseListFromReportList, which drives the critical badge count shown in waiting list headers.
File map
Modal
| File | Purpose |
|---|---|
CriticalNotification/CriticalNotificationModal.tsx | Container modal with tabs |
CriticalNotification/CriticalCalloutModal.tsx | Action panel |
CriticalNotification/CriticalNotificationBody.tsx | Tab body renderer |
CriticalNotification/CriticalCalloutLogs.tsx | History timeline |
CriticalNotification/CriticalNotificationButton.tsx | Trigger button |
CriticalNotification/interfaces.ts | All TypeScript interfaces |
CriticalNotification/utils.ts | Restore, validate, structure logs, getCriticalValueTag |
CriticalNotification/helpers.tsx | notifyCallout, getCriticalNotificationSettings, getCriticalNotificationLogsData |
Modals/Report/constants.ts | COMMUNICATION_METHODS, CALLOUT_LOG_META_MAPPER |
Modals/Report/styles.module.scss | Modal layout styles |
Worklist module
| File | Purpose |
|---|---|
CriticalCalloutWorklist/index.tsx | Page container |
CriticalCalloutWorklist/constants.ts | Report type strings, debounce |
CriticalCalloutWorklist/utils/helpers.ts | Fetch, grid renderers, export row builder, bill aggregation |
CriticalCalloutWorklist/utils/interface.ts | WorklistTab, GridCalloutStatus, param interfaces |
CriticalCalloutWorklist/utils/exportUtils.js | SheetJS Excel export |
Operations/SideBar/index.tsx | Menu entry |
modules/CrelioDashboard/RoutesAndMenus/operationsRoutesAndMenu.tsx | Route registration |
modules/Operations/routes.tsx | Route definition |
Shared surfaces
| File | Surface |
|---|---|
reusable/Modals/Report/ReportEntryFooter.tsx | Lab login report entry |
reusable/Modals/Report/DoctorFooter.tsx | Doctor login report view |
reusable/Modals/ReportsTrends/PreviewModalFooter.tsx | Reports Trends modal footer |
reusable/TestWaitingList/TestInfoCard.tsx | Test Waiting List card |
reusable/TestWaitingList/ButtonLogic.tsx | Waiting list button routing |
reusable/ParticularPatientsTestList/ReportTitle.tsx | Patient test list title |
reusable/PatientsWaitingList/labReportStatusUtils.ts | Status badge + critical list bucketing |
reusable/Accordion/index.tsx | Per-report accordion inside callout modal |
DoctorLogin/WaitingList/index.tsx | Doctor waiting list |
DoctorLogin/WaitingList/helpers.ts | Doctor waiting list helpers |
DoctorLogin/PatientWiseReportList/index.tsx | Patient-wise report list |
DoctorLogin/SideBar/index.tsx | Doctor sidebar |
Operations/operationsDashboard/utils/interface.ts | Ops dashboard interfaces |
Operations/operationsDashboard/.../CriticalReportsDrillDown.tsx | Critical reports drill-down |
utils/constants.ts | CRITICAL_CALLOUT_PENDING/DONE/ATTEMPTED, CRITICAL_CALLOUT_VALUES |