How johnwilfredd-curimo/health-insurance-premium-prediction works
The product is a health-insurance premium predictor, served through a Streamlit demo and a FastAPI JSON API. In either interface, a user supplies customer details; the API validates and maps its request, while the demo gathers the corresponding fields, and both call the shared prediction module. That module encodes features, derives medical-history risk, scales inputs, selects a model by age, and returns a premium. The README also documents a notebook-based modeling lifecycle. Its implementation and its connection to the shipped artifacts were not sampled, so those links remain unverified.
Main entry points: prediction.py Prediction entry · main.py FastAPI service · streamlit_app.py Streamlit demo · model_young.joblib Young model
Components 14
User interfaces
- Streamlit demo
streamlit_app.py - FastAPI service
api/main.py - Input validation
api/main.py - Premium response
api/main.py
Prediction runtime
- Prediction entry
src/prediction.py - Feature encoding
src/prediction.py - Medical risk scoring
src/prediction.py - Feature scaling
src/prediction.py - Age-based routing
src/prediction.py
Models and lifecycle
- Young model
artifacts/model_young.joblib - 26+ model
artifacts/model_rest.joblib - Fitted scalers
artifacts - Modeling notebook
Other components
- Agent / caller
Connections 15
- Agent / caller → Streamlit demo: enters details
streamlit_app.py - Agent / caller → FastAPI service: submits request
README.md - FastAPI service → Input validation: validates payload
api/main.py - Input validation → Prediction entry: maps and calls
api/main.py - Streamlit demo → Prediction entry: calls predict
streamlit_app.py - Prediction entry → Feature encoding: preprocesses input
src/prediction.py - Feature encoding → Medical risk scoring: calculates risk
src/prediction.py - Feature encoding → Feature scaling: scales features
src/prediction.py - Prediction entry → Age-based routing: routes by age
src/prediction.py - Age-based routing → Young model: predicts ages 18–25
src/prediction.py - Age-based routing → 26+ model: predicts ages 26+
src/prediction.py - Feature scaling → Fitted scalers: loads scaler pair
src/prediction.py - FastAPI service → Premium response: returns premium
api/main.py - Modeling notebook → Young model: produces trained models
- Modeling notebook → 26+ model: produces trained models