Skip to content

Base Components

Encounter

An encounter is like a chapter in the patient's hospital story. It represents each time they interact with healthcare providers - whether it's a quick check at triage, a consultation with a doctor, or a surgical procedure.

Think of encounters as the "scenes" where medical care happens. Each encounter has a beginning and end time, involves specific healthcare providers, and takes place in a particular location within the hospital.

Data Model

FieldTypeRequiredDescription
patient_codestringYESReference to the patient's unique code
visit_codestringYESReference to visit the unique code
codestringYESUnique identifier for the encounter
classstringYESClass of encounter ("IPD", "OPD", or "EMERGENCY")
namestringYESWhat is the encounter (triage, ward names, sub-clinic … )
service_typestringYESType of the service provided (nullable)
started_atdatetimeYESDate and time encounter started
ended_atdatetimeYESDate and time encounter ended (nullable)
encountered_bystringYESName of healthcare provider
titlestringYESWhether the healthcare provider is doctor or nurse
created_atdatetimeYESRecord creation timestamp
updated_atdatetimeRecord the last update timestamp

Example

json
{
  "patient_code": "P25003877",  
  "visit_code": "V420650",  
  "code": "E317001",  
  "class_name": "OPD",  
  "name": "General Medicine",
  "service_type": "General Consultation",  
  "started_at": "2025-03-17T09:35:00.000+07:00",  
  "ended_at": "2025-03-17T10:15:00.000+07:00",  
  "encountered_by": "Dr. Chhun Sovannarith",
  "title": "Doctor",
  "created_at": "2025-03-17T09:35:00.000+07:00",  
  "updated_at": "2025-03-17T10:15:00.000+07:00"  
}

Observations

Observations are like detailed notes that healthcare providers write down about everything they notice, measure, or learn about a patient. Think of them as the "facts" collected during the patient's journey.

These could be anything from "Patient says they have a headache" to "Blood pressure is 120/80" to "Patient traveled to Mondulkiri province recently." Observations are incredibly flexible because healthcare involves collecting many different types of information.

Why are they flexible? Every patient is unique, and every hospital might track different things. Some might record detailed family history, others might focus on specific symptoms. The observation system adapts to capture whatever information is important for that patient's care.

Data Model

FieldTypeRequiredDescription
encounter_codestringYESReference to encounter unique code
observation_codestringReference to parent observation (nullable)
namestringYESName for the observation
categorystringYESName for the category of the observation if applicable
valuevariousYESValue of the observation (type depends on value_type)
value_typestringYESType of value ("boolean", "string", "text", "integer", "float", "datetime", "time", "array", "complex")
value_unitstringUnit of measurement (nullable)

Value Types - The Flexibility System

Since observations can be anything from a simple yes/no answer to complex medical data, we use different "value types" to handle this variety. Think of value types as different containers for different kinds of information.

Boolean (True/False) Example

"Does the patient smoke?"

json
{  
  "encounter_code": "EN20250317001",  
  "observation_code": null,  
  "name": "Smoker",  
  "category": "Social History",  
  "value": false,  
  "value_type": "boolean",  
  "value_unit": null  
}

String (Short Text) Example

"What's the patient's blood type?"

json
{  
  "encounter_code": "EN20250317001",  
  "observation_code": null,  
  "name": "Blood Type",  
  "category": "Laboratory",  
  "value": "O+",  
  "value_type": "string",  
  "value_unit": null  
}

Text (Long Description) Example

"What are the patient's symptoms and recent travel history?"

json
{  
  "encounter_code": "EN20250317001",  
  "observation_code": null,  
  "name": "Clinical Notes",  
  "category": "Assessment",  
  "value": "Patient reports symptoms of malaria including periodic fever, headache, and fatigue. Has history of travel to Mondulkiri province two weeks ago.",  
  "value_type": "text",  
  "value_unit": null  
}

Numeric Example

"What's the patient's blood glucose level?"

json
{  
  "encounter_code": "EN20250317001",  
  "observation_code": null,  
  "name": "Blood Glucose",  
  "category": "Vital Signs",  
  "value": 110,  
  "value_type": "integer",  
  "value_unit": "mg/dL"  
}

Array (List) Example

"What symptoms does the patient have?"

json
{  
  "encounter_code": "EN20250317001",  
  "observation_code": null,  
  "name": "Symptoms",  
  "category": "History",  
  "value": ["Fever", "Headache", "Fatigue", "Joint Pain"],  
  "value_type": "array",  
  "value_unit": null  
}

Complex (Structured Data) Example

"What's the patient's malaria risk assessment?"

