# mushfiq525/medscreening architecture

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

- Interactive diagram: https://gitdiagram.com/mushfiq525/medscreening
- Repository: https://github.com/mushfiq525/medscreening

## Overview

MedScreen AI is a FastAPI research API for two distinct lung-screening workflows: CT-slice classification and symptom-survey risk scoring. Clients enter through the registered health or prediction routes; prediction handlers validate inputs, obtain cached models and metadata, prepare modality-specific inputs, run inference, and return typed results. Readiness checks report whether both model paths can load. The README is empty, and model binaries are not present in the supplied tree, so the graph shows only source-supported runtime relationships and does not assert artifact availability.

Main entry points: [`app/routers/predictions.py`](https://github.com/mushfiq525/medscreening/blob/main/app/routers/predictions.py) (Prediction endpoints), [`app/routers/health.py`](https://github.com/mushfiq525/medscreening/blob/main/app/routers/health.py) (Health and readiness), [`app/inference/loader.py`](https://github.com/mushfiq525/medscreening/blob/main/app/inference/loader.py) (Model and metadata loader), [`app/core/config.py`](https://github.com/mushfiq525/medscreening/blob/main/app/core/config.py) (Runtime settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API routes"]
  node_app["FastAPI app<br/>[main.py]"]
  node_health["Health and readiness<br/>[health.py]"]
  node_predictions["Prediction endpoints<br/>[predictions.py]"]
end

subgraph group_inference["Inference workflows"]
  node_ctprep["CT preprocessing<br/>[preprocess_ct.py]"]
  node_tabprep["Survey preparation"]
  node_model_loader["Model and metadata loader<br/>[loader.py]"]
end

subgraph group_contracts["Contracts and configuration"]
  node_prediction_schema["Prediction contracts<br/>[prediction.py]"]
  node_settings["Runtime settings<br/>[config.py]"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_app
node_app -->|"registers routes"| node_health
node_app -->|"registers routes"| node_predictions
node_client -.->|"calls endpoints"| node_health
node_client -.->|"submits inputs"| node_predictions
node_health -->|"checks readiness"| node_model_loader
node_health -->|"reads app name"| node_settings
node_health -->|"returns health types"| node_prediction_schema
node_predictions -->|"validates and responds"| node_prediction_schema
node_predictions -->|"loads models"| node_model_loader
node_predictions -->|"prepares CT input"| node_ctprep
node_predictions -->|"prepares survey input"| node_tabprep
node_predictions -->|"checks upload size"| node_settings
node_model_loader -->|"resolves model paths"| node_settings
node_model_loader -->|"loads CT metadata"| node_ctprep
node_model_loader -->|"loads survey metadata"| node_tabprep
node_ctprep -->|"resolves metadata path"| node_settings
node_tabprep -->|"resolves metadata path"| node_settings
node_tabprep -->|"reads survey request"| node_prediction_schema

click node_app "https://github.com/mushfiq525/medscreening/blob/main/app/main.py"
click node_health "https://github.com/mushfiq525/medscreening/blob/main/app/routers/health.py"
click node_predictions "https://github.com/mushfiq525/medscreening/blob/main/app/routers/predictions.py"
click node_ctprep "https://github.com/mushfiq525/medscreening/blob/main/app/inference/preprocess_ct.py"
click node_tabprep "https://github.com/mushfiq525/medscreening/blob/main/app/inference/preprocess_tabular.py"
click node_model_loader "https://github.com/mushfiq525/medscreening/blob/main/app/inference/loader.py"
click node_prediction_schema "https://github.com/mushfiq525/medscreening/blob/main/app/schemas/prediction.py"
click node_settings "https://github.com/mushfiq525/medscreening/blob/main/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_app,node_health,node_predictions,node_client toneBlue
class node_ctprep,node_tabprep,node_model_loader toneAmber
class node_prediction_schema,node_settings toneMint
```

## Components

### API routes

- [FastAPI app](https://github.com/mushfiq525/medscreening/blob/main/app/main.py): `app/main.py`
- [Health and readiness](https://github.com/mushfiq525/medscreening/blob/main/app/routers/health.py): `app/routers/health.py`
- [Prediction endpoints](https://github.com/mushfiq525/medscreening/blob/main/app/routers/predictions.py): `app/routers/predictions.py`

### Inference workflows

- [CT preprocessing](https://github.com/mushfiq525/medscreening/blob/main/app/inference/preprocess_ct.py): `app/inference/preprocess_ct.py`
- [Survey preparation](https://github.com/mushfiq525/medscreening/blob/main/app/inference/preprocess_tabular.py): `app/inference/preprocess_tabular.py`
- [Model and metadata loader](https://github.com/mushfiq525/medscreening/blob/main/app/inference/loader.py): `app/inference/loader.py`

### Contracts and configuration

- [Prediction contracts](https://github.com/mushfiq525/medscreening/blob/main/app/schemas/prediction.py): `app/schemas/prediction.py`
- [Runtime settings](https://github.com/mushfiq525/medscreening/blob/main/app/core/config.py): `app/core/config.py`

### Other components

- **API client**

## Connections

- API client → FastAPI app: sends requests
- FastAPI app → Health and readiness: registers routes (evidence: `app/main.py`)
- FastAPI app → Prediction endpoints: registers routes (evidence: `app/main.py`)
- API client → Health and readiness: calls endpoints
- API client → Prediction endpoints: submits inputs
- Health and readiness → Model and metadata loader: checks readiness (evidence: `app/routers/health.py`)
- Health and readiness → Runtime settings: reads app name (evidence: `app/routers/health.py`)
- Health and readiness → Prediction contracts: returns health types (evidence: `app/routers/health.py`)
- Prediction endpoints → Prediction contracts: validates and responds (evidence: `app/routers/predictions.py`)
- Prediction endpoints → Model and metadata loader: loads models (evidence: `app/routers/predictions.py`)
- Prediction endpoints → CT preprocessing: prepares CT input (evidence: `app/routers/predictions.py`)
- Prediction endpoints → Survey preparation: prepares survey input (evidence: `app/routers/predictions.py`)
- Prediction endpoints → Runtime settings: checks upload size (evidence: `app/routers/predictions.py`)
- Model and metadata loader → Runtime settings: resolves model paths (evidence: `app/inference/loader.py`)
- Model and metadata loader → CT preprocessing: loads CT metadata (evidence: `app/inference/loader.py`)
- Model and metadata loader → Survey preparation: loads survey metadata (evidence: `app/inference/loader.py`)
- CT preprocessing → Runtime settings: resolves metadata path (evidence: `app/inference/preprocess_ct.py`)
- Survey preparation → Runtime settings: resolves metadata path (evidence: `app/inference/preprocess_tabular.py`)
- Survey preparation → Prediction contracts: reads survey request (evidence: `app/inference/preprocess_tabular.py`)
