# leosumanth3-source/hospital-report-extraction architecture

> Architecture diagram of the GitHub repository leosumanth3-source/hospital-report-extraction, 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/leosumanth3-source/hospital-report-extraction
- Repository: https://github.com/leosumanth3-source/hospital-report-extraction

## Overview

This repository provides a FastAPI service that accepts a patient description, asks Gemini to extract structured medical information, validates the response against Pydantic models, and returns valid or invalid results. The graph shows the API entry point, extraction/provider interaction, and output schema. The README is empty; the relationships shown are supported by the sampled source.

Main entry points: [`app.py`](https://github.com/leosumanth3-source/hospital-report-extraction/blob/main/app.py) (FastAPI endpoints), [`extractor.py`](https://github.com/leosumanth3-source/hospital-report-extraction/blob/main/extractor.py) (Report extraction), [`schema.py`](https://github.com/leosumanth3-source/hospital-report-extraction/blob/main/schema.py) (Report schemas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_api["FastAPI endpoints<br/>[app.py]"]
end

subgraph group_extraction["Extraction"]
  node_extractor["Report extraction<br/>[extractor.py]"]
  node_gemini["Gemini model"]
end

subgraph group_contracts["Data Contracts"]
  node_schema["Report schemas<br/>[schema.py]"]
end

node_client(("API caller"))

node_client -->|"submits description"| node_api
node_api -->|"requests extraction"| node_extractor
node_extractor -->|"generates response"| node_gemini
node_extractor -->|"validates response"| node_schema
node_api -->|"returns result"| node_client

click node_api "https://github.com/leosumanth3-source/hospital-report-extraction/blob/main/app.py"
click node_extractor "https://github.com/leosumanth3-source/hospital-report-extraction/blob/main/extractor.py"
click node_schema "https://github.com/leosumanth3-source/hospital-report-extraction/blob/main/schema.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_api toneBlue
class node_extractor,node_gemini toneAmber
class node_schema,node_client toneMint
```

## Components

### HTTP API

- [FastAPI endpoints](https://github.com/leosumanth3-source/hospital-report-extraction/blob/main/app.py): `app.py`

### Extraction

- [Report extraction](https://github.com/leosumanth3-source/hospital-report-extraction/blob/main/extractor.py): `extractor.py`
- **Gemini model**

### Data Contracts

- [Report schemas](https://github.com/leosumanth3-source/hospital-report-extraction/blob/main/schema.py): `schema.py`

### Other components

- **API caller**

## Connections

- API caller → FastAPI endpoints: submits description (evidence: `app.py`)
- FastAPI endpoints → Report extraction: requests extraction (evidence: `app.py`)
- Report extraction → Gemini model: generates response (evidence: `extractor.py`)
- Report extraction → Report schemas: validates response (evidence: `extractor.py`)
- FastAPI endpoints → API caller: returns result (evidence: `app.py`)
