# amanafaizal/visionai-care architecture

> Architecture diagram of the GitHub repository amanafaizal/visionai-care, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amanafaizal/visionai-care
- Repository: https://github.com/amanafaizal/visionai-care

## Overview

VisionAI-Care combines patient and doctor portals with a FastAPI screening and consultation backend. The main workflow is account access, guided screening, result scoring and explanation, then doctor review and consultation; patient history and webcam-based reliability support that flow. The README also describes computer-vision monitoring and reporting capabilities. Some backend route implementations and frontend pages were not excerpted, so those subsystems are represented at their exact tree paths; links without direct source evidence are omitted. The README describes some capabilities as planned or exploratory.

Main entry points: [`frontend/lib/api.js`](https://github.com/amanafaizal/visionai-care/blob/main/frontend/lib/api.js) (API client and session), [`backend/app/main.py`](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/api/routes/vision_tests.py`](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/api/routes/vision_tests.py) (Vision test routes), [`backend/app/db/session.py`](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/db/session.py) (Database sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Web portals"]
  node_auth_ui["Sign in and register<br/>[AuthCard.jsx]"]
  node_patient_portal["Patient screening portal<br/>[index.jsx]"]
  node_webcam["Webcam capture<br/>[WebcamCapture.jsx]"]
  node_history["Patient history<br/>[history.jsx]"]
  node_doctor_dashboard["Doctor dashboard<br/>[dashboard.jsx]"]
  node_doctor_review["Consultation review<br/>[&#91;id&#93;.jsx]"]
  node_api_client["API client and session<br/>[api.js]"]
end

subgraph group_backend["API and access"]
  node_app["FastAPI application<br/>[main.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_user_routes["User routes<br/>[users.py]"]
  node_deps["Identity and role checks<br/>[deps.py]"]
  node_security["Token and password security<br/>[security.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_screening["Screening services"]
  node_vision_routes["Vision test routes<br/>[vision_tests.py]"]
  node_scoring["Screening scoring<br/>[scoring_service.py]"]
  node_cv["Computer vision monitoring<br/>[cv_service.py]"]
  node_ai["Result explanation<br/>[ai_service.py]"]
end

subgraph group_records["Clinical records"]
  node_consult_routes["Consultation routes<br/>[consultations.py]"]
  node_user_model[("User records<br/>[user.py]")]
  node_consult_model[("Consultation records<br/>[consultation.py]")]
  node_session[("Database sessions<br/>[session.py]")]
end

node_patient(("Patient"))
node_doctor(("Doctor"))

node_patient -->|"registers or signs in"| node_auth_ui
node_doctor -->|"registers or signs in"| node_auth_ui
node_auth_ui -->|"submits credentials"| node_api_client
node_patient -->|"starts screening"| node_patient_portal
node_patient_portal -->|"requests screening"| node_api_client
node_webcam -->|"sends reliability data"| node_api_client
node_patient -->|"views past results"| node_history
node_history -->|"loads history"| node_api_client
node_doctor -->|"reviews queue"| node_doctor_dashboard
node_doctor_dashboard -->|"loads consultations"| node_api_client
node_doctor -->|"reviews screening"| node_doctor_review
node_doctor_review -->|"submits review"| node_api_client
node_api_client -->|"sends REST requests"| node_app
node_app -->|"registers router"| node_auth_routes
node_app -->|"registers router"| node_user_routes
node_app -->|"registers router"| node_vision_routes
node_app -->|"registers router"| node_consult_routes
node_auth_routes -->|"creates and verifies users"| node_user_model
node_auth_routes -->|"hashes and issues tokens"| node_security
node_deps -->|"decodes tokens"| node_security
node_deps -->|"loads current user"| node_user_model
node_vision_routes -->|"scores results"| node_scoring
node_vision_routes -->|"evaluates screening"| node_ai
node_vision_routes -.->|"checks test reliability"| node_cv
node_consult_routes -->|"reads and updates"| node_consult_model
node_consult_routes -->|"loads patient and doctor"| node_user_model
node_app -->|"creates tables"| node_session
node_session -->|"uses database URL"| node_config
node_security -->|"uses token settings"| node_config
node_consult_routes -->|"uses database sessions"| node_session
node_vision_routes -->|"uses database sessions"| node_session
node_auth_routes -->|"uses database sessions"| node_session

click node_auth_ui "https://github.com/amanafaizal/visionai-care/blob/main/frontend/components/AuthCard.jsx"
click node_patient_portal "https://github.com/amanafaizal/visionai-care/blob/main/frontend/pages/index.jsx"
click node_webcam "https://github.com/amanafaizal/visionai-care/blob/main/frontend/components/WebcamCapture.jsx"
click node_history "https://github.com/amanafaizal/visionai-care/blob/main/frontend/pages/patient/history.jsx"
click node_doctor_dashboard "https://github.com/amanafaizal/visionai-care/blob/main/frontend/pages/doctor/dashboard.jsx"
click node_doctor_review "https://github.com/amanafaizal/visionai-care/blob/main/frontend/pages/doctor/review/%5Bid%5D.jsx"
click node_api_client "https://github.com/amanafaizal/visionai-care/blob/main/frontend/lib/api.js"
click node_app "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/api/routes/auth.py"
click node_user_routes "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/api/routes/users.py"
click node_deps "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/api/deps.py"
click node_security "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/core/security.py"
click node_vision_routes "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/api/routes/vision_tests.py"
click node_scoring "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/services/scoring_service.py"
click node_cv "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/services/cv_service.py"
click node_ai "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/services/ai_service.py"
click node_consult_routes "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/api/routes/consultations.py"
click node_user_model "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/models/user.py"
click node_consult_model "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/models/consultation.py"
click node_session "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/db/session.py"
click node_config "https://github.com/amanafaizal/visionai-care/blob/main/backend/app/core/config.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_ui,node_patient_portal,node_webcam,node_history,node_doctor_dashboard,node_doctor_review,node_api_client toneBlue
class node_app,node_auth_routes,node_user_routes,node_deps,node_security,node_config toneAmber
class node_vision_routes,node_scoring,node_cv,node_ai toneMint
class node_consult_routes,node_user_model,node_consult_model,node_session toneRose
class node_patient,node_doctor toneIndigo
```

## Components

### Web portals

- [Sign in and register](https://github.com/amanafaizal/visionai-care/blob/main/frontend/components/AuthCard.jsx): `frontend/components/AuthCard.jsx`
- [Patient screening portal](https://github.com/amanafaizal/visionai-care/blob/main/frontend/pages/index.jsx): `frontend/pages/index.jsx`
- [Webcam capture](https://github.com/amanafaizal/visionai-care/blob/main/frontend/components/WebcamCapture.jsx): `frontend/components/WebcamCapture.jsx`
- [Patient history](https://github.com/amanafaizal/visionai-care/blob/main/frontend/pages/patient/history.jsx): `frontend/pages/patient/history.jsx`
- [Doctor dashboard](https://github.com/amanafaizal/visionai-care/blob/main/frontend/pages/doctor/dashboard.jsx): `frontend/pages/doctor/dashboard.jsx`
- [Consultation review](https://github.com/amanafaizal/visionai-care/blob/main/frontend/pages/doctor/review/%5Bid%5D.jsx): `frontend/pages/doctor/review/[id].jsx`
- [API client and session](https://github.com/amanafaizal/visionai-care/blob/main/frontend/lib/api.js): `frontend/lib/api.js`

### API and access

- [FastAPI application](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/api/routes/auth.py): `backend/app/api/routes/auth.py`
- [User routes](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/api/routes/users.py): `backend/app/api/routes/users.py`
- [Identity and role checks](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/api/deps.py): `backend/app/api/deps.py`
- [Token and password security](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [Runtime configuration](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/core/config.py): `backend/app/core/config.py`

### Screening services

- [Vision test routes](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/api/routes/vision_tests.py): `backend/app/api/routes/vision_tests.py`
- [Screening scoring](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/services/scoring_service.py): `backend/app/services/scoring_service.py`
- [Computer vision monitoring](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/services/cv_service.py): `backend/app/services/cv_service.py`
- [Result explanation](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/services/ai_service.py): `backend/app/services/ai_service.py`

### Clinical records

- [Consultation routes](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/api/routes/consultations.py): `backend/app/api/routes/consultations.py`
- [User records](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/models/user.py): `backend/app/models/user.py`
- [Consultation records](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/models/consultation.py): `backend/app/models/consultation.py`
- [Database sessions](https://github.com/amanafaizal/visionai-care/blob/main/backend/app/db/session.py): `backend/app/db/session.py`

### Other components

- **Patient**
- **Doctor**

## Connections

- Patient → Sign in and register: registers or signs in (evidence: `frontend/components/AuthCard.jsx`)
- Doctor → Sign in and register: registers or signs in (evidence: `frontend/components/AuthCard.jsx`)
- Sign in and register → API client and session: submits credentials (evidence: `frontend/components/AuthCard.jsx`)
- Patient → Patient screening portal: starts screening
- Patient screening portal → API client and session: requests screening (evidence: `frontend/pages/index.jsx`)
- Webcam capture → API client and session: sends reliability data (evidence: `frontend/components/WebcamCapture.jsx`)
- Patient → Patient history: views past results
- Patient history → API client and session: loads history (evidence: `frontend/pages/patient/history.jsx`)
- Doctor → Doctor dashboard: reviews queue
- Doctor dashboard → API client and session: loads consultations (evidence: `frontend/pages/doctor/dashboard.jsx`)
- Doctor → Consultation review: reviews screening
- Consultation review → API client and session: submits review (evidence: `frontend/pages/doctor/review/[id].jsx`)
- API client and session → FastAPI application: sends REST requests
- FastAPI application → Authentication routes: registers router (evidence: `backend/app/main.py`)
- FastAPI application → User routes: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Vision test routes: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Consultation routes: registers router (evidence: `backend/app/main.py`)
- Authentication routes → User records: creates and verifies users (evidence: `backend/app/api/routes/auth.py`)
- Authentication routes → Token and password security: hashes and issues tokens (evidence: `backend/app/api/routes/auth.py`)
- Identity and role checks → Token and password security: decodes tokens (evidence: `backend/app/api/deps.py`)
- Identity and role checks → User records: loads current user (evidence: `backend/app/api/deps.py`)
- Vision test routes → Screening scoring: scores results (evidence: `backend/app/api/routes/vision_tests.py`)
- Vision test routes → Result explanation: evaluates screening (evidence: `backend/app/api/routes/vision_tests.py`)
- Vision test routes → Computer vision monitoring: checks test reliability
- Consultation routes → Consultation records: reads and updates (evidence: `backend/app/api/routes/consultations.py`)
- Consultation routes → User records: loads patient and doctor (evidence: `backend/app/api/routes/consultations.py`)
- FastAPI application → Database sessions: creates tables (evidence: `backend/app/main.py`)
- Database sessions → Runtime configuration: uses database URL (evidence: `backend/app/db/session.py`)
- Token and password security → Runtime configuration: uses token settings (evidence: `backend/app/core/security.py`)
- Consultation routes → Database sessions: uses database sessions (evidence: `backend/app/api/routes/consultations.py`)
- Vision test routes → Database sessions: uses database sessions (evidence: `backend/app/api/routes/vision_tests.py`)
- Authentication routes → Database sessions: uses database sessions (evidence: `backend/app/api/routes/auth.py`)
