Module 07, Laboratory

Lab &
Diagnostics

The Laboratory module manages the entire test lifecycle—from a doctor ordering a blood test to the lab collecting the sample, running the analysis, verifying the results, and delivering the report to the patient's record.

What is Lab Management?

Lab Management handles everything related to diagnostic testing—blood tests, urine tests, pathology, microbiology, biochemistry, and all other laboratory analyses. It tracks each sample from the moment it's collected to the moment the verified report is delivered to the doctor and patient.

The system manages test orders, sample collection with barcode tracking, result entry, quality verification by senior pathologists, report generation (including printable PDFs), closed-loop critical-value handling (ack → chart note → close), and a STAT / TAT board for overdue campus turnaround.

Why Does It Exist?

Laboratory errors can have serious clinical consequences. Without a proper system:

  • → Sample mix-ups — One patient's blood could be swapped with another's
  • → Lost results — Paper reports get misplaced, delaying treatment
  • → Critical misses — Life-threatening abnormal results might not be flagged urgently
  • → No audit trail — If a result is questioned, there's no record of who handled it
Step by Step

How Lab Testing Works

1

Test Ordered

A doctor orders lab tests during a consultation (e.g., "Complete Blood Count," "Blood Sugar," "Lipid Profile"). The order appears instantly in the lab system with the patient's MRN, the ordered tests, and any clinical notes.

Behind the scenes: The order creates a record in the Lab table. It shows as "Pending Collection." The doctor can see the status from their dashboard.
2

Sample Collection

A phlebotomist (or nurse) collects the sample. They label the collection tube with a unique barcode generated by the system. The barcode links the physical sample to the digital order. The sample is logged as "Collected."

Behind the scenes: The barcode system eliminates mix-ups. The system records who collected the sample and when, creating a chain of custody.
3

Analysis & Results

The lab technician runs the sample on the appropriate analyzer (or manually processes it). Results are entered into the system. For automated analyzers, results can be imported directly via LIS interface, eliminating manual entry errors.

Behind the scenes: The system flags results that fall outside normal reference ranges. Critical values (life-threatening) get an urgent alert.
4

Verification & Report

A senior pathologist or lab supervisor reviews the results. They can verify (approve) or reject (with reason for re-collection). Once verified, the report is available in the patient's record and can be printed as a PDF.

Behind the scenes: Unverified reports are visible only to lab staff. Only verified reports are shared with doctors and patients. All actions are logged.
Deep Dive

Every Feature Explained

Test Ordering

What it is

Doctors order lab tests from the consultation screen.

Why it exists

No paper forms. Orders arrive at the lab instantly.

How it works

Doctor selects tests from a categorized catalog. The order links to the patient, the encounter, and billing.

Barcode Sample Tracking

What it is

Every sample is labeled with a unique barcode.

Why it exists

Eliminates sample misidentification. The chain of custody is recorded electronically.

How it works

The barcode is printed on a sticker applied to the collection tube. Every scan logs who handled the sample and when.

Result Entry & Verification

What it is

Two-step process: technician enters results, pathologist verifies.

Why it exists

Prevents errors. A second pair of eyes catches mistakes before the report goes to the doctor.

How it works

Results can be imported from analyzers or entered manually. The system checks reference ranges. Verification is a digital signature.

Critical Value Closed-Loop

What it is

Life-threatening results require notify → acknowledge → chart note → close.

Why it exists

A critically high potassium or low hemoglobin needs immediate action and proof it was seen and documented, not only a toast.

How it works

Thresholds flag findings; staff with lab:critical-alert are notified. Ack with lab:critical:ack, link a patient chart note, then close. Escalate only if unread after local SLA, it does not replace ack. Inbox on the Lab hub; chart banner on the patient.

STAT / TAT Command Center

What it is

Campus wallboard of overdue and approaching diagnostic turnaround.

Why it exists

CMOs need one view of STAT risk across lab, radiology, and cath, not three separate queues.

How it works

Open /dashboard/lab/tat (GET /diagnostics/tat-board). Counts only, no PHI. SLA minutes from campus BranchSetting diagnostics.tat.* (or enterprise when Viewing All).

PDF Report Generation

What it is

Generate printable, shareable lab report PDFs.

Why it exists

Patients need physical copies for other providers or their own records.

How it works

Verified reports can be exported to PDF with hospital letterhead, patient info, test results, reference ranges, and pathologist signature.

LIS Integration

What it is

Direct connection to automated laboratory analyzers.

Why it exists

Auto-importing results eliminates manual transcription errors and saves time.

How it works

Analyzers post JSON to /lab/machine/reports or optional HL7 v2 to /lab/machine/hl7 (ORU^R01 with LOINC OBX). ADT^A01/A03 and ORM^O01 (NW/CA) default parse+ACK; opt-in write-back (settings hl7.writeback.* + feature hl7_clinical_writeback) can admit/discharge or match/create/cancel lab/radiology/cath orders with explicit UUIDs. Not a certified HL7 engine.

Real-World Example

“Mr. Singh's Blood Test”

Mr. Singh sees a doctor for fatigue. The doctor orders a Complete Blood Count and Thyroid panel. The order appears in the lab system instantly.

A phlebotomist calls Mr. Singh to the collection area, draws blood, and labels the vial with a printed barcode. The sample is logged as collected.

In the lab, the analyzer processes the sample and sends results directly to the system. The pathologist reviews them, notices a slightly abnormal thyroid value, verifies the report. Within 2 hours of collection, the verified report is in Mr. Singh's patient record. The doctor gets a notification and discusses the results with Mr. Singh during a follow-up call.

Measurable Impact

  • Turnaround Time

    From collection to verified report: typically 2-4 hours for routine tests.

  • Zero Mix-Ups

    Barcode system ensures 100% sample-to-patient accuracy.

  • Critical Alerts

    Life-threatening results reach doctors within minutes, not hours.

Lab
Architecture

The LIS uses an event-mesh trigger to notify phlebotomy of new orders. Reports are stored in JSONB format to handle varying test parameters across different test types.

Technical Architecture

FieldTypeInstitutional Role
report_idUUIDUnique diagnostic report identifier.
sample_barcodeVarchar(64)Physical sample mapping code for chain of custody.
result_dataJSONBStructured test values and reference ranges.
certifying_doc_idUUIDInstitutional ID of the signing consultant.

Note: Sensitive fields use AES-256 field-level encryption where applicable.

Governance & Power

lab:order
lab:view
lab:upload
lab:verify
  • Critical Alerting

    Test results outside the 'Critical Band' trigger a high-priority alert to the ordering physician and ward nurse simultaneously.

  • LIS Interfacing

    HMIS Pro interfaces directly with automated analyzers, pulling raw result data without manual entry, reducing transcription errors to zero.

Regulatory Integrity: 100% of reports are cryptographically signed.