Clinical Use

Laboratory Lifecycle

Production workflow and integration guide for laboratory orders, specimen handling, transport, processing, result publication, corrections, critical alerts, auditability, and openEHR/FHIR interoperability boundaries.

Clinical and operational boundary

AMCDR uses openEHR templates as the authoritative result contract. Laboratory requests, specimens, transport, transfer, accessioning, processing and critical-alert acknowledgement are managed by the native Laboratory module as governed, indexed lifecycle records. The final or corrected result is persisted as versioned openEHR clinical content and references the native request and specimen context through stable lifecycle identifiers.

The Laboratory workspace is available in the AMCDR frontend as Clinical Care -> Laboratory. It is controlled by the laboratory platform module flag and can be enabled or disabled per deployment without changing the clinical repository boundary.

Native workflow forms and governed result form

Use the Laboratory workspace’s forms for operational stages and a published Semantic Studio form for the result composition. Every operational write retains its patient, encounter, tenant, lifecycle, and actor context for audit and reporting.

StageUser interfaceAuthoritative record
RequestNew lab order native formLaboratory order linked to patient, encounter, test coding, clinical indication, priority and lab_workflow_id.
CollectionCollect specimen native form in the selected-order workbenchSpecimen lifecycle record containing type, container, barcode/accession, collector, collection site, fasting/storage context and collection time.
Transport and transferNative Transport and Transfer order formsOperational events linked to the same order, specimen and workflow; clinically relevant delay, damage, loss or cold-chain facts must also be reflected in clinical interpretation.
ResultRecord result launches the published lab form routed through lab_system_packVersioned openEHR result composition. The supplied example is KDS_Laborbericht / template id kds-laborbericht.
Critical acknowledgementNative Acknowledge formAlert, responsible actor, acknowledgement time and mandatory clinical action, linked to the result and lifecycle.

The result form receives order and specimen context rather than asking the user to retype it. The launch context includes the order/service-request id, lab_workflow_id, test code and display, panel, priority, indication, requested time, performing laboratory, specimen type and collection instructions. When the composition is saved, AMCDR links its composition and version identifiers back to the selected order.

Patient context and primary actions

The patient safety context remains sticky at the top of the Laboratory workspace while the user reviews results, orders and reports. It shows the patient demographics and MRN together with the current Patient ID, EHR ID, active encounter and Encounter ID. Verify these identifiers before every order, result or report action. New lab order, Record result, Upload report and Technical details are located in this top context bar rather than a bottom action strip.

Record result opens an order selector when no order row is selected. It then launches the published Results form routed through lab_system_pack. If the form is not published and routed, the workspace reports that configuration requirement instead of silently disabling the action or falling back to ungoverned result entry.

Manual report upload

Upload report is a secondary document-intake workflow for an already-produced laboratory report. It accepts PDF, JPEG or PNG files up to 5 MB, records report status, verification state, report identifier, performing laboratory and summary, and optionally links the report to a laboratory order and its encounter. The received-report list exposes the saved report and its downloadable attachment.

Send HL7 v2 ORU messages through the authenticated instrument ingestion pipeline under Technical details. That pipeline validates message identity, order, specimen, mapping, units, duplicates, and current QC. Manual report uploads accept files and do not create structured observations.

Native order workflow

  1. Select a patient and active encounter, then choose New lab order.
  2. Search the configured terminology service for the test or panel. LOINC or another governed laboratory code system is preferred; explicitly identified local coding remains available for controlled fallback.
  3. Record priority, specimen type, coded or local clinical indication, collection instructions and notes.
  4. Create the order and retain its lab_order_id and lab_workflow_id. An order alone must not create a performed-service charge.

Native specimen, transport and transfer workflow

  1. Select the order and choose Collect specimen. Collector and either barcode or accession number are required for traceability.
  2. Record the specimen type, container, collection site, fasting status, storage condition and any collection note.
  3. Use Transport on that specimen to record start, handover, temperature, receipt, delay, loss or damage. Mark an event clinically relevant only when it can affect interpretation or patient care.
  4. Use Transfer order when another laboratory will perform the work; receiving laboratory and reason are required.

