# preethisomasundaram/menstracare architecture

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

- Interactive diagram: https://gitdiagram.com/preethisomasundaram/menstracare
- Repository: https://github.com/preethisomasundaram/menstracare

## Overview

MenstraCare is a PCOS prediction and model-evaluation web app: users enter clinical features, choose a trained model, and receive a prediction and probability; a separate results page displays evaluation metrics and visualizations. The graph follows the documented browser/API workflow and the sampled FastAPI and JavaScript. Model artifacts and results metadata are documented as backend inputs; their individual contents and page markup were not sampled.

Main entry points: [`backend/app.py`](https://github.com/preethisomasundaram/menstracare/blob/master/backend/app.py) (FastAPI app and static host), [`frontend/js/prediction.js`](https://github.com/preethisomasundaram/menstracare/blob/master/frontend/js/prediction.js) (Prediction form), [`frontend/js/training-results.js`](https://github.com/preethisomasundaram/menstracare/blob/master/frontend/js/training-results.js) (Results dashboard), [`backend/models`](https://github.com/preethisomasundaram/menstracare/tree/master/backend/models) (Feature and target metadata)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_prediction_ui["Prediction form<br/>[prediction.js]"]
  node_results_ui["Results dashboard"]
  node_shared_ui["Theme and navigation<br/>[common.js]"]
end

subgraph group_service["Prediction service"]
  node_api_host["FastAPI app and static host<br/>[app.py]"]
  node_model_info["Form schema and model list<br/>[app.py]"]
  node_predictor["Prediction endpoint<br/>[app.py]"]
end

subgraph group_evaluation["Model evaluation"]
  node_results_endpoint["Training-results endpoint<br/>[app.py]"]
  node_results_render["Metrics and chart rendering"]
end

subgraph group_artifacts["Model artifacts"]
  node_pipeline_set["Trained pipelines"]
  node_deployment_config["Deployment configuration"]
  node_feature_schema["Feature and target metadata"]
  node_metrics["Model performance metrics"]
  node_training_artifacts["Evaluation visual data"]
end

node_visitor(("User"))

node_visitor -->|"enters features"| node_prediction_ui
node_prediction_ui -->|"requests schema"| node_model_info
node_model_info -->|"reads metadata"| node_feature_schema
node_model_info -->|"reads model list"| node_deployment_config
node_prediction_ui -->|"posts model and features"| node_predictor
node_predictor -->|"loads and invokes pipeline"| node_pipeline_set
node_predictor -->|"validates and orders inputs"| node_feature_schema
node_predictor -->|"returns prediction"| node_prediction_ui
node_visitor -->|"opens results"| node_results_ui
node_results_ui -->|"requests evaluation data"| node_results_endpoint
node_results_endpoint -->|"reads metrics"| node_metrics
node_results_endpoint -->|"reads visual data"| node_training_artifacts
node_results_endpoint -->|"returns evaluation data"| node_results_render
node_results_render -->|"renders dashboard"| node_results_ui
node_api_host -->|"loads configuration"| node_deployment_config
node_api_host -->|"loads models"| node_pipeline_set
node_api_host -->|"loads metadata"| node_feature_schema
node_api_host -->|"loads metrics"| node_metrics
node_api_host -->|"loads artifacts"| node_training_artifacts

click node_prediction_ui "https://github.com/preethisomasundaram/menstracare/blob/master/frontend/js/prediction.js"
click node_results_ui "https://github.com/preethisomasundaram/menstracare/blob/master/frontend/js/training-results.js"
click node_shared_ui "https://github.com/preethisomasundaram/menstracare/blob/master/frontend/js/common.js"
click node_api_host "https://github.com/preethisomasundaram/menstracare/blob/master/backend/app.py"
click node_model_info "https://github.com/preethisomasundaram/menstracare/blob/master/backend/app.py"
click node_predictor "https://github.com/preethisomasundaram/menstracare/blob/master/backend/app.py"
click node_pipeline_set "https://github.com/preethisomasundaram/menstracare/tree/master/backend/models"
click node_deployment_config "https://github.com/preethisomasundaram/menstracare/blob/master/backend/models/deployment_config.json"
click node_feature_schema "https://github.com/preethisomasundaram/menstracare/tree/master/backend/models"
click node_metrics "https://github.com/preethisomasundaram/menstracare/blob/master/backend/models/model_performance.json"
click node_training_artifacts "https://github.com/preethisomasundaram/menstracare/blob/master/backend/models/training_artifacts.json"
click node_results_endpoint "https://github.com/preethisomasundaram/menstracare/blob/master/backend/app.py"
click node_results_render "https://github.com/preethisomasundaram/menstracare/blob/master/frontend/js/training-results.js"

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_prediction_ui,node_results_ui,node_shared_ui,node_visitor toneBlue
class node_api_host,node_model_info,node_predictor toneAmber
class node_results_endpoint,node_results_render toneMint
class node_pipeline_set,node_deployment_config,node_feature_schema,node_metrics,node_training_artifacts toneRose
```

## Components

### Web interface

- [Prediction form](https://github.com/preethisomasundaram/menstracare/blob/master/frontend/js/prediction.js): `frontend/js/prediction.js`
- [Results dashboard](https://github.com/preethisomasundaram/menstracare/blob/master/frontend/js/training-results.js): `frontend/js/training-results.js`
- [Theme and navigation](https://github.com/preethisomasundaram/menstracare/blob/master/frontend/js/common.js): `frontend/js/common.js`

### Prediction service

- [FastAPI app and static host](https://github.com/preethisomasundaram/menstracare/blob/master/backend/app.py): `backend/app.py`
- [Form schema and model list](https://github.com/preethisomasundaram/menstracare/blob/master/backend/app.py): `backend/app.py`
- [Prediction endpoint](https://github.com/preethisomasundaram/menstracare/blob/master/backend/app.py): `backend/app.py`

### Model evaluation

- [Training-results endpoint](https://github.com/preethisomasundaram/menstracare/blob/master/backend/app.py): `backend/app.py`
- [Metrics and chart rendering](https://github.com/preethisomasundaram/menstracare/blob/master/frontend/js/training-results.js): `frontend/js/training-results.js`

### Model artifacts

- [Trained pipelines](https://github.com/preethisomasundaram/menstracare/tree/master/backend/models): `backend/models`
- [Deployment configuration](https://github.com/preethisomasundaram/menstracare/blob/master/backend/models/deployment_config.json): `backend/models/deployment_config.json`
- [Feature and target metadata](https://github.com/preethisomasundaram/menstracare/tree/master/backend/models): `backend/models`
- [Model performance metrics](https://github.com/preethisomasundaram/menstracare/blob/master/backend/models/model_performance.json): `backend/models/model_performance.json`
- [Evaluation visual data](https://github.com/preethisomasundaram/menstracare/blob/master/backend/models/training_artifacts.json): `backend/models/training_artifacts.json`

### Other components

- **User**

## Connections

- User → Prediction form: enters features (evidence: `frontend/js/prediction.js`)
- Prediction form → Form schema and model list: requests schema (evidence: `frontend/js/prediction.js`)
- Form schema and model list → Feature and target metadata: reads metadata (evidence: `backend/app.py`)
- Form schema and model list → Deployment configuration: reads model list (evidence: `backend/app.py`)
- Prediction form → Prediction endpoint: posts model and features (evidence: `frontend/js/prediction.js`)
- Prediction endpoint → Trained pipelines: loads and invokes pipeline (evidence: `backend/app.py`)
- Prediction endpoint → Feature and target metadata: validates and orders inputs (evidence: `backend/app.py`)
- Prediction endpoint → Prediction form: returns prediction (evidence: `frontend/js/prediction.js`)
- User → Results dashboard: opens results (evidence: `README.md`)
- Results dashboard → Training-results endpoint: requests evaluation data (evidence: `frontend/js/training-results.js`)
- Training-results endpoint → Model performance metrics: reads metrics (evidence: `backend/app.py`)
- Training-results endpoint → Evaluation visual data: reads visual data (evidence: `backend/app.py`)
- Training-results endpoint → Metrics and chart rendering: returns evaluation data (evidence: `frontend/js/training-results.js`)
- Metrics and chart rendering → Results dashboard: renders dashboard (evidence: `frontend/js/training-results.js`)
- FastAPI app and static host → Deployment configuration: loads configuration (evidence: `backend/app.py`)
- FastAPI app and static host → Trained pipelines: loads models (evidence: `backend/app.py`)
- FastAPI app and static host → Feature and target metadata: loads metadata (evidence: `backend/app.py`)
- FastAPI app and static host → Model performance metrics: loads metrics (evidence: `backend/app.py`)
- FastAPI app and static host → Evaluation visual data: loads artifacts (evidence: `backend/app.py`)
