How samarth3394/medical-insurance-cost-predictor works
This is a medical-insurance cost prediction application: users submit a health profile through a web interface, the FastAPI endpoint validates and encodes it, applies the saved model, and returns an estimated charge with model metrics. Separate capabilities include model exploration/training, a results dashboard, and health/model-info endpoints. The API implementation is excerpted; training and frontend details are documented in the README but their source contents were not sampled, so those relationships are shown only where documented.
Main entry points: main.py Prediction endpoint · model_results.json Model metrics · insurance_eda.ipynb EDA and training · index.html Prediction form
Components 16
Web experience
- Prediction form
templates/index.html - EDA dashboard
templates/dashboard.html - Page routes
app/main.py
Prediction API
- Prediction endpoint
app/main.py - Input validation
app/main.py - Feature encoding
app/main.py - Feature scaling
app/main.py - Saved predictor
model/model_bundle.pkl - Prediction response
app/main.py
Model lifecycle
- Insurance records
data/insurance.csv - EDA and training
notebooks/insurance_eda.ipynb - Model bundle
model/model_bundle.pkl - Model metrics
model/model_results.json
API status
- Health endpoint
app/main.py - Model-info endpoint
app/main.py
Other components
- Insurance user
Connections 17
- Insurance user → Prediction form: enters profile
README.md - Prediction form → Prediction endpoint: submits profile
README.md - Insurance user → EDA dashboard: opens dashboard
README.md - Page routes → Prediction form: renders page
app/main.py - Page routes → EDA dashboard: renders page
app/main.py - Prediction endpoint → Input validation: validates input
app/main.py - Prediction endpoint → Feature encoding: encodes features
app/main.py - Prediction endpoint → Feature scaling: scales features
app/main.py - Prediction endpoint → Saved predictor: predicts charge
app/main.py - Prediction endpoint → Prediction response: returns result
app/main.py - EDA and training → Insurance records: analyzes records
README.md - EDA and training → Model bundle: serializes model
README.md - EDA and training → Model metrics: records comparisons
README.md - Prediction endpoint → Model metrics: reads metrics
app/main.py - Page routes → Model metrics: provides dashboard data
app/main.py - Health endpoint → Model bundle: reports model
app/main.py - Model-info endpoint → Model metrics: returns comparisons
app/main.py