# vedantt02/learning-fastapi architecture

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

- Interactive diagram: https://gitdiagram.com/vedantt02/learning-fastapi
- Repository: https://github.com/vedantt02/learning-fastapi

## Overview

This is a small FastAPI patient-record API. Clients create, retrieve, update, delete, and sort patient records; Pydantic models validate patient data and compute BMI and its verdict, while JSON helpers read and write the file-backed store. The README confirms the capabilities and storage choice; the sampled `main.py` shows their implementation. The route and helper responsibilities share one source file, so the graph separates them by behavior rather than by module.

Main entry points: [`main.py`](https://github.com/vedantt02/learning-fastapi/blob/main/main.py) (HTTP Routes), [`patients.json`](https://github.com/vedantt02/learning-fastapi/blob/main/patients.json) (Patient Records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Patient API"]
  node_routes["HTTP Routes<br/>[main.py]"]
  node_record_ops["Record CRUD<br/>[main.py]"]
  node_read_ops["Record Retrieval<br/>[main.py]"]
  node_sort_ops["Patient Sorting<br/>[main.py]"]
end

subgraph group_domain["Patient Data"]
  node_patient_models["Patient Models<br/>[main.py]"]
end

subgraph group_storage["File Storage"]
  node_json_helpers["JSON Helpers<br/>[main.py]"]
  node_patient_file[("Patient Records<br/>[patients.json]")]
end

node_client(("API Client"))

node_client -->|"sends requests"| node_routes
node_routes -->|"dispatches CRUD"| node_record_ops
node_routes -->|"dispatches reads"| node_read_ops
node_routes -->|"dispatches sorting"| node_sort_ops
node_record_ops -->|"validates records"| node_patient_models
node_record_ops -->|"loads and saves"| node_json_helpers
node_read_ops -->|"loads records"| node_json_helpers
node_sort_ops -->|"loads records"| node_json_helpers
node_json_helpers -->|"reads and writes"| node_patient_file

click node_routes "https://github.com/vedantt02/learning-fastapi/blob/main/main.py"
click node_record_ops "https://github.com/vedantt02/learning-fastapi/blob/main/main.py"
click node_read_ops "https://github.com/vedantt02/learning-fastapi/blob/main/main.py"
click node_sort_ops "https://github.com/vedantt02/learning-fastapi/blob/main/main.py"
click node_patient_models "https://github.com/vedantt02/learning-fastapi/blob/main/main.py"
click node_json_helpers "https://github.com/vedantt02/learning-fastapi/blob/main/main.py"
click node_patient_file "https://github.com/vedantt02/learning-fastapi/blob/main/patients.json"

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_routes,node_record_ops,node_read_ops,node_sort_ops,node_client toneBlue
class node_patient_models toneAmber
class node_json_helpers,node_patient_file toneMint
```

## Components

### Patient API

- [HTTP Routes](https://github.com/vedantt02/learning-fastapi/blob/main/main.py): `main.py`
- [Record CRUD](https://github.com/vedantt02/learning-fastapi/blob/main/main.py): `main.py`
- [Record Retrieval](https://github.com/vedantt02/learning-fastapi/blob/main/main.py): `main.py`
- [Patient Sorting](https://github.com/vedantt02/learning-fastapi/blob/main/main.py): `main.py`

### Patient Data

- [Patient Models](https://github.com/vedantt02/learning-fastapi/blob/main/main.py): `main.py`

### File Storage

- [JSON Helpers](https://github.com/vedantt02/learning-fastapi/blob/main/main.py): `main.py`
- [Patient Records](https://github.com/vedantt02/learning-fastapi/blob/main/patients.json): `patients.json`

### Other components

- **API Client**

## Connections

- API Client → HTTP Routes: sends requests (evidence: `README.md`)
- HTTP Routes → Record CRUD: dispatches CRUD (evidence: `main.py`)
- HTTP Routes → Record Retrieval: dispatches reads (evidence: `main.py`)
- HTTP Routes → Patient Sorting: dispatches sorting (evidence: `main.py`)
- Record CRUD → Patient Models: validates records (evidence: `main.py`)
- Record CRUD → JSON Helpers: loads and saves (evidence: `main.py`)
- Record Retrieval → JSON Helpers: loads records (evidence: `main.py`)
- Patient Sorting → JSON Helpers: loads records (evidence: `main.py`)
- JSON Helpers → Patient Records: reads and writes (evidence: `main.py`)
