clinical_triage_tools.pyā¢1.85 kB
class ClinicalTriageTools:
def check_symptoms(self, symptoms: list) -> dict:
"""
Check symptoms against a basic medical database (simulated).
Returns risk level and matched conditions.
"""
# Dummy logic for demonstration
if 'chest pain' in symptoms or 'shortness of breath' in symptoms:
return {'risk': 'HIGH', 'matched_conditions': ['cardiac event']}
elif 'fever' in symptoms and 'cough' in symptoms:
return {'risk': 'MEDIUM', 'matched_conditions': ['respiratory infection']}
else:
return {'risk': 'LOW', 'matched_conditions': []}
def classify_risk(self, vitals: dict) -> dict:
"""
Classify patient risk level based on vitals (simulated logic).
"""
bp = vitals.get('bp', '120/80')
hr = vitals.get('heart_rate', 70)
if bp == '140/90' or hr > 100:
return {'risk_level': 'MEDIUM'}
elif hr > 120:
return {'risk_level': 'HIGH'}
else:
return {'risk_level': 'LOW'}
def score_triage_priority(self, risk: str, symptoms: list) -> dict:
"""
Score triage priority for ER based on risk and symptoms.
"""
if risk == 'HIGH' or 'chest pain' in symptoms:
return {'priority': 'Immediate'}
elif risk == 'MEDIUM':
return {'priority': 'Urgent'}
else:
return {'priority': 'Routine'}
def generate_doctor_note(self, patient_data: dict) -> dict:
"""
Generate a doctor note from structured patient data.
"""
name = patient_data.get('name', 'Patient')
symptoms = ', '.join(patient_data.get('symptoms', []))
note = f"{name} presents with {symptoms}. Vitals: {patient_data.get('vitals', {})}"
return {'note': note}