Governed result and critical acknowledgement

  1. Choose Record result in the sticky patient context bar and select the relevant order. AMCDR opens the result only when a published laboratory Results form is routed to the workspace.
  2. Record structured analytes, values, UCUM units, reference ranges, interpretation, method, effective time and performing laboratory in the governed result form.
  3. Save preliminary content and finalize it according to laboratory policy. Corrected results create a new composition/result version; they do not overwrite final history.
  4. For a critical alert, choose Acknowledge. Both the acknowledging clinician and clinical action taken are mandatory.
Laboratory integration boundary
AMCDR Clinical RecordOrders, results, patient timeline, audit
->
Laboratory OperationsQueues, specimen workflow, transport, transfer, accessioning
->
AMy-Term TerminologyLOINC, specimen types, units, reference terms
->
FHIR ExchangeServiceRequest, Specimen, Observation, DiagnosticReport

What goes into openEHR

ProcessopenEHR record?Reason
Lab orderNative lifecycle; referenced by resultClinical intent and diagnostic request remain governed and auditable without requiring a separate Semantic Studio order form.
Specimen collectionNative lifecycle; relevant facts included/referenced by resultCollection time, specimen type, site, fasting state, and patient context can affect interpretation.
Specimen transportMostly noCourier, route, handover, and chain-of-custody are operational logistics.
Transport breachYes if clinically relevantDelay, damage, loss, or cold-chain breach affects result validity.
Accessioning and processingMostly noInternal lab workflow and analyzer/QC state are operational.
Result observationYesClinical measurement belongs in the longitudinal patient record.
Corrected resultYes, versionedCorrections must not destructively overwrite final results.
Critical alert acknowledgementNative lifecycle linked to resultClinical safety, notification, accountability, and audit.

Lifecycle identifiers

Each laboratory request and result lifecycle is linked by lab_workflow_id. The order id, specimen id, accession number, result id, diagnostic report id, transfer id, and transport id identify the relevant stage without replacing the shared lifecycle reference.

IdentifierUse
lab_workflow_idStable lifecycle id shared by order, specimen, transport, results, corrections, alerts, and timeline events.
lab_order_idThe clinical laboratory order, mapped to FHIR ServiceRequest.
specimen_idSpecimen record, mapped to FHIR Specimen where applicable.
observation_result_idAtomic result observation, mapped to FHIR Observation.
diagnostic_report_idGrouped/panel report, mapped to FHIR DiagnosticReport.

Lifecycle stages

StageOwnerExamples
OrderAMCDRORDERED, CANCELLED, TRANSFER_REQUESTED
SpecimenLaboratory module and AMCDR when clinically relevantCOLLECTED, RECEIVED, REJECTED, RECOLLECTION_REQUIRED
TransportLaboratory moduleIN_TRANSIT, DELAYED, DELIVERED, LOST, DAMAGED, COLD_CHAIN_BREACH
ProcessingLaboratory moduleAccessioning, analyzer workflow, method, QC status, rerun required.
ResultsAMCDRPRELIMINARY, FINAL, CORRECTED, CANCELLED
Critical alertsLaboratory rules service and AMCDRCritical value detection, acknowledgement, escalation, audit.

Operational API surface

GET  /api/lab/status
GET  /api/lab/orders
POST /api/lab/orders
GET  /api/lab/orders/{lab_order_id}
POST /api/lab/orders/{lab_order_id}/cancel
POST /api/lab/orders/{lab_order_id}/transfer
POST /api/lab/orders/{lab_order_id}/specimens

GET   /api/lab/specimens
PATCH /api/lab/specimens/{specimen_id}/status
POST  /api/lab/specimens/{specimen_id}/transport/start
POST  /api/lab/specimens/{specimen_id}/transport/handover
POST  /api/lab/specimens/{specimen_id}/transport/temperature
POST  /api/lab/specimens/{specimen_id}/transport/receive
POST  /api/lab/specimens/{specimen_id}/transport/delay
POST  /api/lab/specimens/{specimen_id}/transport/lost
POST  /api/lab/specimens/{specimen_id}/transport/damaged
POST  /api/lab/specimens/{specimen_id}/reject
POST  /api/lab/specimens/{specimen_id}/recollect

GET  /api/lab/results
POST /api/lab/results
POST /api/lab/results/{observation_result_id}/finalize
POST /api/lab/results/{observation_result_id}/correct
POST /api/lab/results/{observation_result_id}/cancel

GET  /api/lab/alerts
POST /api/lab/alerts/{alert_id}/acknowledge
GET  /api/lab/timeline/{lab_workflow_id}

Example laboratory order payload

