Healthcare Template

Four-agent emergency triage pipeline — vital signs capture, HIPAA-compliant EMR retrieval, ESI-based triage, and hospital resource allocation.

From patient arrival to bed assignment in four coordinated agents — with built-in HIPAA-compliant data handling and safety red-flag detection at every step.

From patient arrival to bed assignment in four coordinated agents — with built-in HIPAA-compliant data handling and safety red-flag detection at every step.

python
from examples.cookbooks.Industry_Templates.healthcare_template import emergency_triage_workflow

result = emergency_triage_workflow("Patient arrival: chest pain, BP 180/110, SpO2 94%")
print(result)

The user describes a patient presentation; agents triage vitals, suggest orders, and assign bed priority.

Diagram

Emergency Triage Workflow

🏥 Patient Monitor

🤖 VitalSignsCapture

🤖 EMRRetrieval

🤖 TriageRecommendation

🤖 ResourceAllocator

✅ Clinician

Quick Start

  1. Run the prebuilt triage workflow
    python
    from praisonaiagents import Agent, tool
    from examples.cookbooks.Industry_Templates.healthcare_template import emergency_triage_workflow
    
    result = emergency_triage_workflow(
        patient_id="PT-2024-00123",
        chief_complaint="severe chest pain radiating to left arm"
    )
    
    print(result["clinical_pathway"])
    print(result["safety_checks"])
  2. Add a specialised coordinator for labs or radiology
    python
    from examples.cookbooks.Industry_Templates.healthcare_template import (
        HealthcareCoordinationPatterns, TriageLevel
    )
    
    lab_agent = HealthcareCoordinationPatterns.coordinate_lab_orders(
        patient_id="PT-2024-00123",
        triage_level=TriageLevel.EMERGENT.value
    )
    
    lab_result = lab_agent.start("Order STAT troponin and CBC")
    print(lab_result)

How It Works

Diagram
ClinicianResourceAllocatorTriageRecommendationEMRRetrievalVitalSignsCapture“Patient Monitor”ClinicianResourceAllocatorTriageRecommendationEMRRetrievalVitalSignsCapture“Patient Monitor”Sensor readingsVitalSigns schemaMedicalHistory schemaTriageAssessment schemaResourceAllocation schema
AgentResponsibilitySLA
VitalSignsCaptureCapture vital signs from monitoring devices with HIPAA handling≤ 30 s
EMRRetrievalRetrieve patient EMR with consent verification and audit trail≤ 5 s
TriageRecommendationESI-based triage assessment with red-flag detection≤ 1 min
ResourceAllocatorAssign bed, staff, and equipment by priority score≤ 30 s

Configuration Options

Pydantic I/O schemas used by this template:

SchemaKey Fields
VitalSignspatient_id, heart_rate, blood_pressure_systolic, blood_pressure_diastolic, respiratory_rate, temperature, oxygen_saturation, pain_scale, consciousness_level
MedicalHistorypatient_id, allergies, chronic_conditions, current_medications, recent_visits, insurance_status
TriageAssessmentassessment_id, patient_id, triage_level, chief_complaint, recommended_department, estimated_wait_time, required_resources, red_flags
ResourceAllocationallocation_id, patient_id, assigned_bed, assigned_staff, equipment_needed, department, priority_score

Triage Levels (ESI standard)

LevelValueMeaning
11_resuscitationImmediate life-saving intervention
22_emergentHigh risk, severe pain or distress
33_urgentStable but multiple resources needed
44_less_urgentStable, one resource needed
55_non_urgentStable, no resources needed

Common Patterns

Audit every EMR access for HIPAA compliance

python
from examples.cookbooks.Industry_Templates.healthcare_template import HIPAACompliancePatterns

audit = HIPAACompliancePatterns.audit_log_access(
    user_id="DR-001",
    patient_id="PT-2024-00123",
    action="EMR_ACCESS",
    reason="emergency_triage"
)
print(audit)

Anonymise data before sending to analytics

python
from examples.cookbooks.Industry_Templates.healthcare_template import HIPAACompliancePatterns

raw_triage = {
    "patient_id": "PT-123",
    "triage_level": "2_emergent",
    "department": "emergency",
    "wait_time": 10
}
safe_data = HIPAACompliancePatterns.anonymize_patient_data(raw_triage)
print(safe_data)

Coordinate radiology for an urgent patient

python
from examples.cookbooks.Industry_Templates.healthcare_template import HealthcareCoordinationPatterns

radiology = HealthcareCoordinationPatterns.coordinate_radiology(
    patient_id="PT-2024-00123",
    imaging_type="chest_xray"
)
schedule = radiology.start("Book urgent chest X-ray, check for contrast allergy")
print(schedule)

Best Practices

Verify patient consent before EMR access

EMRRetrieval accepts consent_verified=True. In production, gate this on an explicit consent check from your registration system — never assume consent for new patients.

Treat fallback triage as ESI-3 (Urgent)

If TriageRecommendation fails, the built-in fallback defaults to 3_urgent. This is a conservative choice — always escalate to a human nurse when the AI pipeline cannot complete.

Alert on clinical red flags immediately

TriageAssessment.red_flags is populated when vital signs suggest life-threatening conditions (e.g. low_oxygen, altered_consciousness). Wire these to your nurse-call or PA system with zero delay.

Log all resource allocations for audit

ResourceAllocator returns allocation_id and assigned_staff. Persist every allocation to your incident tracking system to satisfy accreditation and shift-handover requirements.


Related