PhysioMantra Hybrid Care: Architecture Pack
1. Current System: Online-Only Model
%%{init: {'themeVariables': { 'fontSize': '20px'}, 'flowchart': {'nodeSpacing': 50, 'rankSpacing': 50}}}%%
flowchart LR
subgraph Online_Workflow ["Online-Only Diagram"]
direction LR
P["PATIENT"]
D["DOCTOR"]
PLAT["PLATFORM"]
P -- "1. Books" --> PLAT
PLAT -- "2. Assigns" --> D
D -- "3. Video Consult" --> P
D -- "4. Digital Plan" --> PLAT
PLAT -- "5. Serve Content" --> P
P -- "6. Self-Execution" --> PLAT
end
2. Reconfigured System: Hybrid Model
%%{init: {'themeVariables': { 'fontSize': '20px'}, 'flowchart': {'nodeSpacing': 50, 'rankSpacing': 50}}}%%
flowchart LR
subgraph Hybrid_Workflow ["Hybrid Configuration"]
direction LR
P["PATIENT"]
D["DOCTOR"]
PLAT["PLATFORM"]
A["ASSISTANT (Proxy)"]
P -- "1. Books" --> PLAT
PLAT -- "2. Assigns" --> D
D -- "3. Prescribes Hybrid" --> PLAT
PLAT -- "4. Dispatches" --> A
A -- "5. Home Visit" --> P
A -- "6. Verifies & Logs" --> PLAT
PLAT -- "7. Updates" --> D
end
3. Current Workflow (Linear)
flowchart TD
Start["Patient Entry"] --> Book["Booking"]
Book --> Consult["Video Consult"]
Consult --> Plan["Care Plan Created"]
Plan --> Exec_Block["PATIENT EXECUTION"]
subgraph Independent_Execution ["Black Box"]
Exec_Block -- "Subjective" --> Watch["Watch Video"]
Watch -- "Unverified" --> Attempt["Attempt Exercise"]
Attempt -- "Inconsistent" --> Log["Log Results"]
end
Log --> Review["Doctor Review"]
4. Hybrid Workflow (Layered)
flowchart TD
Start["Patient Entry"] --> Book["Booking"]
Book --> Consult["Video Consult"]
Consult --> Plan["Care Plan Created"]
Plan -- "Config: Hybrid" --> Dispatch["Assign Assistant"]
subgraph Assisted_Execution ["Transparent Box"]
Dispatch --> Visit["Home Visit"]
Visit --> Supervise["Supervised Set"]
Supervise --> Correct["Tactile Correction"]
Correct --> Verify["Verified Log"]
end
Verify --> Review["Doctor Review"]
5. HLD: System Ecosystem
flowchart LR
subgraph Actors
Pat["Patient"]
Doc["Doctor (External)"]
Asst["Assistant (External)"]
end
subgraph Core_Platform ["PhysioMantra Core"]
Auth["Identity & Role"]
Booking["Booking Engine"]
Records["Care Records"]
end
subgraph Extensions ["Hybrid Extensions"]
Match["Geo-Matcher"]
Payout["Payout Splitter"]
end
Pat -- "Uses" --> Core_Platform
Doc -- "Uses" --> Core_Platform
Asst -- "Uses" --> Core_Platform
Core_Platform -- "Query" --> Extensions
Extensions -- "Result" --> Core_Platform
6. HLD: Unified Booking Flow
flowchart TD
Entry["Patient App"] --> Req["Request Consult"]
Req --> Video["Doctor Video Call"]
Video --> Decision{"Clinical Decision?"}
Decision -- "Standard" --> Online["Online Plan"]
Decision -- "Needs Help" --> Hybrid["Hybrid Plan"]
Hybrid --> Loc{"Check Location"}
Loc -- "Out of Range" --> Online
Loc -- "In Range" --> Match["Find Assistant"]
Match --> Confirm["Booking Confirmed"]
Confirm --> Pay["Payment Gate"]
7. HLD: Decision & Control Layer
flowchart TD
Input["Clinical Trigger"] --> Doc_Auth["Doctor Authority"]
Doc_Auth --> Rule1{"Is Hybrid Safe?"}
Rule1 -- "No" --> Reject["Force Online Only"]
Rule1 -- "Yes" --> Rule2{"Is Provider Available?"}
Rule2 -- "No Less Than 10km" --> Reject
Rule2 -- "Yes" --> Rule3{"Patient Consent?"}
Rule3 -- "No" --> Reject
Rule3 -- "Yes" --> Pricing["Pricing Engine"]
Pricing --> Check{"Price Accepted?"}
Check -- "Yes" --> Lock["Lock Configuration"]
Check -- "No" --> Neg["Negotiate / Re-Match"]
8. LLD: Provider Matching Logic
flowchart TD
Start["Request: Lat/Long"] --> DB["Provider DB"]
DB --> Geo{"Radius Less Than 10km?"}
Geo -- "No" --> Drop["Discard"]
Geo -- "Yes" --> List["Candidate Pool"]
List --> Rank{"Ranking Logic"}
Rank -- "1. Internal" --> Tier1["Tier 1 List"]
Rank -- "2. Top Rated" --> Tier2["Tier 2 List"]
Rank -- "3. Nearest" --> Tier3["Tier 3 List"]
Tier1 --> Merge["Final Sorted List"]
Tier2 --> Merge
Tier3 --> Merge
Merge --> Output["Present to Patient"]
9. LLD: Pricing Decision Flow
flowchart TD
Prov["Provider Profile"] --> Config{"Pricing Mode?"}
Config -- "Fixed (Staff)" --> Zone["Zone Based"]
Zone -- "Zone A" --> P1["Rs 1000"]
Zone -- "Zone B" --> P2["Rs 700"]
Config -- "Flex (Partner)" --> Range{"Within Band?"}
Range -- "Yes" --> Custom["Custom Price"]
Range -- "No" --> Cap["Cap at Max Allowed"]
P1 --> Final["Final Quote"]
P2 --> Final
Custom --> Final
Cap --> Final
10. LLD: Payment Sequence
sequenceDiagram
participant P as Patient
participant PF as Platform
participant A as Assistant
participant D as Doctor
P->>PF: Pay Full Amount (Hold)
PF->>A: Notify Job
A->>P: Perform Service
A->>PF: Upload Proof (Geo/Photo)
PF->>D: Request Sign-off
D->>PF: Approve Session
PF->>PF: Calculate Splits
PF->>A: Payout 70%
PF->>D: Payout 15%
PF->>PF: Retain 15%
11. LLD: Core Data Model
erDiagram
User ||--o{ Role : has
User {
string id
string name
string wallet_id
}
Role {
string id
enum type "DOC, PAT, ASST"
json attributes
}
ServiceArea {
string id
geography polygon
float radius
}
Appointment {
string id
enum mode "ONLINE, HYBRID"
string doctor_id
string assistant_id
status state
}
Transaction {
string id
float total
json split_rule
status state
}
Role ||--o{ ServiceArea : defines
Role ||--o{ Appointment : connects
Appointment ||--o{ Transaction : creates
12. LLD: Failure & Edge Case Flow
flowchart TD
State["Active Job"] --> Issue{"Issue Detected?"}
Issue -- "No Show" --> Refund["Auto-Refund Patient"]
Refund --> Penalize["Strike Provider Record"]
Issue -- "Bad Quality" --> Dispute["Hold Payout"]
Dispute --> Manual["Admin Review"]
Issue -- "Clinical Risk" --> Abort["Abort Session"]
Abort --> Notify["Alert Doctor"]
Notify --> Convert["Convert to Online"]