feat: AI patient onboarding backend and documentation

This commit is contained in:
2026-08-27 12:15:09 +05:30
parent b9440772d1
commit 59c1372fe3
49 changed files with 4012 additions and 0 deletions
@@ -0,0 +1 @@
"""Specialties package initialization."""
@@ -0,0 +1,40 @@
CARDIOLOGY_CONFIG = {
"code": "cardiology",
"name": "Cardiology (Heart & BP)",
"purpose": (
"Collect cardiovascular symptoms, chest tightness / heavy chest (nenju adaipu), "
"palpitations, breathlessness on exertion, hypertension / BP history, "
"and cardiac medications common in India (Telma, Amlong, Ecosprin, Sorbitrate, Beta-blockers, Statins)."
),
"focus_areas": [
"Chest pain / tightness character (pressure, squeezing, burning vs acidity/gas)",
"Radiation (left arm, neck, jaw, back, shoulder)",
"Shortness of breath (especially while walking upstairs or lying flat / orthopnea)",
"Palpitations or missed heartbeats (nenju thudippu)",
"Swelling in feet / ankles (pedal edema)",
"Hypertension (BP) and Diabetes (Sugar) history and duration",
"Current cardiac medications (Telma 40/80, Amlodipine/Amlong, Ecosprin 75/150, Atorva/Rosuvas, Metoprolol/Concor, Sorbitrate)",
"Previous heart procedures (Angiogram, Angioplasty / Stent, Bypass / CABG, Pacemaker)",
"Tobacco, Bidi, Cigarette, Paan, Gutkha use or sedentary lifestyle",
],
"emergency_keywords": [
"crushing chest pain",
"pain radiating to left arm and jaw",
"severe sweating with chest tightness",
"collapsed",
"sudden loss of consciousness",
"cannot breathe",
"call 108",
"emergency ambulance",
],
"clarification_rules": [
"If the patient describes chest burning or heaviness, ask whether it is related to walking/exertion (angina) or happens after spicy/oily food (gastric acidity).",
"Ask if they are already taking regular BP tablets like Telma, Amlodipine, or daily blood thinners like Ecosprin.",
"Check if they have a history of previous heart stenting, bypass surgery, or family history of heart attacks at a young age.",
"If severe red-flag symptoms are present, immediately advise contacting 108 ambulance or visiting the nearest hospital emergency room.",
],
}
@@ -0,0 +1,36 @@
DIABETOLOGY_CONFIG = {
"code": "diabetology",
"name": "Diabetology & Endocrinology (Sugar / Diabetes)",
"purpose": (
"Collect comprehensive diabetes history, blood sugar control, "
"fasting/PPBS readings, HbA1c history, Indian dietary habits, and current anti-diabetic medications (Metformin, Glycomet, Insulin)."
),
"focus_areas": [
"Duration of diabetes (Type 1 / Type 2 / Gestational)",
"Recent blood sugar readings (Fasting, Post-Prandial / PPBS, HbA1c)",
"Current anti-diabetic medications (Glycomet, Metformin, Teneligliptin, Glimepiride, Janumet, Insulin injections)",
"Symptoms of high/low sugar (excessive thirst, frequent urination, dizziness, sweating, tingling feet / neuropathy)",
"Dietary patterns (rice intake, sweets, tea with sugar, fasting habits like Vrat/Upavasam)",
"Comorbidities common in India (Hypertension / BP, Thyroid, Fatty Liver, Cardiac history)",
],
"emergency_keywords": [
"severe hypoglycemia",
"sugar dropped below 50",
"unconscious",
"fainting with cold sweats",
"deep labored breathing",
"fruity breath",
"diabetic ketoacidosis",
"108 ambulance",
],
"clarification_rules": [
"If the patient mentions 'sugar' or 'chakkara noyu' or 'cheeni bimari', ask if they take tablets (like Glycomet) or insulin injections.",
"Ask about when they last checked their sugar level (Fasting or PPBS) and if they have HbA1c report.",
"Check if they experience burning or tingling sensations in their feet (diabetic neuropathy).",
"Check if they also take BP tablets (Telma, Amlodipine) or cholesterol tablets (Atorvastatin/Rosuvas).",
],
}
@@ -0,0 +1,33 @@
GENERAL_CONFIG = {
"code": "general",
"name": "General Physician & OPD Intake",
"purpose": (
"Collect primary reason for hospital OPD visit, fever patterns (dengue, malaria, viral, typhoid), "
"duration, severity, acidity / gastric issues, body pain, and existing chronic conditions (BP, Sugar, Thyroid)."
),
"focus_areas": [
"Chief complaint (fever, body ache, headache, cough, gastric pain, fatigue)",
"Fever character (continuous, with chills/shivering like malaria, with severe joint pain like chikungunya/dengue)",
"Digestive issues (acidity, indigestion, burning stomach, vomiting, loose stools)",
"Self-medication taken at home (Dolo 650, Paracetamol, Pan-D, Pantocid, Antacids, Cough syrups)",
"Existing conditions (BP, Sugar / Diabetes, Thyroid / Thyronorm, Asthma, Kidney / Liver)",
"Drug allergies (Penicillin, Sulfa, NSAIDs / Painkillers)",
],
"emergency_keywords": [
"fever with altered mental state",
"persistent vomiting with extreme weakness",
"severe bleeding",
"coughing up blood",
"very low blood pressure",
"108 ambulance",
],
"clarification_rules": [
"If the patient has fever, ask for how many days they have had it and if they took Dolo 650 or any home remedies.",
"Check if they have other family members with similar fever or illness.",
"Ask if they have any known drug allergies before doctor consultation.",
],
}
@@ -0,0 +1,32 @@
MENTAL_HEALTH_CONFIG = {
"code": "mental_health",
"name": "Mental Health",
"purpose": (
"Collect the patient's initial mental health "
"concerns and relevant background information."
),
"focus_areas": [
"reason_for_visit",
"mood",
"anxiety",
"sleep",
"stress",
"daily_functioning",
"duration",
"previous_treatment",
"medications",
"allergies",
],
"required_sections": [
"reason_for_visit",
"symptoms",
"medical_history",
"medications",
"allergies",
],
"safety_screening": True,
}
@@ -0,0 +1,18 @@
from app.specialties.cardiology import CARDIOLOGY_CONFIG
from app.specialties.diabetology import DIABETOLOGY_CONFIG
from app.specialties.general import GENERAL_CONFIG
from app.specialties.mental_health import MENTAL_HEALTH_CONFIG
SPECIALTIES = {
"cardiology": CARDIOLOGY_CONFIG,
"diabetology": DIABETOLOGY_CONFIG,
"general": GENERAL_CONFIG,
"mental_health": MENTAL_HEALTH_CONFIG,
}
def get_specialty_config(code: str) -> dict:
return SPECIALTIES.get(
code,
GENERAL_CONFIG,
)