Clinical Features Support
Purpose: How the new schema supports key clinical capabilities
Overview
The new schema architecture supports four major clinical capabilities:
- Longitudinal Health Record (LHR) - Complete patient health history
- Episode of Care - Treatment program management
- Coordinated Care - Multi-practitioner collaboration
- AI-Assisted Care - Clinical decision support and research
Longitudinal Health Record (LHR)
Design Philosophy
The LHR is NOT stored as a table. It is a computed view aggregated on demand from FHIR-aligned clinical resources. This approach:
- Avoids data duplication
- Ensures real-time accuracy
- Follows FHIR aggregation patterns
- Simplifies data governance
LHR Components
LHR (Computed)
├── Demographics
│ └── clinical.patients
│
├── Problem List
│ └── clinical.conditions
│ (clinical_status: active, category: problem_list_item)
│
├── Active Medications
│ └── clinical.medication_requests
│ (status: active)
│
├── Allergies
│ └── clinical.allergy_intolerances
│ (clinical_status: active)
│
├── Vitals History
│ └── clinical.observations
│ (category: vital_signs, last 90 days)
│
├── Lab Results
│ └── clinical.observations + clinical.diagnostic_reports
│ (category: laboratory)
│
├── Immunizations
│ └── clinical.observations
│ (category: immunization) or dedicated table
│
├── Care Plans
│ └── clinical.care_plans
│ (status: active)
│
├── Goals
│ └── clinical.goals
│ (lifecycle_status: active)
│
└── Encounter History
└── clinical.encounters
(grouped by clinical.episodes_of_care)LHR Aggregation Query Pattern
SELECT patient.*,
(SELECT json_agg(c) FROM conditions c
WHERE c.patient_id = patient.id
AND c.clinical_status = 'active') as problem_list,
(SELECT json_agg(m) FROM medication_requests m
WHERE m.patient_id = patient.id
AND m.status = 'active') as active_medications,
(SELECT json_agg(a) FROM allergy_intolerances a
WHERE a.patient_id = patient.id
AND a.clinical_status = 'active') as allergies,
(SELECT json_agg(o) FROM observations o
WHERE o.patient_id = patient.id
AND o.category = 'vital_signs'
ORDER BY o.effective_date DESC
LIMIT 10) as recent_vitals,
(SELECT json_agg(e) FROM encounters e
WHERE e.patient_id = patient.id
ORDER BY e.period_start DESC) as encounter_history
FROM patients patient
WHERE patient.id = :patient_idHealth Scoring
The LHR can compute health scores based on:
| Factor | Weight | Data Source |
|---|---|---|
| Chronic conditions | 20% | conditions (active) |
| Medication adherence | 15% | medication_requests |
| Vital trends | 20% | observations (vital_signs) |
| Lab results | 20% | observations (laboratory) |
| Care plan compliance | 15% | goals (achievement_status) |
| Preventive care | 10% | observations (immunization) |
Reference Documentation
See Clinical Data Hierarchy for the complete hierarchy specification.
Episode of Care
Design Philosophy
Episodes of Care represent treatment programs that span multiple encounters. They are essential for:
- Chronic disease management
- Rehabilitation programs
- Mental health treatment
- Oncology care
- Maternity care
Episode Structure
Episode of Care
├── Managing Practitioner
├── Diagnosis (primary condition)
├── Treatment Goals
│ ├── Goal 1 (e.g., "HbA1c < 7%")
│ ├── Goal 2 (e.g., "Weight loss 5kg")
│ └── Goal 3 (e.g., "Blood pressure controlled")
├── Progress Notes
│ ├── Note 1 (Week 1 assessment)
│ ├── Note 2 (Week 4 progress)
│ └── Note 3 (Week 8 review)
└── Encounters (sessions)
├── Encounter 1 (Initial consultation)
├── Encounter 2 (Follow-up)
├── Encounter 3 (Therapy session)
└── ...Episode Types
| Type | Use Case | Typical Duration |
|---|---|---|
rehabilitation | Post-surgical recovery, injury rehab | 6-12 weeks |
chronic_care | Diabetes, hypertension management | Ongoing |
mental_health | Therapy, psychiatric treatment | 3-12 months |
maternity | Pregnancy through postpartum | 9-12 months |
oncology | Cancer treatment program | Variable |
preventive | Wellness programs | Variable |
acute | Acute illness episodes | Days to weeks |
Episode Status Lifecycle
planned
↓
waitlist (optional)
↓
active ←→ onhold
↓
finished or cancelledGoal Tracking Within Episodes
Goals in an episode can be:
-
Treatment Goals (
clinical.treatment_goals)- Linked directly to episode
- Track progress across encounters
-
Patient Goals (
clinical.goals)- FHIR Goal resource
- Can be linked to care plans
- Achievement status tracking
Encounter Grouping
Encounters can be:
- Within Episode:
encounter.episode_of_care_idis set - Standalone:
encounter.episode_of_care_idis null (one-off visits)
Reference Documentation
See Episode of Care for detailed design.
Coordinated Care
Multi-Practitioner Encounters
The schema supports multiple practitioners participating in a single encounter through clinical.encounter_participants.
Participant Roles
| Role | Description | Example |
|---|---|---|
primary | Attending/primary practitioner | Consulting physician |
consultant | Consulting specialist | Cardiologist on referral |
assistant | Assisting practitioner | Resident, nurse |
observer | Observing (training, audit) | Medical student |
Multi-Practitioner Scenarios
-
Specialist Consultation
- Primary: General physician
- Consultant: Specialist called for opinion
-
Surgical Team
- Primary: Lead surgeon
- Assistants: Assisting surgeons, anesthesiologist
-
Therapy Session with Supervisor
- Primary: Therapist
- Observer: Supervising psychologist
-
Teaching Hospital
- Primary: Attending physician
- Observers: Residents, medical students
Care Team Composition
For ongoing care coordination, the schema supports:
Patient
├── Primary Care Provider (PCP)
│ └── identity.practitioner_roles (is_primary: true)
│
├── Care Team
│ └── clinical.care_plans (activities with performers)
│
└── Episode-Specific Team
└── clinical.episodes_of_care (managing_practitioner_id)
└── clinical.encounters (participants)Referral Workflows
Referrals are modeled using clinical.service_requests:
Service Request (category: referral)
├── requester_id: Referring practitioner
├── performer_id: Target practitioner (if known)
├── code: Referral type/specialty
├── reason_code: Clinical reason
└── status: draft → active → completedCross-Facility Patient Records
Patients can receive care at multiple facilities within a tenant:
Patient
└── patient_facilities (junction table)
├── Facility A (is_primary: true)
├── Facility B
└── Facility CEach facility maintains its own:
- MRN (facility_mrn)
- Registration date
- Active status
Reference Documentation
See Multi-Practitioner Encounter Types for complete specifications.
AI-Assisted Care
Overview
The schema supports AI-assisted care through:
- AI Scribe - Transcription and documentation assistance
- Clinical Decision Support (CDS) - AI-generated suggestions
- Research Analytics - De-identified data for research
AI Scribe Integration
Encounter
└── Transcription Session
├── Raw audio (stored externally)
├── Raw transcript
├── Processed transcript (speaker-separated)
└── AI Suggestions (generated from transcript)Transcription Session States
recording → processing → completed
↘ failedProcessed Transcript Structure
{
"segments": [
{
"speaker": "practitioner",
"start_time": 0.0,
"end_time": 5.5,
"text": "How are you feeling today?",
"confidence": 0.95
},
{
"speaker": "patient",
"start_time": 6.0,
"end_time": 12.0,
"text": "I have been experiencing headaches.",
"confidence": 0.92
}
],
"summary": "Patient presents with chief complaint of headaches...",
"entities": {
"symptoms": ["headache"],
"duration": "not specified",
"severity": "not specified"
}
}Clinical Decision Support (CDS)
AI suggestions are generated based on:
- Transcription content
- Patient history (LHR)
- Clinical guidelines (via RAG)
Suggestion Types
| Type | Description | Creates |
|---|---|---|
diagnosis | Suggested diagnosis | Condition |
medication | Suggested prescription | MedicationRequest |
order | Suggested lab/imaging | ServiceRequest |
observation | Extracted vital/finding | Observation |
care_plan | Suggested care plan | CarePlan |
goal | Suggested patient goal | Goal |
Suggestion Workflow
AI generates suggestion (pending)
↓
Practitioner reviews
↓
┌────┴────┐
↓ ↓
accepted rejected
↓
modified (optional)
↓
Clinical resource createdSuggestion-to-Resource Linking
When a suggestion is accepted:
AiSuggestion
├── status: accepted
├── reviewed_by_id: practitioner
├── reviewed_at: timestamp
├── created_resource_type: "Condition"
└── created_resource_id: uuid → links to clinical.conditionsAI Audit Trail
All AI operations are logged in audit.llm_call_logs:
LLM Call Log
├── Provider: openai/anthropic/google
├── Model: gpt-4/claude-3/gemini
├── Call Type: transcription/suggestion/summary
├── Input Tokens / Output Tokens
├── Latency
├── Confidence Score
├── Status: success/error
└── Moderation Flags (safety checks)Important: PHI is NOT stored in LLM logs. Only:
- Token counts
- Hashed inputs
- Summarized outputs (de-identified)
- Metadata
Research Analytics Support
For research purposes, the schema supports:
-
De-identification
- Patient identifiers removed
- Dates shifted
- Rare conditions generalized
-
Cohort Queries
- Query across conditions, medications, observations
- Aggregate statistics
-
Outcome Tracking
- Goal achievement rates
- Treatment effectiveness
- AI suggestion acceptance rates
AI Configuration
AI settings are stored per facility in identity.facility_ai_settings:
Facility AI Settings
├── ai_provider: openai/anthropic/google
├── ai_model: specific model
├── is_enabled: true/false
├── suggestions_enabled: true/false
├── confidence_threshold: 0.75
├── language: en/hi/ar
└── medical_terminology_enabled: true/falseSchema Entities Summary
| Feature | Primary Entities |
|---|---|
| LHR | patients, conditions, observations, medication_requests, allergy_intolerances, care_plans, goals |
| Episode of Care | episodes_of_care, treatment_goals, progress_notes, encounters |
| Coordinated Care | encounter_participants, service_requests, patient_facilities |
| AI-Assisted Care | transcription_sessions, ai_suggestions, llm_call_logs, facility_ai_settings |
FHIR Alignment
All clinical features align with FHIR R4:
| Feature | FHIR Resources |
|---|---|
| LHR | Patient + aggregated resources |
| Episode of Care | EpisodeOfCare |
| Encounters | Encounter + Encounter.participant |
| Goals | Goal |
| Care Plans | CarePlan |
| AI Suggestions | N/A (platform-specific) |