Laboratory
The Laboratory API manages lab orders, specimen collection, and results. Lab orders can be fulfilled at any participating laboratory in the MediLoop network.
Endpoints
/api/v1/lab-orders/Create a lab order/api/v1/lab-orders/List lab orders/api/v1/lab-orders/{id}/Get lab order details/api/v1/lab-orders/{id}/Update lab order/api/v1/lab-orders/{id}/cancel/Cancel lab order/api/v1/lab-orders/{id}/results/Get lab resultsThe LabOrder Object
Attributes
iduuidUnique identifier.
order_numberstringHuman-readable order number.
patient_uhidstringPatient UHID.
encounter_iduuidnullableAssociated encounter.
statusstringOrder status.
prioritystringPriority: routine, urgent, stat.
test_codestringLOINC code for the test.
test_namestringTest display name.
categorystringTest category (hematology, chemistry, etc.).
ordering_provider_iduuidOrdering provider ID.
ordering_provider_namestringProvider name.
performing_lab_iduuidnullableLab facility ID.
performing_lab_namestringnullableLab name.
clinical_notesstringnullableClinical notes for lab.
specimen_collectedbooleanWhether specimen was collected.
specimen_collected_atdatetimenullableCollection timestamp.
results_availablebooleanWhether results are ready.
ordered_atdatetimeWhen order was placed.
fhir_service_request_idstringFHIR resource ID.
{
"id": "lab-123-456-789",
"order_number": "LAB-2024-001234",
"patient_uhid": "UG123456789A",
"encounter_id": "enc-abc-123",
"status": "active",
"priority": "routine",
"test_code": "58410-2",
"test_name": "Complete Blood Count (CBC)",
"category": "hematology",
"ordering_provider_id": "prov-xyz-789",
"ordering_provider_name": "Dr. Sarah Nakamya",
"performing_lab_id": "fac-lab-001",
"performing_lab_name": "Lancet Laboratories",
"clinical_notes": "Rule out anemia",
"specimen_collected": true,
"specimen_collected_at": "2024-01-15T11:00:00Z",
"results_available": false,
"ordered_at": "2024-01-15T10:30:00Z"
}Create a Lab Order
Creates a new laboratory order for a patient.
/api/v1/lab-orders/Request Body
patient_uhidstringrequiredPatient UHID
test_codestringrequiredLOINC test code
test_namestringrequiredTest name
categorystringrequiredTest category
encounter_iduuidoptionalAssociated encounter
prioritystringoptionalPriority level
Default: routine
performing_lab_iduuidoptionalPreferred lab
clinical_notesstringoptionalNotes for lab
fasting_requiredbooleanoptionalFasting required
curl -X POST https://api.mediloop.co/api/v1/lab-orders/ \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"patient_uhid": "UG123456789A",
"test_code": "58410-2",
"test_name": "Complete Blood Count (CBC)",
"category": "hematology",
"encounter_id": "enc-abc-123",
"priority": "routine",
"clinical_notes": "Rule out anemia"
}'{
"id": "lab-new-123",
"order_number": "LAB-2024-001234",
"patient_uhid": "UG123456789A",
"status": "active",
"test_name": "Complete Blood Count (CBC)",
"priority": "routine",
"ordered_at": "2024-01-15T10:30:00Z"
}Get Lab Results
Retrieve results for a completed lab order.
/api/v1/lab-orders/{id}/results/curl https://api.mediloop.co/api/v1/lab-orders/lab-123-456/results/ \
-H "Authorization: Bearer sk_test_..."{
"order_id": "lab-123-456",
"order_number": "LAB-2024-001234",
"test_name": "Complete Blood Count (CBC)",
"status": "final",
"results": [
{
"code": "718-7",
"name": "Hemoglobin",
"value": 14.2,
"unit": "g/dL",
"reference_range": "12.0-16.0",
"interpretation": "normal"
},
{
"code": "789-8",
"name": "Red Blood Cells",
"value": 4.8,
"unit": "million/uL",
"reference_range": "4.0-5.5",
"interpretation": "normal"
},
{
"code": "6690-2",
"name": "White Blood Cells",
"value": 7.2,
"unit": "thousand/uL",
"reference_range": "4.5-11.0",
"interpretation": "normal"
}
],
"resulted_at": "2024-01-15T14:00:00Z",
"verified_by": "Lab Tech John"
}List Lab Orders
/api/v1/lab-orders/Query Parameters
patient_uhidstringoptionalFilter by patient
statusstringoptionalFilter by status
categorystringoptionalFilter by category
results_availablebooleanoptionalFilter by results status
date_fromdateoptionalFilter from date
date_todateoptionalFilter to date
Order Status
| Status | Description |
|---|---|
draft | Order created but not submitted |
active | Order submitted, awaiting specimen |
on-hold | Order temporarily on hold |
completed | Results available |
cancelled | Order cancelled |