Spaces:
Running
Running
flowchart TB | |
%% Стилізація | |
classDef new fill:#fff3e0,stroke:#ff9800,stroke-width:3px | |
classDef existing fill:#e3f2fd,stroke:#2196f3,stroke-width:2px | |
classDef critical fill:#ffebee,stroke:#f44336,stroke-width:3px | |
classDef success fill:#e8f5e9,stroke:#4caf50,stroke-width:2px | |
Start([Повідомлення пацієнта]) | |
Start --> L0_Check | |
Start --> L1_Medical | |
Start --> MRE | |
%% MRE | |
MRE["MRE"]:::existing | |
MRE --> |"MRE Response"|Medical_Flow | |
%% Level 0 Decision Block | |
L0_Check["LLM Lifestyle Detector"]:::new | |
%% L0_Check -->|"❌ NO<br/>Medical/Undefined"| L1_Medical | |
L0_Check -->|"✅ YES/ ❌ NO<br/>Lifestyle Trigger"| Post_Check | |
%% L0_Check -->|"⚠️ MIXED<br/>Symptoms + Lifestyle"| L1_Mixed | |
%% %% Safety Pre-check for Lifestyle | |
%% Safety_Pre{"Quick Safety<br/>Check"}:::critical | |
%% Safety_Pre -->|"Red flags"| L1_Medical | |
%% Safety_Pre -->|"Safe"| Lifestyle_Mode | |
%% Medical Path (Level 1) | |
L1_Medical["LLM First prompt <br/>(Suggested message + Escalation)"]:::existing | |
L1_Medical -->|"Suggested message"| Medical_Flow | |
L1_Medical -->|"🚨 ESCALATION=TRUE/FALSE"| Post_Check | |
%% Mixed Path (Level 1) | |
%% L1_Mixed{"Level 1<br/>Symptom Assessment<br/>[EXISTING]"}:::existing | |
%% L1_Mixed -->|"🚨 URGENT"| Provider_Alert | |
%% L1_Mixed -->|"✅ NON-URGENT"| Lifestyle_After_Clear | |
%% Provider Escalation | |
%% Provider_Alert["🚨 PROVIDER ALERT<br/>Urgent Response"]:::critical | |
%% Provider_Alert --> End_Medical | |
%% Post Level 1 Check | |
Post_Check{"Lifestyle<br/>Need and Possible?"}:::new | |
Post_Check -->|"NO"| Medical_Flow | |
Post_Check -->|"YES"| Lifestyle_Mode | |
%% Medical Flow | |
Medical_Flow["LLM Second Prompt<br/>Recheck MRE"]:::existing | |
Medical_Flow --> End_Medical | |
%% Lifestyle After Medical Clearance | |
%% Lifestyle_After_Clear["✅ Medical Cleared<br/>Safe for Lifestyle"]:::success | |
%% Lifestyle_After_Clear --> Lifestyle_Mode | |
%% Lifestyle Mode Activation | |
Lifestyle_Mode["🌟 LIFESTYLE MODE ACTIVE"]:::new | |
Lifestyle_Mode --> Load_Profile | |
Load_Profile["📊 Load Full<br/>Patient Profile"]:::new | |
Load_Profile --> Lifestyle_LLM | |
Lifestyle_LLM["💚 Lifestyle LLM<br/>Coaching Response"]:::new | |
Lifestyle_LLM --> Update_Profile | |
Update_Profile["🔄 Update Profile<br/>Track Progress"]:::new | |
Update_Profile --> Session_Check | |
Session_Check{"Continue<br/>Session?"}:::new | |
Session_Check -->|"YES"| Lifestyle_LLM | |
Session_Check -->|"NO"| End_Session | |
End_Session["Session End<br/>✅ CE Re-enabled"]:::new | |
End_Session --> End_Lifestyle | |
%% End Points | |
End_Medical[["LLM Response<br/>to Patient"]]:::existing | |
End_Lifestyle[["Lifestyle Response<br/>to Patient"]]:::success | |