Encounters
Encounters represent clinical interactions between patients and healthcare providers. Each encounter captures the context of a patient visit including participants, diagnoses, and location.
Endpoints
/api/v1/encountersCreate an encounter/api/v1/encounters/:idRetrieve an encounter/api/v1/encountersList encounters/api/v1/encounters/:idUpdate an encounter/api/v1/encounters/:id/participantsList participants/api/v1/encounters/:id/diagnosesList diagnosesThe Encounter Object
Attributes
idstringUnique identifier for the encounter.
objectstringString representing the object type. Always "encounter".
encounter_numberstringHuman-readable encounter reference number.
patient_uhidstringUHID of the patient.
statusstringEncounter status: planned, arrived, triaged, in-progress, onleave, finished, cancelled.
classstringClassification: ambulatory, emergency, inpatient, observation, etc.
typestringnullableSpecific type of encounter.
facility_idstringnullableID of the facility where encounter occurred.
facility_namestringnullableName of the facility.
provider_idstringnullableID of the primary provider.
provider_namestringnullableName of the primary provider.
period_startstringStart time of the encounter.
period_endstringnullableEnd time of the encounter.
reason_codestringnullableCoded reason for the encounter.
reason_textstringnullableText description of the reason.
fhir_encounter_idstringReference to the FHIR Encounter resource.
created_atstringTimestamp when the encounter was created.
{
"id": "enc_1234567890",
"object": "encounter",
"encounter_number": "ENC-2024-001234",
"patient_uhid": "UG123456789A",
"status": "in-progress",
"class": "ambulatory",
"type": "consultation",
"facility_id": "fac_abc123",
"facility_name": "Mulago Hospital",
"provider_id": "prov_xyz789",
"provider_name": "Dr. Sarah Nakamya",
"period_start": "2024-01-15T10:00:00Z",
"period_end": null,
"reason_code": "185349003",
"reason_text": "General examination",
"fhir_encounter_id": "Encounter/fhir-enc-123",
"created_at": "2024-01-15T10:00:00Z"
}Create an Encounter
Creates a new clinical encounter for a patient.
/api/v1/encountersRequest Body
patient_uhidstringrequiredUHID of the patient
classstringrequiredEncounter class (ambulatory, emergency, inpatient, etc.)
typestringoptionalSpecific encounter type
facility_idstringoptionalFacility ID
provider_idstringoptionalPrimary provider ID
reason_codestringoptionalSNOMED CT code for reason
reason_textstringoptionalText description of reason
curl https://api.mediloop.co/api/v1/encounters \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"patient_uhid": "UG123456789A",
"class": "ambulatory",
"type": "consultation",
"facility_id": "fac_abc123",
"provider_id": "prov_xyz789",
"reason_text": "General examination"
}'{
"id": "enc_1234567890",
"object": "encounter",
"encounter_number": "ENC-2024-001234",
"patient_uhid": "UG123456789A",
"status": "in-progress",
"class": "ambulatory",
"created_at": "2024-01-15T10:00:00Z"
}List Encounters
Returns a list of encounters with optional filtering.
/api/v1/encountersQuery Parameters
limitintegeroptionalNumber of results (1-100)
Default: 10
patient_uhidstringoptionalFilter by patient UHID
facility_idstringoptionalFilter by facility
statusstringoptionalFilter by status
start_datestringoptionalFilter from date (ISO 8601)
end_datestringoptionalFilter to date (ISO 8601)
curl "https://api.mediloop.co/api/v1/encounters?patient_uhid=UG123456789A&status=finished" \
-H "Authorization: Bearer sk_test_..."{
"object": "list",
"url": "/api/v1/encounters",
"has_more": false,
"data": [
{
"id": "enc_1234567890",
"object": "encounter",
"patient_uhid": "UG123456789A",
"status": "finished",
"class": "ambulatory",
"period_start": "2024-01-15T10:00:00Z",
"period_end": "2024-01-15T10:45:00Z"
}
]
}Encounter Participants
List all participants involved in an encounter.
/api/v1/encounters/:id/participantscurl https://api.mediloop.co/api/v1/encounters/enc_123/participants \
-H "Authorization: Bearer sk_test_..."{
"object": "list",
"data": [
{
"id": "part_001",
"type": "primary-performer",
"provider_id": "prov_xyz789",
"provider_name": "Dr. Sarah Nakamya",
"specialty": "General Practice"
},
{
"id": "part_002",
"type": "participant",
"provider_id": "prov_abc456",
"provider_name": "Nurse Jane Apio",
"specialty": "Nursing"
}
]
}Encounter Classes
Valid encounter class values:
| Class | Description |
|---|---|
ambulatory | Outpatient visit |
emergency | Emergency department visit |
inpatient | Hospital admission |
observation | Observation stay |
home | Home visit |
virtual | Telemedicine consultation |