# brainvoiceai-admin/avcri architecture

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

- Interactive diagram: https://gitdiagram.com/brainvoiceai-admin/avcri
- Repository: https://github.com/brainvoiceai-admin/avcri

## Overview

AVCRI is a Django-based AI resource-allocation system for patient therapy operations. The visible workflow is user access, patient/visit data and treatment preferences, then scheduling and room/therapist assignment, with rescheduling and nurse allocation supporting operational changes. The README is very brief; the tree and sampled source also indicate prescription/procurement, master data, and forecasting capabilities, retained as distinct branches. Several views and domain modules were not sampled, so undocumented connections are omitted.

Main entry points: [`Sheduling/models.py`](https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/models.py) (Schedule and bookings), [`authentication/views.py`](https://github.com/brainvoiceai-admin/avcri/blob/main/authentication/views.py) (Authentication and roles), [`predictor/forecast.py`](https://github.com/brainvoiceai-admin/avcri/blob/main/predictor/forecast.py) (Forecast generation), [`final_allocation.py`](https://github.com/brainvoiceai-admin/avcri/blob/main/final_allocation.py) (Schedule allocation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and identity"]
  node_auth["Authentication and roles<br/>[views.py]"]
  node_identity[("Role and module data<br/>[models.py]")]
end

subgraph group_clinical["Patient operations"]
  node_patient[("Patient records<br/>[models.py]")]
  node_externaldb[("Clinical source data<br/>[models.py]")]
  node_preferences["Therapist preferences"]
  node_prescriptions["Prescription workflows"]
  node_mysql_views["Imported-data interface<br/>[views.py]"]
end

subgraph group_allocation["Resource allocation"]
  node_booking[("Schedule and bookings<br/>[models.py]")]
  node_allocation_engine["Schedule allocation"]
  node_reschedule["Rescheduling<br/>[reshedule.py]"]
  node_nurse["Nurse allocation"]
  node_scheduler_views["Scheduling interface<br/>[views.py]"]
end

subgraph group_operations["Operational services"]
  node_masters[("Operational masters<br/>[models.py]")]
  node_procurement["Procurement workflows"]
  node_celery["Background task setup<br/>[celery.py]"]
  node_schedule_tasks["Reschedule tasks<br/>[tasks.py]"]
  node_forecast_tasks["Forecast tasks<br/>[tasks.py]"]
  node_api["Staff leave updates<br/>[api.py]"]
end

subgraph group_insight["Forecasting"]
  node_forecast["Forecast generation<br/>[forecast.py]"]
  node_forecast_data[("Forecast records<br/>[models.py]")]
  node_forecast_ui["Forecast interface<br/>[views.py]"]
end

node_user(("Staff user"))

node_user -->|"signs in"| node_auth
node_auth -->|"checks roles"| node_identity
node_auth -->|"manages patients"| node_patient
node_auth -->|"manages schedules"| node_booking
node_patient -->|"links visit data"| node_externaldb
node_preferences -->|"reallocates therapists"| node_allocation_engine
node_preferences -->|"updates bookings"| node_booking
node_scheduler_views -.->|"serves schedules"| node_booking
node_allocation_engine -.->|"writes assignments"| node_booking
node_allocation_engine -->|"checks resources"| node_masters
node_reschedule -.->|"reassigns bookings"| node_booking
node_reschedule -.->|"uses allocation logic"| node_allocation_engine
node_nurse -->|"reads nurse data"| node_masters
node_prescriptions -.->|"manages prescriptions"| node_booking
node_procurement -.->|"manages procurement"| node_booking
node_mysql_views -->|"reads imported data"| node_externaldb
node_forecast -->|"reads clinical history"| node_externaldb
node_forecast -->|"reads patient history"| node_patient
node_forecast -.->|"stores forecasts"| node_forecast_data
node_forecast_ui -.->|"serves forecasts"| node_forecast_data
node_schedule_tasks -->|"updates leave"| node_api
node_schedule_tasks -.->|"runs rescheduling"| node_reschedule
node_forecast_tasks -.->|"runs forecasts"| node_forecast
node_schedule_tasks -->|"uses task queue"| node_celery
node_forecast_tasks -->|"uses task queue"| node_celery

click node_auth "https://github.com/brainvoiceai-admin/avcri/blob/main/authentication/views.py"
click node_identity "https://github.com/brainvoiceai-admin/avcri/blob/main/authentication/models.py"
click node_patient "https://github.com/brainvoiceai-admin/avcri/blob/main/Patient/models.py"
click node_externaldb "https://github.com/brainvoiceai-admin/avcri/blob/main/MySql_Data_pull/models.py"
click node_preferences "https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/preference_views.py"
click node_masters "https://github.com/brainvoiceai-admin/avcri/blob/main/masters/models.py"
click node_booking "https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/models.py"
click node_allocation_engine "https://github.com/brainvoiceai-admin/avcri/blob/main/final_allocation.py"
click node_reschedule "https://github.com/brainvoiceai-admin/avcri/blob/main/reshedule.py"
click node_nurse "https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/nurse_allocation.py"
click node_scheduler_views "https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/views.py"
click node_prescriptions "https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/prescription_views.py"
click node_procurement "https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/procurement_views.py"
click node_forecast "https://github.com/brainvoiceai-admin/avcri/blob/main/predictor/forecast.py"
click node_forecast_data "https://github.com/brainvoiceai-admin/avcri/blob/main/predictor/models.py"
click node_forecast_ui "https://github.com/brainvoiceai-admin/avcri/blob/main/predictor/views.py"
click node_mysql_views "https://github.com/brainvoiceai-admin/avcri/blob/main/MySql_Data_pull/views.py"
click node_celery "https://github.com/brainvoiceai-admin/avcri/blob/main/AVCRI/celery.py"
click node_schedule_tasks "https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/tasks.py"
click node_forecast_tasks "https://github.com/brainvoiceai-admin/avcri/blob/main/predictor/tasks.py"
click node_api "https://github.com/brainvoiceai-admin/avcri/blob/main/api.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_auth,node_identity,node_user toneBlue
class node_patient,node_externaldb,node_preferences,node_prescriptions,node_mysql_views toneAmber
class node_booking,node_allocation_engine,node_reschedule,node_nurse,node_scheduler_views toneMint
class node_masters,node_procurement,node_celery,node_schedule_tasks,node_forecast_tasks,node_api toneRose
class node_forecast,node_forecast_data,node_forecast_ui toneIndigo
```

## Components

### Access and identity

- [Authentication and roles](https://github.com/brainvoiceai-admin/avcri/blob/main/authentication/views.py): `authentication/views.py`
- [Role and module data](https://github.com/brainvoiceai-admin/avcri/blob/main/authentication/models.py): `authentication/models.py`

### Patient operations

- [Patient records](https://github.com/brainvoiceai-admin/avcri/blob/main/Patient/models.py): `Patient/models.py`
- [Clinical source data](https://github.com/brainvoiceai-admin/avcri/blob/main/MySql_Data_pull/models.py): `MySql_Data_pull/models.py`
- [Therapist preferences](https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/preference_views.py): `Sheduling/preference_views.py`
- [Prescription workflows](https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/prescription_views.py): `Sheduling/prescription_views.py`
- [Imported-data interface](https://github.com/brainvoiceai-admin/avcri/blob/main/MySql_Data_pull/views.py): `MySql_Data_pull/views.py`

### Resource allocation

- [Schedule and bookings](https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/models.py): `Sheduling/models.py`
- [Schedule allocation](https://github.com/brainvoiceai-admin/avcri/blob/main/final_allocation.py): `final_allocation.py`
- [Rescheduling](https://github.com/brainvoiceai-admin/avcri/blob/main/reshedule.py): `reshedule.py`
- [Nurse allocation](https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/nurse_allocation.py): `Sheduling/nurse_allocation.py`
- [Scheduling interface](https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/views.py): `Sheduling/views.py`

### Operational services

- [Operational masters](https://github.com/brainvoiceai-admin/avcri/blob/main/masters/models.py): `masters/models.py`
- [Procurement workflows](https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/procurement_views.py): `Sheduling/procurement_views.py`
- [Background task setup](https://github.com/brainvoiceai-admin/avcri/blob/main/AVCRI/celery.py): `AVCRI/celery.py`
- [Reschedule tasks](https://github.com/brainvoiceai-admin/avcri/blob/main/Sheduling/tasks.py): `Sheduling/tasks.py`
- [Forecast tasks](https://github.com/brainvoiceai-admin/avcri/blob/main/predictor/tasks.py): `predictor/tasks.py`
- [Staff leave updates](https://github.com/brainvoiceai-admin/avcri/blob/main/api.py): `api.py`

### Forecasting

- [Forecast generation](https://github.com/brainvoiceai-admin/avcri/blob/main/predictor/forecast.py): `predictor/forecast.py`
- [Forecast records](https://github.com/brainvoiceai-admin/avcri/blob/main/predictor/models.py): `predictor/models.py`
- [Forecast interface](https://github.com/brainvoiceai-admin/avcri/blob/main/predictor/views.py): `predictor/views.py`

### Other components

- **Staff user**

## Connections

- Staff user → Authentication and roles: signs in (evidence: `authentication/views.py`)
- Authentication and roles → Role and module data: checks roles (evidence: `authentication/views.py`)
- Authentication and roles → Patient records: manages patients (evidence: `authentication/views.py`)
- Authentication and roles → Schedule and bookings: manages schedules (evidence: `authentication/views.py`)
- Patient records → Clinical source data: links visit data (evidence: `Patient/models.py`)
- Therapist preferences → Schedule allocation: reallocates therapists (evidence: `Sheduling/preference_views.py`)
- Therapist preferences → Schedule and bookings: updates bookings (evidence: `Sheduling/preference_views.py`)
- Scheduling interface → Schedule and bookings: serves schedules
- Schedule allocation → Schedule and bookings: writes assignments (evidence: `final_allocation.py`)
- Schedule allocation → Operational masters: checks resources (evidence: `final_allocation.py`)
- Rescheduling → Schedule and bookings: reassigns bookings (evidence: `reshedule.py`)
- Rescheduling → Schedule allocation: uses allocation logic (evidence: `reshedule.py`)
- Nurse allocation → Operational masters: reads nurse data (evidence: `Sheduling/nurse_allocation.py`)
- Prescription workflows → Schedule and bookings: manages prescriptions
- Procurement workflows → Schedule and bookings: manages procurement
- Imported-data interface → Clinical source data: reads imported data (evidence: `MySql_Data_pull/views.py`)
- Forecast generation → Clinical source data: reads clinical history (evidence: `predictor/forecast.py`)
- Forecast generation → Patient records: reads patient history (evidence: `predictor/forecast.py`)
- Forecast generation → Forecast records: stores forecasts (evidence: `predictor/forecast.py`)
- Forecast interface → Forecast records: serves forecasts
- Reschedule tasks → Staff leave updates: updates leave (evidence: `Sheduling/tasks.py`)
- Reschedule tasks → Rescheduling: runs rescheduling
- Forecast tasks → Forecast generation: runs forecasts
- Reschedule tasks → Background task setup: uses task queue (evidence: `Sheduling/tasks.py`)
- Forecast tasks → Background task setup: uses task queue (evidence: `predictor/tasks.py`)
