# rasool-muhiddin/care_path architecture

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

- Interactive diagram: https://gitdiagram.com/rasool-muhiddin/care_path
- Repository: https://github.com/rasool-muhiddin/care_path

## Overview

Axon is a care-coordination product: patients, doctors, and engineers work around a therapeutic device. The principal workflow is case management and device assignment, followed by treatment-session and attack tracking, with role-based chat and push notifications supporting care. The README also names app updates and a Flutter client, but the client source is absent from this tree. Edges between unsampled API handlers and domain services are omitted; dashed edges indicate the documented but unverified client/API interaction.

Main entry points: [`cases/models.py`](https://github.com/rasool-muhiddin/care_path/blob/main/cases/models.py) (Cases and attacks), [`treatments/models.py`](https://github.com/rasool-muhiddin/care_path/blob/main/treatments/models.py) (Treatment sessions), [`chat/models.py`](https://github.com/rasool-muhiddin/care_path/blob/main/chat/models.py) (Messages), [`devices/models.py`](https://github.com/rasool-muhiddin/care_path/blob/main/devices/models.py) (Clinics and devices)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_accounts_api["Account API<br/>[views.py]"]
  node_case_api["Case API<br/>[views.py]"]
  node_devices_api["Device API<br/>[views.py]"]
  node_treatment_api["Treatment API<br/>[views.py]"]
  node_chat_api["Chat API<br/>[views.py]"]
end

subgraph group_care["Care records"]
  node_identity["Accounts and roles<br/>[models.py]"]
  node_cases["Cases and attacks<br/>[models.py]"]
  node_sessions["Treatment sessions<br/>[models.py]"]
end

subgraph group_operations["Device operations"]
  node_device_inventory["Clinics and devices<br/>[models.py]"]
end

subgraph group_communication["Communication"]
  node_messages["Messages<br/>[models.py]"]
  node_voice_storage["Voice-note storage<br/>[voice.py]"]
  node_push_service["Push service<br/>[services.py]"]
  node_push_tokens["Device tokens<br/>[models.py]"]
  node_firebase["Firebase messaging<br/>[firebase.py]"]
end

subgraph group_platform["Client and updates"]
  node_client["Flutter app"]
  node_updates_api["App updates API<br/>[views.py]"]
  node_updates["App update records<br/>[models.py]"]
end

node_patient(("Patient"))
node_clinician(("Doctor / engineer"))
node_database[("PostgreSQL")]

node_patient -.->|"uses"| node_client
node_clinician -.->|"uses"| node_client
node_client -.->|"requests"| node_accounts_api
node_client -.->|"manages cases"| node_case_api
node_client -.->|"manages devices"| node_devices_api
node_client -.->|"records sessions"| node_treatment_api
node_client -.->|"sends messages"| node_chat_api
node_client -.->|"checks updates"| node_updates_api
node_case_api -.->|"manages"| node_cases
node_devices_api -.->|"manages"| node_device_inventory
node_treatment_api -.->|"manages"| node_sessions
node_chat_api -.->|"manages"| node_messages
node_accounts_api -.->|"manages"| node_identity
node_cases -->|"references device"| node_device_inventory
node_sessions -->|"references case"| node_cases
node_sessions -->|"references device"| node_device_inventory
node_messages -->|"belongs to case"| node_cases
node_messages -->|"stores voice notes"| node_voice_storage
node_push_service -->|"reads tokens"| node_push_tokens
node_push_service -->|"sends multicast"| node_firebase
node_updates_api -.->|"serves update data"| node_updates
node_identity -.->|"persists"| node_database
node_cases -.->|"persists"| node_database
node_device_inventory -.->|"persists"| node_database
node_sessions -.->|"persists"| node_database
node_messages -.->|"persists"| node_database
node_push_tokens -.->|"persists"| node_database
node_updates -.->|"persists"| node_database

click node_accounts_api "https://github.com/rasool-muhiddin/care_path/blob/main/accounts/views.py"
click node_identity "https://github.com/rasool-muhiddin/care_path/blob/main/accounts/models.py"
click node_case_api "https://github.com/rasool-muhiddin/care_path/blob/main/cases/views.py"
click node_cases "https://github.com/rasool-muhiddin/care_path/blob/main/cases/models.py"
click node_devices_api "https://github.com/rasool-muhiddin/care_path/blob/main/devices/views.py"
click node_device_inventory "https://github.com/rasool-muhiddin/care_path/blob/main/devices/models.py"
click node_treatment_api "https://github.com/rasool-muhiddin/care_path/blob/main/treatments/views.py"
click node_sessions "https://github.com/rasool-muhiddin/care_path/blob/main/treatments/models.py"
click node_chat_api "https://github.com/rasool-muhiddin/care_path/blob/main/chat/views.py"
click node_messages "https://github.com/rasool-muhiddin/care_path/blob/main/chat/models.py"
click node_voice_storage "https://github.com/rasool-muhiddin/care_path/blob/main/chat/voice.py"
click node_push_service "https://github.com/rasool-muhiddin/care_path/blob/main/notifications/services.py"
click node_push_tokens "https://github.com/rasool-muhiddin/care_path/blob/main/notifications/models.py"
click node_firebase "https://github.com/rasool-muhiddin/care_path/blob/main/notifications/firebase.py"
click node_updates_api "https://github.com/rasool-muhiddin/care_path/blob/main/app_updates/views.py"
click node_updates "https://github.com/rasool-muhiddin/care_path/blob/main/app_updates/models.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_accounts_api,node_case_api,node_devices_api,node_treatment_api,node_chat_api toneBlue
class node_identity,node_cases,node_sessions,node_database toneAmber
class node_device_inventory toneMint
class node_messages,node_voice_storage,node_push_service,node_push_tokens,node_firebase toneRose
class node_client,node_updates_api,node_updates,node_patient,node_clinician toneIndigo
```

## Components

### REST API

- [Account API](https://github.com/rasool-muhiddin/care_path/blob/main/accounts/views.py): `accounts/views.py`
- [Case API](https://github.com/rasool-muhiddin/care_path/blob/main/cases/views.py): `cases/views.py`
- [Device API](https://github.com/rasool-muhiddin/care_path/blob/main/devices/views.py): `devices/views.py`
- [Treatment API](https://github.com/rasool-muhiddin/care_path/blob/main/treatments/views.py): `treatments/views.py`
- [Chat API](https://github.com/rasool-muhiddin/care_path/blob/main/chat/views.py): `chat/views.py`

### Care records

- [Accounts and roles](https://github.com/rasool-muhiddin/care_path/blob/main/accounts/models.py): `accounts/models.py`
- [Cases and attacks](https://github.com/rasool-muhiddin/care_path/blob/main/cases/models.py): `cases/models.py`
- [Treatment sessions](https://github.com/rasool-muhiddin/care_path/blob/main/treatments/models.py): `treatments/models.py`

### Device operations

- [Clinics and devices](https://github.com/rasool-muhiddin/care_path/blob/main/devices/models.py): `devices/models.py`

### Communication

- [Messages](https://github.com/rasool-muhiddin/care_path/blob/main/chat/models.py): `chat/models.py`
- [Voice-note storage](https://github.com/rasool-muhiddin/care_path/blob/main/chat/voice.py): `chat/voice.py`
- [Push service](https://github.com/rasool-muhiddin/care_path/blob/main/notifications/services.py): `notifications/services.py`
- [Device tokens](https://github.com/rasool-muhiddin/care_path/blob/main/notifications/models.py): `notifications/models.py`
- [Firebase messaging](https://github.com/rasool-muhiddin/care_path/blob/main/notifications/firebase.py): `notifications/firebase.py`

### Client and updates

- **Flutter app**
- [App updates API](https://github.com/rasool-muhiddin/care_path/blob/main/app_updates/views.py): `app_updates/views.py`
- [App update records](https://github.com/rasool-muhiddin/care_path/blob/main/app_updates/models.py): `app_updates/models.py`

### Other components

- **Patient**
- **Doctor / engineer**
- **PostgreSQL**

## Connections

- Patient → Flutter app: uses
- Doctor / engineer → Flutter app: uses
- Flutter app → Account API: requests
- Flutter app → Case API: manages cases
- Flutter app → Device API: manages devices
- Flutter app → Treatment API: records sessions
- Flutter app → Chat API: sends messages
- Flutter app → App updates API: checks updates
- Case API → Cases and attacks: manages
- Device API → Clinics and devices: manages
- Treatment API → Treatment sessions: manages
- Chat API → Messages: manages
- Account API → Accounts and roles: manages
- Cases and attacks → Clinics and devices: references device (evidence: `cases/models.py`)
- Treatment sessions → Cases and attacks: references case (evidence: `treatments/models.py`)
- Treatment sessions → Clinics and devices: references device (evidence: `treatments/models.py`)
- Messages → Cases and attacks: belongs to case (evidence: `chat/models.py`)
- Messages → Voice-note storage: stores voice notes (evidence: `chat/models.py`)
- Push service → Device tokens: reads tokens (evidence: `notifications/services.py`)
- Push service → Firebase messaging: sends multicast (evidence: `notifications/services.py`)
- App updates API → App update records: serves update data
- Accounts and roles → PostgreSQL: persists
- Cases and attacks → PostgreSQL: persists
- Clinics and devices → PostgreSQL: persists
- Treatment sessions → PostgreSQL: persists
- Messages → PostgreSQL: persists
- Device tokens → PostgreSQL: persists
- App update records → PostgreSQL: persists
