# bharathmrr/mlops-complte-on-medical-insurance-cost-dataset architecture

> Architecture diagram of the GitHub repository bharathmrr/mlops-complte-on-medical-insurance-cost-dataset, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset
- Repository: https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset

## Overview

This repository is a medical-insurance-charge regression application with a Flask prediction interface and a manually runnable data-to-model workflow. The code shows ingestion and splitting, feature transformation, random-forest training, evaluation, and serving; the README additionally describes DVC versioning and MLflow tracking, but those implementation files are absent from the tree. The documented FastAPI, CI/CD, and infrastructure claims do not match the sampled Flask code or available paths, so they are not represented as implemented components.

Main entry points: [`src/model_evalaution.py`](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/src/model_evalaution.py) (Model evaluation), [`app.py`](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/app.py) (Flask prediction API), [`data/transform`](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/tree/main/data/transform) (Transformed data), [`models/random_forest_model.pkl`](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/models/random_forest_model.pkl) (Trained model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_raw["Insurance data<br/>[insurance.csv]"]
  node_ingest["Load and split<br/>[data_ingestion.py]"]
  node_processed["Split datasets"]
  node_transform["Feature transform"]
  node_features["Transformed data"]
end

subgraph group_model["Model lifecycle"]
  node_train["Random forest training<br/>[model_training.py]"]
  node_model_file[("Trained model")]
  node_evaluate["Model evaluation"]
  node_metrics["Evaluation metrics"]
end

subgraph group_serving["Prediction serving"]
  node_web["Prediction interface<br/>[index.html]"]
  node_api["Flask prediction API<br/>[app.py]"]
end

node_user(("Prediction user"))
node_client(("Web client"))

node_ingest -->|"reads"| node_raw
node_ingest -->|"writes split"| node_processed
node_transform -->|"reads"| node_processed
node_transform -->|"writes transformed"| node_features
node_train -->|"reads"| node_features
node_train -->|"saves"| node_model_file
node_evaluate -->|"loads"| node_model_file
node_evaluate -->|"reads test data"| node_features
node_evaluate -->|"writes metrics"| node_metrics
node_client -.->|"opens"| node_web
node_web -.->|"submits prediction"| node_api
node_user -->|"requests prediction"| node_api
node_api -->|"loads for prediction"| node_model_file

click node_raw "https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/data/insurance.csv"
click node_ingest "https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/src/data_ingestion.py"
click node_processed "https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/tree/main/data/processed"
click node_transform "https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/src/data_preprocessing.py"
click node_features "https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/tree/main/data/transform"
click node_train "https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/src/model_training.py"
click node_model_file "https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/models/random_forest_model.pkl"
click node_evaluate "https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/src/model_evalaution.py"
click node_metrics "https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/tree/main/reports/evaluation"
click node_web "https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/templates/index.html"
click node_api "https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/app.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_raw,node_ingest,node_processed,node_transform,node_features,node_user,node_client toneBlue
class node_train,node_model_file,node_evaluate,node_metrics toneAmber
class node_web,node_api toneMint
```

## Components

### Data preparation

- [Insurance data](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/data/insurance.csv): `data/insurance.csv`
- [Load and split](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/src/data_ingestion.py): `src/data_ingestion.py`
- [Split datasets](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/tree/main/data/processed): `data/processed`
- [Feature transform](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/src/data_preprocessing.py): `src/data_preprocessing.py`
- [Transformed data](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/tree/main/data/transform): `data/transform`

### Model lifecycle

- [Random forest training](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/src/model_training.py): `src/model_training.py`
- [Trained model](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/models/random_forest_model.pkl): `models/random_forest_model.pkl`
- [Model evaluation](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/src/model_evalaution.py): `src/model_evalaution.py`
- [Evaluation metrics](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/tree/main/reports/evaluation): `reports/evaluation`

### Prediction serving

- [Prediction interface](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/templates/index.html): `templates/index.html`
- [Flask prediction API](https://github.com/bharathmrr/mlops-complte-on-medical-insurance-cost-dataset/blob/main/app.py): `app.py`

### Other components

- **Prediction user**
- **Web client**

## Connections

- Load and split → Insurance data: reads (evidence: `src/data_ingestion.py`)
- Load and split → Split datasets: writes split (evidence: `src/data_ingestion.py`)
- Feature transform → Split datasets: reads (evidence: `src/data_preprocessing.py`)
- Feature transform → Transformed data: writes transformed (evidence: `src/data_preprocessing.py`)
- Random forest training → Transformed data: reads (evidence: `src/model_training.py`)
- Random forest training → Trained model: saves (evidence: `src/model_training.py`)
- Model evaluation → Trained model: loads (evidence: `src/model_evalaution.py`)
- Model evaluation → Transformed data: reads test data (evidence: `src/model_evalaution.py`)
- Model evaluation → Evaluation metrics: writes metrics (evidence: `src/model_evalaution.py`)
- Web client → Prediction interface: opens
- Prediction interface → Flask prediction API: submits prediction
- Prediction user → Flask prediction API: requests prediction (evidence: `app.py`)
- Flask prediction API → Trained model: loads for prediction (evidence: `app.py`)
