# om-1004/medflowai architecture

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

- Interactive diagram: https://gitdiagram.com/om-1004/medflowai
- Repository: https://github.com/om-1004/medflowai
- Video tour (about a minute): https://gitdiagram.com/om-1004/medflowai/video

## Overview

MedFlowAI is a healthcare prediction platform whose primary workflow is a user entering health data or selecting an imaging workflow and receiving an inference result. The sampled code confirms the sleep-assessment path through the React client, Express controller, and FastAPI model; FastAPI also implements CNN image and ANN prediction endpoints. The Node service separately stores and retrieves prediction records and sends contact submissions through SES. Other frontend-to-model wiring is not established by the sampled pages, so those links are omitted.

Main entry points: [`api/index.js`](https://github.com/om-1004/medflowai/blob/main/api/index.js) (Express server), [`ml_service/main.py`](https://github.com/om-1004/medflowai/blob/main/ml_service/main.py) (Inference API), [`client/src/App.jsx`](https://github.com/om-1004/medflowai/blob/main/client/src/App.jsx) (React app and routes), [`client/src/auth`](https://github.com/om-1004/medflowai/tree/main/client/src/auth) (Client auth integration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["React app and routes<br/>[App.jsx]"]
  node_prediction_pages["Prediction pages"]
  node_auth_ui["Auth UI"]
end

subgraph group_api["Node API"]
  node_sleep_controller["Sleep API controller"]
  node_prediction_controller["Prediction records API"]
  node_email_controller["Contact email API"]
  node_express["Express server<br/>[index.js]"]
end

subgraph group_inference["ML inference"]
  node_fastapi["Inference API<br/>[main.py]"]
  node_sleep_model["Sleep model<br/>[main.py]"]
  node_cnn_model["Brain image CNN<br/>[main.py]"]
  node_ann_model["Cancer risk ANN<br/>[main.py]"]
end

subgraph group_state["Identity and records"]
  node_dynamodb[("Prediction records<br/>[db.js]")]
  node_auth_client["Client auth integration"]
end

subgraph group_integrations["External integrations"]
  node_cognito["AWS Cognito"]
  node_ses["AWS SES"]
  node_firebase["Firebase sign-in"]
end

node_user(("Platform user"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_prediction_pages
node_app -->|"routes to"| node_auth_ui
node_prediction_pages -->|"submits sleep data"| node_express
node_express -->|"dispatches"| node_sleep_controller
node_sleep_controller -->|"forwards sleep input"| node_fastapi
node_fastapi -->|"predicts with"| node_sleep_model
node_sleep_model -->|"returns prediction"| node_fastapi
node_fastapi -->|"returns result"| node_sleep_controller
node_express -->|"dispatches"| node_prediction_controller
node_prediction_controller -->|"reads and writes"| node_dynamodb
node_express -->|"dispatches"| node_email_controller
node_email_controller -->|"sends email"| node_ses
node_auth_ui -->|"uses"| node_auth_client
node_auth_client -->|"signs in with"| node_firebase
node_auth_client -.->|"documented auth"| node_cognito

click node_app "https://github.com/om-1004/medflowai/blob/main/client/src/App.jsx"
click node_prediction_pages "https://github.com/om-1004/medflowai/tree/main/client/src/pages"
click node_auth_ui "https://github.com/om-1004/medflowai/tree/main/client/src/pages"
click node_sleep_controller "https://github.com/om-1004/medflowai/blob/main/api/controllers/model.controller.js"
click node_prediction_controller "https://github.com/om-1004/medflowai/blob/main/api/controllers/predictions.controller.js"
click node_email_controller "https://github.com/om-1004/medflowai/blob/main/api/controllers/email.controller.js"
click node_express "https://github.com/om-1004/medflowai/blob/main/api/index.js"
click node_fastapi "https://github.com/om-1004/medflowai/blob/main/ml_service/main.py"
click node_sleep_model "https://github.com/om-1004/medflowai/blob/main/ml_service/main.py"
click node_cnn_model "https://github.com/om-1004/medflowai/blob/main/ml_service/main.py"
click node_ann_model "https://github.com/om-1004/medflowai/blob/main/ml_service/main.py"
click node_dynamodb "https://github.com/om-1004/medflowai/blob/main/api/config/db.js"
click node_auth_client "https://github.com/om-1004/medflowai/tree/main/client/src/auth"

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_prediction_pages,node_auth_ui,node_user toneBlue
class node_sleep_controller,node_prediction_controller,node_email_controller,node_express toneAmber
class node_fastapi,node_sleep_model,node_cnn_model,node_ann_model toneMint
class node_dynamodb,node_auth_client toneRose
class node_cognito,node_ses,node_firebase toneIndigo
```

## Components

### Web client

- [React app and routes](https://github.com/om-1004/medflowai/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Prediction pages](https://github.com/om-1004/medflowai/tree/main/client/src/pages): `client/src/pages`
- [Auth UI](https://github.com/om-1004/medflowai/tree/main/client/src/pages): `client/src/pages`

### Node API

- [Sleep API controller](https://github.com/om-1004/medflowai/blob/main/api/controllers/model.controller.js): `api/controllers/model.controller.js`
- [Prediction records API](https://github.com/om-1004/medflowai/blob/main/api/controllers/predictions.controller.js): `api/controllers/predictions.controller.js`
- [Contact email API](https://github.com/om-1004/medflowai/blob/main/api/controllers/email.controller.js): `api/controllers/email.controller.js`
- [Express server](https://github.com/om-1004/medflowai/blob/main/api/index.js): `api/index.js`

### ML inference

- [Inference API](https://github.com/om-1004/medflowai/blob/main/ml_service/main.py): `ml_service/main.py`
- [Sleep model](https://github.com/om-1004/medflowai/blob/main/ml_service/main.py): `ml_service/main.py`
- [Brain image CNN](https://github.com/om-1004/medflowai/blob/main/ml_service/main.py): `ml_service/main.py`
- [Cancer risk ANN](https://github.com/om-1004/medflowai/blob/main/ml_service/main.py): `ml_service/main.py`

### Identity and records

- [Prediction records](https://github.com/om-1004/medflowai/blob/main/api/config/db.js): `api/config/db.js`
- [Client auth integration](https://github.com/om-1004/medflowai/tree/main/client/src/auth): `client/src/auth`

### External integrations

- **AWS Cognito**
- **AWS SES**
- **Firebase sign-in**

### Other components

- **Platform user**

## Connections

- Platform user → React app and routes: uses
- React app and routes → Prediction pages: routes to
- React app and routes → Auth UI: routes to
- Prediction pages → Express server: submits sleep data
- Express server → Sleep API controller: dispatches
- Sleep API controller → Inference API: forwards sleep input
- Inference API → Sleep model: predicts with
- Sleep model → Inference API: returns prediction
- Inference API → Sleep API controller: returns result
- Express server → Prediction records API: dispatches
- Prediction records API → Prediction records: reads and writes
- Express server → Contact email API: dispatches
- Contact email API → AWS SES: sends email
- Auth UI → Client auth integration: uses
- Client auth integration → Firebase sign-in: signs in with
- Client auth integration → AWS Cognito: documented auth
