Spaces:
Running
Running
# test_patients.py - Test patient data for Testing Lab | |
from typing import Dict, Any, Tuple | |
class TestPatientData: | |
"""Class for managing test patient data""" | |
def get_patient_types() -> Dict[str, str]: | |
"""Returns available test patient types with descriptions""" | |
return { | |
"elderly": "👵 Elderly Mary (76 years old, complex comorbidity)", | |
"athlete": "🏃 Athletic John (24 роки, відновлення після травми)", | |
"pregnant": "🤰 Pregnant Sarah (28 років, вагітність з ускладненнями)" | |
} | |
def get_elderly_patient() -> Tuple[Dict[str, Any], Dict[str, Any]]: | |
"""Повертає дані для літнього пацієнта з множинними захворюваннями""" | |
clinical_data = { | |
"patient_summary": { | |
"active_problems": [ | |
"Essential hypertension (uncontrolled)", | |
"Type 2 diabetes mellitus with complications", | |
"Chronic kidney disease stage 3", | |
"Falls risk - history of 3 falls last year" | |
], | |
"current_medications": [ | |
"Amlodipine 10mg daily", | |
"Metformin 1000mg twice daily", | |
"Lisinopril 20mg daily", | |
"Furosemide 40mg daily" | |
], | |
"allergies": "Penicillin - rash, NSAIDs - GI upset" | |
}, | |
"vital_signs_and_measurements": [ | |
"Blood Pressure: 165/95 (last visit)", | |
"Weight: 78kg", | |
"BMI: 31.2 kg/m²" | |
], | |
"critical_alerts": [ | |
"High fall risk - requires mobility assessment", | |
"Uncontrolled hypertension and diabetes" | |
], | |
"assessment_and_plan": "76-year-old female with multiple cardiovascular risk factors and functional limitations." | |
} | |
lifestyle_data = { | |
"patient_name": "Mary", | |
"patient_age": "76", | |
"conditions": ["essential hypertension", "type 2 diabetes", "high fall risk"], | |
"primary_goal": "Improve mobility and independence while managing chronic conditions safely", | |
"exercise_preferences": ["chair exercises", "gentle walking"], | |
"exercise_limitations": [ | |
"High fall risk - balance issues", | |
"Limited endurance due to heart condition", | |
"Requires walking frame for mobility" | |
], | |
"dietary_notes": [ | |
"Diabetic diet - needs simple carb counting", | |
"Low sodium for hypertension" | |
], | |
"personal_preferences": [ | |
"very cautious due to fall anxiety", | |
"needs frequent encouragement" | |
], | |
"journey_summary": "Elderly patient with complex medical needs seeking to maintain independence.", | |
"last_session_summary": "", | |
"progress_metrics": { | |
"exercise_frequency": "0 times/week - afraid to move", | |
"fall_incidents": "3 in past 12 months" | |
} | |
} | |
return clinical_data, lifestyle_data | |
def get_athlete_patient() -> Tuple[Dict[str, Any], Dict[str, Any]]: | |
"""Повертає дані для спортсмена після травми""" | |
clinical_data = { | |
"patient_summary": { | |
"active_problems": [ | |
"ACL reconstruction recovery (3 months post-op)", | |
"Post-surgical knee pain and swelling", | |
"Anxiety related to return to sport" | |
], | |
"current_medications": [ | |
"Ibuprofen 400mg as needed for pain", | |
"Physiotherapy exercises daily" | |
], | |
"allergies": "No known drug allergies" | |
}, | |
"vital_signs_and_measurements": [ | |
"Blood Pressure: 118/72", | |
"Weight: 82kg (lost 3kg since surgery)", | |
"BMI: 24.0 kg/m²" | |
], | |
"critical_alerts": [ | |
"Do not exceed physiotherapy exercise guidelines", | |
"No pivoting or cutting movements until cleared" | |
], | |
"assessment_and_plan": "24-year-old male athlete 3 months post ACL reconstruction." | |
} | |
lifestyle_data = { | |
"patient_name": "John", | |
"patient_age": "24", | |
"conditions": ["ACL reconstruction recovery", "sports performance anxiety"], | |
"primary_goal": "Return to competitive football safely and regain pre-injury fitness", | |
"exercise_preferences": ["weight training", "swimming", "cycling"], | |
"exercise_limitations": [ | |
"No pivoting or cutting movements yet", | |
"Must follow physiotherapy protocol strictly" | |
], | |
"dietary_notes": [ | |
"High protein intake for muscle recovery", | |
"Anti-inflammatory foods" | |
], | |
"personal_preferences": [ | |
"highly motivated and goal-oriented", | |
"impatient with slow recovery process" | |
], | |
"journey_summary": "Motivated athlete recovering from major knee surgery.", | |
"last_session_summary": "", | |
"progress_metrics": { | |
"knee_flexion_range": "120 degrees (target: 135+)", | |
"return_to_sport_timeline": "3-4 months if progress continues" | |
} | |
} | |
return clinical_data, lifestyle_data | |
def get_pregnant_patient() -> Tuple[Dict[str, Any], Dict[str, Any]]: | |
"""Повертає дані для вагітної пацієнтки з ускладненнями""" | |
clinical_data = { | |
"patient_summary": { | |
"active_problems": [ | |
"Pregnancy 28 weeks gestation", | |
"Gestational diabetes mellitus (diet-controlled)", | |
"Pregnancy-induced hypertension (mild)" | |
], | |
"current_medications": [ | |
"Prenatal vitamins with iron", | |
"Additional iron supplement 65mg daily" | |
], | |
"allergies": "No known drug allergies" | |
}, | |
"vital_signs_and_measurements": [ | |
"Blood Pressure: 142/88 (elevated for pregnancy)", | |
"Current weight: 78kg", | |
"Weight gain: 10kg (appropriate)" | |
], | |
"critical_alerts": [ | |
"Monitor blood pressure - risk of preeclampsia", | |
"Avoid exercises lying flat on back after 20 weeks" | |
], | |
"assessment_and_plan": "28-year-old female, 28 weeks pregnant with gestational diabetes." | |
} | |
lifestyle_data = { | |
"patient_name": "Sarah", | |
"patient_age": "28", | |
"conditions": ["pregnancy 28 weeks", "gestational diabetes"], | |
"primary_goal": "Maintain healthy pregnancy with good blood sugar control", | |
"exercise_preferences": ["prenatal yoga", "walking", "swimming"], | |
"exercise_limitations": [ | |
"No lying flat on back after 20 weeks", | |
"Monitor heart rate - shouldn't exceed 140 bpm" | |
], | |
"dietary_notes": [ | |
"Gestational diabetes diet - controlled carbohydrates", | |
"Small frequent meals to manage blood sugar" | |
], | |
"personal_preferences": [ | |
"motivated to have healthy pregnancy", | |
"anxious about blood sugar control" | |
], | |
"journey_summary": "Second pregnancy with gestational diabetes.", | |
"last_session_summary": "", | |
"progress_metrics": { | |
"blood_glucose_control": "diet-controlled, monitoring 4x daily" | |
} | |
} | |
return clinical_data, lifestyle_data | |
def get_patient_data(cls, patient_type: str) -> Tuple[Dict[str, Any], Dict[str, Any]]: | |
"""Універсальний метод для отримання даних пацієнта за типом""" | |
if patient_type == "elderly": | |
return cls.get_elderly_patient() | |
elif patient_type == "athlete": | |
return cls.get_athlete_patient() | |
elif patient_type == "pregnant": | |
return cls.get_pregnant_patient() | |
else: | |
raise ValueError(f"Невідомий тип пацієнта: {patient_type}") |