# shanmukhasaiprakash/sevaro-workflow-companion architecture

> Architecture diagram of the GitHub repository shanmukhasaiprakash/sevaro-workflow-companion, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shanmukhasaiprakash/sevaro-workflow-companion
- Repository: https://github.com/shanmukhasaiprakash/sevaro-workflow-companion

## Overview

Workflow Companion is a hospital-specific tele-neurology API. A caselog event is evaluated against deterministic nudge rules and that hospital’s guide; providers can also ask a question routed to a guide field, check schedules or sign-off requirements, and record responses for audit insights. The reference panel is served by the API. Official-scenario scoring is a separate validation capability. Edges reflect the excerpts, SOURCE INDEX references, or README; unsampled API behavior is not inferred.

Main entry points: [`api.py`](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/api.py) (Workflow API), [`engine/guides.py`](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/guides.py) (Guide knowledge base), [`engine/nudges.py`](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/nudges.py) (Nudge engine), [`engine/answers.py`](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/answers.py) (Question answers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and panel"]
  node_api["Workflow API<br/>[api.py]"]
  node_panel["Reference panel<br/>[nudge_panel.html]"]
end

subgraph group_engine["Guidance engine"]
  node_guides["Guide knowledge base<br/>[guides.py]"]
  node_nudges["Nudge engine<br/>[nudges.py]"]
  node_answers["Question answers<br/>[answers.py]"]
  node_logic["Clinical interpretation<br/>[logic.py]"]
  node_schedule["Schedule parsing<br/>[schedule.py]"]
  node_llm["Optional field routing<br/>[llm.py]"]
end

subgraph group_data["Hospital data"]
  node_guide_data["Hospital guides"]
  node_rule_data["Nudge rules<br/>[nudge_rules.json]"]
end

subgraph group_audit["Audit and validation"]
  node_audit["Audit log and insights<br/>[audit.py]"]
  node_validation["Official validation<br/>[validate_sheet.py]"]
  node_testing["Scenario scoring<br/>[testing.py]"]
end

node_provider(("Caselog provider"))
node_azure["Azure OpenAI"]

node_provider -->|"sends requests"| node_api
node_api -->|"serves panel"| node_panel
node_api -->|"runs nudges"| node_nudges
node_api -->|"routes questions"| node_answers
node_api -->|"loads guide data"| node_guides
node_api -->|"logs actions"| node_audit
node_api -->|"uses schedule logic"| node_logic
node_api -->|"parses schedules"| node_schedule
node_nudges -->|"reads fields"| node_guides
node_nudges -->|"interprets fields"| node_logic
node_nudges -->|"evaluates windows"| node_schedule
node_answers -->|"routes by fields"| node_guides
node_answers -->|"interprets answers"| node_logic
node_answers -->|"requests field choice"| node_llm
node_llm -.->|"requests routing"| node_azure
node_logic -->|"uses guide values"| node_guides
node_logic -->|"evaluates availability"| node_schedule
node_guides -->|"loads guides"| node_guide_data
node_guides -->|"loads rules"| node_rule_data
node_validation -->|"runs scoring"| node_testing
node_testing -->|"checks answers"| node_answers
node_testing -->|"checks nudges"| node_nudges

click node_api "https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/api.py"
click node_panel "https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/static/nudge_panel.html"
click node_guides "https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/guides.py"
click node_nudges "https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/nudges.py"
click node_answers "https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/answers.py"
click node_logic "https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/logic.py"
click node_schedule "https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/schedule.py"
click node_llm "https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/llm.py"
click node_guide_data "https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/data/hospital_guides.json"
click node_rule_data "https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/data/nudge_rules.json"
click node_audit "https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/audit.py"
click node_validation "https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/validate_sheet.py"
click node_testing "https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/testing.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_panel toneBlue
class node_guides,node_nudges,node_answers,node_logic,node_schedule,node_llm toneAmber
class node_guide_data,node_rule_data toneMint
class node_audit,node_validation,node_testing toneRose
class node_provider,node_azure toneIndigo
```

## Components

### API and panel

- [Workflow API](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/api.py): `api.py`
- [Reference panel](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/static/nudge_panel.html): `static/nudge_panel.html`

### Guidance engine

- [Guide knowledge base](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/guides.py): `engine/guides.py`
- [Nudge engine](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/nudges.py): `engine/nudges.py`
- [Question answers](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/answers.py): `engine/answers.py`
- [Clinical interpretation](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/logic.py): `engine/logic.py`
- [Schedule parsing](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/schedule.py): `engine/schedule.py`
- [Optional field routing](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/llm.py): `engine/llm.py`

### Hospital data

- [Hospital guides](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/data/hospital_guides.json): `data/hospital_guides.json`
- [Nudge rules](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/data/nudge_rules.json): `data/nudge_rules.json`

### Audit and validation

- [Audit log and insights](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/audit.py): `engine/audit.py`
- [Official validation](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/validate_sheet.py): `validate_sheet.py`
- [Scenario scoring](https://github.com/shanmukhasaiprakash/sevaro-workflow-companion/blob/main/engine/testing.py): `engine/testing.py`

### Other components

- **Caselog provider**
- **Azure OpenAI**

## Connections

- Caselog provider → Workflow API: sends requests (evidence: `README.md`)
- Workflow API → Reference panel: serves panel (evidence: `api.py`)
- Workflow API → Nudge engine: runs nudges (evidence: `api.py`)
- Workflow API → Question answers: routes questions (evidence: `api.py`)
- Workflow API → Guide knowledge base: loads guide data (evidence: `api.py`)
- Workflow API → Audit log and insights: logs actions (evidence: `api.py`)
- Workflow API → Clinical interpretation: uses schedule logic (evidence: `api.py`)
- Workflow API → Schedule parsing: parses schedules (evidence: `api.py`)
- Nudge engine → Guide knowledge base: reads fields (evidence: `engine/nudges.py`)
- Nudge engine → Clinical interpretation: interprets fields (evidence: `engine/nudges.py`)
- Nudge engine → Schedule parsing: evaluates windows (evidence: `engine/nudges.py`)
- Question answers → Guide knowledge base: routes by fields (evidence: `engine/answers.py`)
- Question answers → Clinical interpretation: interprets answers (evidence: `engine/answers.py`)
- Question answers → Optional field routing: requests field choice (evidence: `engine/answers.py`)
- Optional field routing → Azure OpenAI: requests routing (evidence: `engine/llm.py`)
- Clinical interpretation → Guide knowledge base: uses guide values (evidence: `engine/logic.py`)
- Clinical interpretation → Schedule parsing: evaluates availability (evidence: `engine/logic.py`)
- Guide knowledge base → Hospital guides: loads guides (evidence: `engine/guides.py`)
- Guide knowledge base → Nudge rules: loads rules (evidence: `engine/guides.py`)
- Official validation → Scenario scoring: runs scoring (evidence: `validate_sheet.py`)
- Scenario scoring → Question answers: checks answers (evidence: `engine/testing.py`)
- Scenario scoring → Nudge engine: checks nudges (evidence: `engine/testing.py`)
