# vinay-vk-kumar/predict-cpi architecture

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

- Interactive diagram: https://gitdiagram.com/vinay-vk-kumar/predict-cpi
- Repository: https://github.com/vinay-vk-kumar/predict-cpi

## Overview

Predict-CPI is a Flask web app that predicts the General CPI index from 29 user-supplied CPI components. The main workflow is browser form → validation and feature ordering → loaded model prediction → displayed result. The app also exposes feature, sample-data, model-info, and health endpoints. README describes dataset preprocessing and Lasso training, but no training code is present in the tree, so those steps are not represented as runtime components.

Main entry points: [`app.py`](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py) (Flask web app), [`templates/index.html`](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/templates/index.html) (CPI input form), [`model.pkl`](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/model.pkl) (Prediction model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web interface"]
  node_form["CPI input form<br/>[index.html]"]
end

subgraph group_prediction["Prediction runtime"]
  node_web["Flask web app<br/>[app.py]"]
  node_validate["Input validation<br/>[app.py]"]
  node_prepare["Feature ordering<br/>[app.py]"]
  node_model_load["Model loading<br/>[app.py]"]
  node_model["Prediction model<br/>[model.pkl]"]
  node_result["Prediction response<br/>[app.py]"]
end

subgraph group_api["Data and status API"]
  node_features["Feature listing<br/>[app.py]"]
  node_sample["Sample CPI data<br/>[app.py]"]
  node_info["Model information<br/>[app.py]"]
  node_health["Health status<br/>[app.py]"]
end

node_user(("User"))

node_user -->|"enters values"| node_form
node_form -->|"submits POST"| node_web
node_web -->|"validates input"| node_validate
node_web -->|"orders features"| node_prepare
node_web -->|"loads if needed"| node_model_load
node_model_load -->|"reads pickle"| node_model
node_web -->|"requests prediction"| node_model
node_web -->|"returns result"| node_result
node_result -->|"displays prediction"| node_form
node_user -->|"requests features"| node_features
node_user -->|"requests sample"| node_sample
node_user -->|"requests model info"| node_info
node_info -->|"loads if needed"| node_model_load
node_user -->|"checks status"| node_health

click node_form "https://github.com/vinay-vk-kumar/predict-cpi/blob/main/templates/index.html"
click node_web "https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py"
click node_validate "https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py"
click node_prepare "https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py"
click node_model_load "https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py"
click node_model "https://github.com/vinay-vk-kumar/predict-cpi/blob/main/model.pkl"
click node_result "https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py"
click node_features "https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py"
click node_sample "https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py"
click node_info "https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py"
click node_health "https://github.com/vinay-vk-kumar/predict-cpi/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_form,node_user toneBlue
class node_web,node_validate,node_prepare,node_model_load,node_model,node_result toneAmber
class node_features,node_sample,node_info,node_health toneMint
```

## Components

### Web interface

- [CPI input form](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/templates/index.html): `templates/index.html`

### Prediction runtime

- [Flask web app](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py): `app.py`
- [Input validation](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py): `app.py`
- [Feature ordering](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py): `app.py`
- [Model loading](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py): `app.py`
- [Prediction model](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/model.pkl): `model.pkl`
- [Prediction response](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py): `app.py`

### Data and status API

- [Feature listing](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py): `app.py`
- [Sample CPI data](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py): `app.py`
- [Model information](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py): `app.py`
- [Health status](https://github.com/vinay-vk-kumar/predict-cpi/blob/main/app.py): `app.py`

### Other components

- **User**

## Connections

- User → CPI input form: enters values
- CPI input form → Flask web app: submits POST
- Flask web app → Input validation: validates input
- Flask web app → Feature ordering: orders features
- Flask web app → Model loading: loads if needed
- Model loading → Prediction model: reads pickle
- Flask web app → Prediction model: requests prediction
- Flask web app → Prediction response: returns result
- Prediction response → CPI input form: displays prediction
- User → Feature listing: requests features
- User → Sample CPI data: requests sample
- User → Model information: requests model info
- Model information → Model loading: loads if needed
- User → Health status: checks status
