# tanmay-g1/fetal_and_maternal_health_classifier architecture

> Architecture diagram of the GitHub repository tanmay-g1/fetal_and_maternal_health_classifier, 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/tanmay-g1/fetal_and_maternal_health_classifier
- Repository: https://github.com/tanmay-g1/fetal_and_maternal_health_classifier

## Overview

This is a pregnancy health application for patients and doctors, combining health guidance pages, role-based accounts, assessments, and clinician-patient workflows. The main assessment path is a patient or doctor request through the Express API to the Python prediction service, which loads a model and returns a risk result; patient and doctor routes then persist or retrieve assessment data. The tree also shows wellness and pregnancy-information pages. No README or frontend call sites were provided, so links from pages to API operations are not asserted.

Main entry points: [`server/src/routes/doctor.js`](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/routes/doctor.js) (Doctor routes), [`server/src/index.js`](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/index.js) (Express application), [`server/src/routes/patient.js`](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/routes/patient.js) (Patient routes), [`server/ml_service/app.py`](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/ml_service/app.py) (Prediction API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_guidance["Health guidance"]
  node_pregnancy["Pregnancy pages"]
end

subgraph group_api["Application API"]
  node_server["Express application<br/>[index.js]"]
  node_auth["Account routes<br/>[auth.js]"]
  node_patient_api["Patient routes<br/>[patient.js]"]
  node_doctor_api["Doctor routes<br/>[doctor.js]"]
  node_access["Role authorization<br/>[auth.js]"]
end

subgraph group_records["Health records"]
  node_user[("User accounts<br/>[User.js]")]
  node_profile[("Patient profile<br/>[PatientProfile.js]")]
  node_questionnaire[("Assessment records")]
end

subgraph group_prediction["Risk prediction"]
  node_ml_service["Prediction API<br/>[app.py]"]
  node_model_classes["Prediction models<br/>[model_classes.py]"]
  node_model_files["Model artifacts"]
end

node_visitor(("Patient or doctor"))

node_visitor -->|"views"| node_guidance
node_visitor -->|"views"| node_pregnancy
node_server -->|"serves static files"| node_guidance
node_server -->|"mounts routes"| node_auth
node_server -->|"mounts routes"| node_patient_api
node_server -->|"mounts routes"| node_doctor_api
node_server -->|"connects database"| node_user
node_auth -->|"reads and creates"| node_user
node_patient_api -->|"checks role"| node_access
node_doctor_api -->|"checks role"| node_access
node_patient_api -->|"saves and reads"| node_questionnaire
node_patient_api -->|"reads status"| node_profile
node_patient_api -->|"requests prediction"| node_ml_service
node_doctor_api -->|"reads and updates"| node_user
node_doctor_api -->|"updates assessment"| node_profile
node_doctor_api -->|"reads and deletes"| node_questionnaire
node_doctor_api -->|"requests prediction"| node_ml_service
node_ml_service -->|"imports classes"| node_model_classes
node_ml_service -->|"loads artifacts"| node_model_files

click node_guidance "https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/tree/main/public"
click node_pregnancy "https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/tree/main/public"
click node_server "https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/index.js"
click node_auth "https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/routes/auth.js"
click node_patient_api "https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/routes/patient.js"
click node_doctor_api "https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/routes/doctor.js"
click node_access "https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/middleware/auth.js"
click node_user "https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/models/User.js"
click node_profile "https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/models/PatientProfile.js"
click node_questionnaire "https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/models/QuestionnaireResponse.js"
click node_ml_service "https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/ml_service/app.py"
click node_model_classes "https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/ml_service/model_classes.py"
click node_model_files "https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/tree/main/server/ml_service/models"

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_guidance,node_pregnancy toneBlue
class node_server,node_auth,node_patient_api,node_doctor_api,node_access toneAmber
class node_user,node_profile,node_questionnaire toneMint
class node_ml_service,node_model_classes,node_model_files toneRose
class node_visitor toneIndigo
```

## Components

### Web experience

- [Health guidance](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/tree/main/public): `public`
- [Pregnancy pages](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/tree/main/public): `public`

### Application API

- [Express application](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/index.js): `server/src/index.js`
- [Account routes](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/routes/auth.js): `server/src/routes/auth.js`
- [Patient routes](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/routes/patient.js): `server/src/routes/patient.js`
- [Doctor routes](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/routes/doctor.js): `server/src/routes/doctor.js`
- [Role authorization](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/middleware/auth.js): `server/src/middleware/auth.js`

### Health records

- [User accounts](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/models/User.js): `server/src/models/User.js`
- [Patient profile](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/models/PatientProfile.js): `server/src/models/PatientProfile.js`
- [Assessment records](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/src/models/QuestionnaireResponse.js): `server/src/models/QuestionnaireResponse.js`

### Risk prediction

- [Prediction API](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/ml_service/app.py): `server/ml_service/app.py`
- [Prediction models](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/blob/main/server/ml_service/model_classes.py): `server/ml_service/model_classes.py`
- [Model artifacts](https://github.com/tanmay-g1/fetal_and_maternal_health_classifier/tree/main/server/ml_service/models): `server/ml_service/models`

### Other components

- **Patient or doctor**

## Connections

- Patient or doctor → Health guidance: views
- Patient or doctor → Pregnancy pages: views
- Express application → Health guidance: serves static files (evidence: `server/src/index.js`)
- Express application → Account routes: mounts routes (evidence: `server/src/index.js`)
- Express application → Patient routes: mounts routes (evidence: `server/src/index.js`)
- Express application → Doctor routes: mounts routes (evidence: `server/src/index.js`)
- Express application → User accounts: connects database (evidence: `server/src/index.js`)
- Account routes → User accounts: reads and creates (evidence: `server/src/routes/auth.js`)
- Patient routes → Role authorization: checks role (evidence: `server/src/routes/patient.js`)
- Doctor routes → Role authorization: checks role (evidence: `server/src/routes/doctor.js`)
- Patient routes → Assessment records: saves and reads (evidence: `server/src/routes/patient.js`)
- Patient routes → Patient profile: reads status (evidence: `server/src/routes/patient.js`)
- Patient routes → Prediction API: requests prediction (evidence: `server/src/routes/patient.js`)
- Doctor routes → User accounts: reads and updates (evidence: `server/src/routes/doctor.js`)
- Doctor routes → Patient profile: updates assessment (evidence: `server/src/routes/doctor.js`)
- Doctor routes → Assessment records: reads and deletes (evidence: `server/src/routes/doctor.js`)
- Doctor routes → Prediction API: requests prediction (evidence: `server/src/routes/doctor.js`)
- Prediction API → Prediction models: imports classes (evidence: `server/ml_service/app.py`)
- Prediction API → Model artifacts: loads artifacts (evidence: `server/ml_service/app.py`)
