Overview
Frontend implementation of Sample Rerun across livehealth-frontend and interfacing — component architecture, shared surfaces, and constants.
Sample Rerun — Frontend
All sample rerun UI lives across two apps: livehealth-frontend (React — report modal, rerun components, LabAdmin configuration) and interfacing (Electron — device waiting list badges, value display). The feature integrates into report entry, waiting lists, the operations sidebar, device results validation, and lab admin test configuration.
What this section covers
| Page | Covers |
|---|---|
| Components | Component tree, props interfaces, helper functions, LabAdmin configuration UI, interfacing renderer components |
Architecture
Component summary
| Component | Location | Role |
|---|---|---|
RerunProgressComponent | src/components/reusable/Modals/Report/ | Banner shown on reports with active reruns — status message + action buttons |
SampleRerunModal | src/components/reusable/Modals/Report/SampleRerun/ | Two-tab modal — Initiate (parameter selection) and Review (value comparison) |
InitiateSampleRerun | Same directory | AgGrid table with checkboxes to select parameters for re-run |
ReviewRerunResults | Same directory | AgGrid with radio buttons to pick original vs rerun values |
CancelRerunModal | Same directory | Confirmation dialog to cancel an in-progress rerun |
SampleRerun (LabAdmin) | src/components/LabAdmin/AddEditReport/components/SampleRerun/ | Configuration UI for auto/manual rerun per parameter |
Status constants
File: src/components/reusable/ParticularPatientsTestList/utils/constants.ts
export const SAMPLE_REDRAW_FLAG = {
NON_REDRAWN: 0,
PARTIAL_REDRAWN: 1,
FULL_REDRAWN: 2,
RERUN_REQUESTED: 3,
RERUN_RECEIVED: 4,
};These map directly to sampleRedrawFlag values on the backend. Consumed in:
- RerunProgressComponent — determines which banner message and buttons to show
- ReportEntryFooter / DoctorFooter — disables Save/Sign when
RERUN_REQUESTEDorRERUN_RECEIVED - TestInfoCard — shows "Rerun Requested" or "Rerun Received" badge
- Device Results Validation — shows "Rerun Triggered" / "Rerun Complete" status
File: src/components/Operations/DeviceResultsValidation/utils/constants.ts
export const RERUN_INITIATED = 3;
export const RERUN_RECEIVED = 4;Save/Sign blocking
When sampleRedrawFlag is 3 or 4, the report footer shows:
"Rerun in progress, Confirm or cancel rerun to save or sign this report"
This is enforced in both ReportEntryFooter.tsx and DoctorFooter.tsx.
Active Reruns sidebar
Files:
src/components/Operations/SideBar/index.tsx(Operations sidebar)src/components/DoctorLogin/SideBar/index.tsx(Doctor sidebar)
A dedicated sidebar item labelled "Active Reruns" with route /active-reruns shows a count badge from genericState.patientsWatingListStatusCountData.rerunReportsCount.
Reports are filtered through labReportStatusUtils.ts which checks isRerun(instance) and populates rerunReportList.
Waiting list integration
File: src/components/reusable/PatientsWaitingList/labReportStatusUtils.ts
The isRerun() function identifies reports with active reruns. These reports are:
- Added to
rerunReportListduring waiting list processing - Counted as
rerunReportsCountfor the sidebar badge - Filtered and displayed when the user navigates to
/active-reruns
Device Results Validation integration
File: src/components/Operations/DeviceResultsValidation/components/Results.tsx
const rerunStatusMap = {
[RERUN_INITIATED]: "Rerun Triggered",
[RERUN_RECEIVED]: "Rerun Complete",
};When a report has an active rerun:
- The status badge shows "Rerun Triggered" or "Rerun Complete"
- Parameter release actions may be disabled depending on state
- The
hasRerunReportcheck in helpers identifies if any report in the current view has a rerun
Interfacing app (Electron)
Waiting list item badge
File: src/renderer/components/layout/listview/item.jsx
const isRerun = item.rerunNumber !== 0
&& item.rerunNumber !== -1
&& item.rerunNumber != null
&& item.rerunNumber !== undefined;When isRerun is true, a "Rerun" label badge is displayed next to the Sample ID in the waiting list.
Report values form
File: src/renderer/components/pages/report_values/report_values_form.jsx
When machine_triggered_rerun === 1 on a report value, the parameter is displayed with a "Rerun" status label in red.
API service functions
File: src/components/reusable/Modals/Report/helpers.ts
| Function | API Call | Purpose |
|---|---|---|
getSampleRerunDataBylrrId() | GET /sample-rerun/{id} | Fetches rerun values, dispatches to Redux sampleRerunData |
requestRerun() | POST /sample-rerun/{id}/request | Initiates a manual rerun with selected parameters |
confirmRerunResults() | POST /sample-rerun/{id}/confirm | Confirms selected values (original or rerun) |
cancelRerun() | POST /sample-rerun/{id}/abort | Cancels an in-progress rerun |
mergeSampleRerunData() | — (local) | Merges rerun data with report format, creates value1, value2, … columns |
filterAndParseManualRerunObjects() | — (local) | Filters parameters that have manual_rerun or instrument_triggered rerun type in meta |
handleSelectionChange() | — (Redux) | Updates parameterwiseSelectedValue for radio selection in review tab |
handleHeaderSelection() | — (Redux) | Selects all rows for a column (header radio button) |