{
  "patient_id": "patient-uuid",
  "encounter_id": "encounter-uuid",
  "test_code": "718-7",
  "test_display": "Haemoglobin",
  "test_panel": "CBC",
  "priority": "urgent",
  "clinical_indication": "Assess anaemia",
  "requested_performing_lab_id": "central-lab"
}

Critical alerts

Critical values create explicit alert records and lifecycle events. Acknowledgement captures the responsible actor, timestamp, action taken, and audit context. Results are retained with version history and are never silently erased or replaced.

POST /api/lab/results
{
  "lab_order_id": "order-uuid",
  "test_code": "718-7",
  "test_display": "Haemoglobin",
  "result_value": "4.8",
  "unit": "g/dL",
  "interpretation_flag": "critical",
  "critical": true,
  "alert_reason": "Severe anaemia threshold"
}

Roles

RoleAccess
ClinicianOrder labs, view results, cancel where authorized, acknowledge critical results where permitted.
PhlebotomistSpecimen collection tasks and specimen status.
CourierTransport-relevant information only; no unnecessary clinical detail.
Lab technicianAccessioning, processing, and result entry.
Lab supervisorValidation, corrections, critical alert workflow.
AuditorLifecycle trace subject to permission.

Performance and indexing

Laboratory operational screens are served from indexed operational tables, projections, and short-lived cache. Routine queue operations do not depend on deep openEHR/AQL reads. Clinical results and clinically relevant specimen summaries are committed to AMCDR/openEHR and remain available through AQL, FHIR, reports, and the patient timeline.

Recent laboratory worklists, alerts, timelines, and status counters use a short Redis cache. Any laboratory write, cancellation, transfer, specimen event, result update, correction, or acknowledgement invalidates the affected cache entries so the next read refreshes from PostgreSQL. Composite indexes support common filters by category, status, patient, workflow, specimen, alert state, and creation time.

Laboratory reporting

Reporting joins native lifecycle records and governed result compositions by lab_workflow_id and their stage identifiers. Clinical and HMIS outputs use the current final or corrected composition for analyte values, UCUM units, reference ranges and interpretations. Operational laboratory reports use native records for requests, turnaround time, collection, rejection, recollection, transport, transfer, accessioning, processing and alert acknowledgement. Financial reports consume the configured performed/completed event and must never bill an order, cancellation, duplicate transition or correction as another performed test.

Every report row must retain enough provenance to resolve the patient, encounter, order, specimen, result/composition version, performing laboratory and current lifecycle status. Patient-facing and clinical reports must not expose courier-only operational detail, while operational reports must not duplicate or replace the governed clinical result.

Analyser and point-of-care instrument integration

Open Laboratory → Technical details to manage the instrument layer. Register the device identifier, manufacturer, model, serial, protocol and QC policy. Map each analyser-specific test code to governed LOINC, result type, UCUM unit and laboratory-approved reference ranges. Create work orders only from existing laboratory orders and specimens and preserve placer/filler identifiers.

HL7 v2 ORU (ER7/XML) and canonical inbound results pass through message identity, order, specimen, mapping, unit, duplicate and current-QC controls before patient results are created. Unknown mapping/order, QC failure and integrity errors enter a persisted exception queue. Correct the governing data and reprocess the same message; do not bypass the gate with an unrelated manual final result. Clinical verification and correction remain distinct from technical ingestion.

  1. Prove failed/expired QC blocks an otherwise valid patient result.
  2. Prove an unknown vendor code creates an exception without creating a result.
  3. Add the governed mapping, record passing QC, reprocess and verify exactly one linked result.
  4. Replay the same message and verify duplicate containment.
  5. Verify instrument administrators and laboratory operators have distinct permissions and authenticated actor evidence.

Deployment and operations

Enable Laboratory only for deployments that are configured to expose laboratory workflows. When disabled, Laboratory navigation, routes, and operational APIs are unavailable through the module guard.

AMCDR_MODULE_LABORATORY_ENABLED=true

docker compose run --rm backend alembic upgrade head
docker compose up -d backend frontend

docker compose exec -T backend python - <<'PY'
from app.core.warmup import run_warmup_once
run_warmup_once(label="post-lab-deploy", full=True)
PY

After large imports or laboratory projection changes, rebuild OpenSearch projections and confirm /health reports the expected schema revision. PostgreSQL remains the authoritative store for operational laboratory records; openEHR remains the clinical record authority.