json
{  
  "encounter_code": "EN20250317001",  
  "observation_code": null,  
  "name": "Malaria Risk Assessment",  
  "category": "Risk Assessment",  
  "value": {  
    "risk_level": "High",  
    "travel_history": true,  
    "prevention_measures": ["Bed nets", "Repellent"],  
    "endemic_area": "Mondulkiri province"  
  },  
  "value_type": "complex",  
  "value_unit": null  
}

TIP

Note: Medical history conditions use the same flexible structure as observations, but we've simplified them in the Medical History section to make implementation easier.


Conditions

Conditions represent medical diagnoses, health problems, or clinical states that affect a patient. Think of them as the "medical labels" that doctors assign to describe what's wrong with a patient or what health issues they're managing.

Unlike the simplified diagnosis component, conditions provide a more comprehensive way to track ongoing health issues, their severity, when they started, and their current status.

Data Model

FieldTypeDescription
patient_codestringWhich patient this condition belongs to
visit_codestringWhich hospital visit this condition was identified during
encounter_codestringWhich encounter this condition was documented in
codestringUnique identifier for this condition record
condition_codestringStandard medical code for the condition (ICD-10, etc.)
condition_namestringHuman-readable name of the condition
categorystringType of condition (primary, secondary, chronic, etc.)
severitystringHow serious the condition is (mild, moderate, severe)
statusstringCurrent state (active, resolved, inactive, etc.)
onset_datedateWhen the condition first started
recorded_datedatetimeWhen this condition was documented
notestextAdditional clinical notes about the condition
created_atdatetimeWhen this record was created
updated_atdatetimeWhen this record was last updated

Example

json
{
  "patient_code": "P25003877",
  "visit_code": "V420650",
  "encounter_code": "E317001",
  "code": "COND001",
  "condition_code": "E11.9",
  "condition_name": "Type 2 diabetes mellitus without complications",
  "category": "chronic",
  "severity": "moderate",
  "status": "active",
  "onset_date": "2020-05-15",
  "recorded_date": "2025-03-17T09:45:00.000+07:00",
  "notes": "Patient reports good glucose control with metformin",
  "created_at": "2025-03-17T09:45:00.000+07:00",
  "updated_at": "2025-03-17T09:45:00.000+07:00"
}

Services

Services represent the healthcare procedures, treatments, or interventions provided to a patient during their visit. Think of them as the "actions" that healthcare providers perform - from simple consultations to complex surgical procedures.

Services help track what was actually done for the patient, who performed it, when it happened, and often connect to billing and resource management systems.

Data Model

FieldTypeRequiredDescription
patient_codestringYESWhich patient received this service
visit_codestringYESWhich hospital visit this service was part of
encounter_codestringYESWhich encounter this service was provided during
codestringYESUnique identifier for this service record
service_codestringYESStandard code for the service (CPT, local codes, etc.)
service_namestringYESHuman-readable name of the service
categorystringYESType of service (consultation, procedure, diagnostic, etc.)
departmentstringYESWhich hospital department provided the service
provider_namestringYESName of the healthcare provider who performed the service
provider_titlestringYESRole/title of the provider (Doctor, Nurse, Technician)
performed_atdatetimeYESWhen the service was performed
duration_minutesintegerHow long the service took
quantityintegerYESHow many units of this service were provided
unit_pricenumberYESCost per unit of service
total_pricenumberYESTotal cost for this service
statusstringYESService status (completed, cancelled, pending, etc.)
notestextAdditional notes about the service
created_atdatetimeYESWhen this record was created
updated_atdatetimeWhen this record was last updated

Example

json
{
  "patient_code": "P25003877",
  "visit_code": "V420650",
  "encounter_code": "E317001",
  "code": "SRV001",
  "service_code": "99213",
  "service_name": "Office visit for established patient",
  "category": "consultation",
  "department": "General Medicine",
  "provider_name": "Dr. Chhun Sovannarith",
  "provider_title": "Doctor",
  "performed_at": "2025-03-17T09:35:00.000+07:00",
  "duration_minutes": 30,
  "quantity": 1,
  "unit_price": 25000,
  "total_price": 25000,
  "status": "completed",
  "notes": "Routine follow-up for diabetes management",
  "created_at": "2025-03-17T09:35:00.000+07:00",
  "updated_at": "2025-03-17T10:05:00.000+07:00"
}

Service Categories

CategoryDescriptionExamples
ConsultationDoctor visits and medical consultationsGeneral consultation, specialist consultation
DiagnosticTests and examinations to diagnose conditionsBlood tests, X-rays, ultrasounds
TherapeuticTreatments and interventionsWound dressing, injections, physiotherapy
SurgicalSurgical procedures and operationsMinor surgery, major surgery, endoscopy
EmergencyEmergency care servicesEmergency consultation, resuscitation
AdministrativeNon-clinical servicesRegistration, medical certificates