FHIR Basics
Fast Healthcare Interoperability Resources (FHIR) is the healthcare standard on which Medict is built. This guide covers the fundamental concepts you need to understand when working with Medict.
What is FHIR?
FHIR (pronounced "fire") is a standard for exchanging healthcare information electronically. It provides a common way to represent and share healthcare data across different systems.
Core FHIR Concepts
Resources
FHIR resources are the basic building blocks of healthcare data. Each resource represents a specific type of healthcare information.
Common Resources:
Patient- Information about a patientPractitioner- Healthcare provider informationEncounter- A patient visit or interactionObservation- Clinical measurements and findingsDiagnosis- Medical diagnosesMedication- Medication informationAppointment- Scheduled appointments
Resource Structure
Every FHIR resource has:
- id: Unique identifier
- meta: Metadata about the resource
- text: Human-readable summary
- identifier: Additional identifiers
- status: Current state of the resource
- subject: What the resource is about
Example Patient Resource
{
"resourceType": "Patient",
"id": "example-patient",
"identifier": [
{
"use": "usual",
"type": {
"coding": [
{
"system": "http://hl7.org/fhir/identifier-type",
"code": "MR"
}
]
},
"value": "12345"
}
],
"name": [
{
"use": "official",
"family": "Smith",
"given": ["John", "Michael"]
}
],
"gender": "male",
"birthDate": "1990-01-15",
"address": [
{
"use": "home",
"line": ["123 Main St"],
"city": "Anytown",
"state": "CA",
"postalCode": "12345",
"country": "US"
}
]
}
FHIR Data Types
Primitive Types
string- Text datainteger- Whole numbersdecimal- Decimal numbersboolean- True/false valuesdate- Date only (YYYY-MM-DD)dateTime- Date and timetime- Time only (HH:MM:SS)uri- Uniform Resource Identifierurl- Web address
Complex Types
Coding- Coded values with system and codeCodeableConcept- Flexible coding with textReference- Reference to another resourceIdentifier- Unique identifiersHumanName- Person namesAddress- Physical addressesContactPoint- Phone, email, etc.
Working with Resources in Medict
Creating Resources
import { MedictClient } from '@medplum/core';
const client = new MedictClient();
// Create a new patient
const patient = await client.createResource({
resourceType: 'Patient',
name: [{
use: 'official',
family: 'Doe',
given: ['Jane']
}],
gender: 'female',
birthDate: '1985-06-15'
});
Reading Resources
// Read a specific patient
const patient = await client.readResource('Patient', 'patient-id');
// Search for patients
const patients = await client.searchResources('Patient', {
name: 'Smith',
gender: 'male'
});
Updating Resources
// Update a patient
patient.name[0].given = ['John', 'Michael'];
const updatedPatient = await client.updateResource(patient);
Deleting Resources
// Delete a patient
await client.deleteResource('Patient', 'patient-id');
Search and Querying
Basic Search
// Search by name
const patients = await client.searchResources('Patient', {
name: 'Smith'
});
// Search by multiple criteria
const encounters = await client.searchResources('Encounter', {
patient: 'Patient/patient-id',
status: 'finished',
date: 'ge2023-01-01'
});
Advanced Search
// Complex search with modifiers
const observations = await client.searchResources('Observation', {
'code': 'http://loinc.org|8480-6', // Blood pressure
'patient': 'Patient/patient-id',
'date': 'ge2023-01-01',
'value-quantity': 'gt120' // Systolic > 120
});
References and Relationships
Internal References
{
"resourceType": "Observation",
"subject": {
"reference": "Patient/patient-id"
},
"performer": [
{
"reference": "Practitioner/practitioner-id"
}
]
}
External References
{
"resourceType": "Observation",
"subject": {
"reference": "https://external-system.com/Patient/external-id",
"display": "John Smith"
}
}
Coding Systems
Common Coding Systems
- LOINC - Laboratory and clinical observations
- SNOMED CT - Clinical terminology
- ICD-10 - Disease classification
- CPT - Procedure codes
- RxNorm - Medication terminology
Using Codes
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "8480-6",
"display": "Systolic blood pressure"
}
],
"text": "Blood pressure"
},
"valueQuantity": {
"value": 120,
"unit": "mmHg",
"system": "http://unitsofmeasure.org",
"code": "mm[Hg]"
}
}
Best Practices
1. Use Standard Codes
Always use standard coding systems when possible to ensure interoperability.
2. Include Human-Readable Text
Provide both coded values and human-readable text for better usability.
3. Validate Data
Use FHIR validation tools to ensure your resources are valid.
4. Handle Missing Data
Use appropriate FHIR patterns for missing or unknown data.
5. Version Resources
Use versioning to track changes to resources over time.
Next Steps
- Learn about Charting workflows
- Explore Questionnaires & Assessments
- Understand Care Planning