# avinashreddy630/mediflow-ai architecture

> Architecture diagram of the GitHub repository avinashreddy630/mediflow-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/avinashreddy630/mediflow-ai
- Repository: https://github.com/avinashreddy630/mediflow-ai

## Overview

MediFlow AI is a hospital-management and clinical-intelligence application with role-based patient, doctor, and admin workflows. The visible authentication flow uses Firebase and synchronizes with the Django accounts API; the README describes the broader appointment, records, prescription, billing, dashboard, notification, and AI capabilities. Several feature implementations and their frontend-to-API wiring were not sampled, so those relationships are not inferred here.

Main entry points: [`django-backend/config/settings.py`](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/config/settings.py) (Configured database), [`frontend/src/context/AuthContext.jsx`](https://github.com/avinashreddy630/mediflow-ai/blob/main/frontend/src/context/AuthContext.jsx) (Auth context), [`django-backend/apps/prescriptions/views.py`](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/prescriptions/views.py) (E-prescriptions), [`frontend/src/App.jsx`](https://github.com/avinashreddy630/mediflow-ai/blob/main/frontend/src/App.jsx) (App routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["App routes<br/>[App.jsx]"]
end

subgraph group_identity["Identity and access"]
  node_authctx["Auth context<br/>[AuthContext.jsx]"]
  node_authapi["Auth API client<br/>[auth.js]"]
  node_firebase["Firebase Auth<br/>[firebase.js]"]
  node_accounts["Account endpoints<br/>[views.py]"]
  node_accountdata[("Account data<br/>[models.py]")]
end

subgraph group_care["Clinical workflows"]
  node_patients["Patient directory<br/>[views.py]"]
  node_doctors["Doctor management<br/>[views.py]"]
  node_appointments["Appointment scheduling<br/>[views.py]"]
  node_records["Medical records<br/>[views.py]"]
  node_prescriptions["E-prescriptions<br/>[views.py]"]
  node_pdf["Prescription PDF<br/>[views.py]"]
end

subgraph group_operations["Hospital operations"]
  node_billing["Billing and payments<br/>[views.py]"]
  node_notifications["Notifications<br/>[views.py]"]
  node_dashboard["Analytics dashboards<br/>[views.py]"]
  node_db[("Configured database<br/>[settings.py]")]
end

subgraph group_intelligence["Clinical intelligence"]
  node_chat["AI chat<br/>[views.py]"]
  node_ai_pages["AI experiences"]
end

node_visitor(("User"))
node_gemini{{"Gemini AI"}}

node_visitor -->|"opens"| node_app
node_app -->|"provides auth"| node_authctx
node_authctx -->|"authenticates"| node_firebase
node_authctx -->|"syncs account"| node_authapi
node_authapi -->|"HTTP requests"| node_accounts
node_accounts -->|"reads and writes"| node_accountdata
node_appointments -->|"persists records"| node_db
node_patients -->|"persists records"| node_db
node_doctors -->|"persists records"| node_db
node_records -->|"persists records"| node_db
node_prescriptions -->|"reads and writes"| node_db
node_prescriptions -->|"streams PDF"| node_pdf
node_billing -->|"persists records"| node_db
node_notifications -->|"persists records"| node_db
node_dashboard -->|"aggregates metrics"| node_db
node_chat -.->|"AI assistance"| node_gemini

click node_app "https://github.com/avinashreddy630/mediflow-ai/blob/main/frontend/src/App.jsx"
click node_authctx "https://github.com/avinashreddy630/mediflow-ai/blob/main/frontend/src/context/AuthContext.jsx"
click node_authapi "https://github.com/avinashreddy630/mediflow-ai/blob/main/frontend/src/api/auth.js"
click node_firebase "https://github.com/avinashreddy630/mediflow-ai/blob/main/frontend/src/config/firebase.js"
click node_accounts "https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/accounts/views.py"
click node_accountdata "https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/accounts/models.py"
click node_patients "https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/patients/views.py"
click node_doctors "https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/doctors/views.py"
click node_appointments "https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/appointments/views.py"
click node_records "https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/medical_records/views.py"
click node_prescriptions "https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/prescriptions/views.py"
click node_pdf "https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/prescriptions/views.py"
click node_billing "https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/billing/views.py"
click node_notifications "https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/notifications/views.py"
click node_dashboard "https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/dashboard/views.py"
click node_chat "https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/ai_chat/views.py"
click node_ai_pages "https://github.com/avinashreddy630/mediflow-ai/blob/main/frontend/src/pages/ai/AIChatAssistantPage.jsx"
click node_db "https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/config/settings.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_app,node_visitor toneBlue
class node_authctx,node_authapi,node_firebase,node_accounts,node_accountdata toneAmber
class node_patients,node_doctors,node_appointments,node_records,node_prescriptions,node_pdf toneMint
class node_billing,node_notifications,node_dashboard,node_db toneRose
class node_chat,node_ai_pages,node_gemini toneIndigo
```

## Components

### Web application

- [App routes](https://github.com/avinashreddy630/mediflow-ai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### Identity and access

- [Auth context](https://github.com/avinashreddy630/mediflow-ai/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Auth API client](https://github.com/avinashreddy630/mediflow-ai/blob/main/frontend/src/api/auth.js): `frontend/src/api/auth.js`
- [Firebase Auth](https://github.com/avinashreddy630/mediflow-ai/blob/main/frontend/src/config/firebase.js): `frontend/src/config/firebase.js`
- [Account endpoints](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/accounts/views.py): `django-backend/apps/accounts/views.py`
- [Account data](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/accounts/models.py): `django-backend/apps/accounts/models.py`

### Clinical workflows

- [Patient directory](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/patients/views.py): `django-backend/apps/patients/views.py`
- [Doctor management](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/doctors/views.py): `django-backend/apps/doctors/views.py`
- [Appointment scheduling](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/appointments/views.py): `django-backend/apps/appointments/views.py`
- [Medical records](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/medical_records/views.py): `django-backend/apps/medical_records/views.py`
- [E-prescriptions](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/prescriptions/views.py): `django-backend/apps/prescriptions/views.py`
- [Prescription PDF](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/prescriptions/views.py): `django-backend/apps/prescriptions/views.py`

### Hospital operations

- [Billing and payments](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/billing/views.py): `django-backend/apps/billing/views.py`
- [Notifications](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/notifications/views.py): `django-backend/apps/notifications/views.py`
- [Analytics dashboards](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/dashboard/views.py): `django-backend/apps/dashboard/views.py`
- [Configured database](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/config/settings.py): `django-backend/config/settings.py`

### Clinical intelligence

- [AI chat](https://github.com/avinashreddy630/mediflow-ai/blob/main/django-backend/apps/ai_chat/views.py): `django-backend/apps/ai_chat/views.py`
- [AI experiences](https://github.com/avinashreddy630/mediflow-ai/blob/main/frontend/src/pages/ai/AIChatAssistantPage.jsx): `frontend/src/pages/ai/AIChatAssistantPage.jsx`

### Other components

- **User**
- **Gemini AI**

## Connections

- User → App routes: opens
- App routes → Auth context: provides auth
- Auth context → Firebase Auth: authenticates
- Auth context → Auth API client: syncs account
- Auth API client → Account endpoints: HTTP requests
- Account endpoints → Account data: reads and writes
- Appointment scheduling → Configured database: persists records
- Patient directory → Configured database: persists records
- Doctor management → Configured database: persists records
- Medical records → Configured database: persists records
- E-prescriptions → Configured database: reads and writes
- E-prescriptions → Prescription PDF: streams PDF
- Billing and payments → Configured database: persists records
- Notifications → Configured database: persists records
- Analytics dashboards → Configured database: aggregates metrics
- AI chat → Gemini AI: AI assistance
