InsurAI is an end-to-end Machine Learning powered health insurance analytics platform that predicts medical insurance charges, evaluates customer health risk, segments customers using clustering, and generates underwriting recommendations.
The project integrates a trained Machine Learning model with a FastAPI backend and a modern Next.js frontend to provide real-time insurance analytics through an interactive dashboard.
Traditional insurance cost estimation often relies on broad assumptions and manual risk assessment.
InsurAI demonstrates how Machine Learning and rule-based analytics can be combined to build an intelligent insurance decision-support system.
The platform processes customer information through a complete analytics pipeline:
Customer Information
โ
Insurance Charge Prediction
โ
Health Risk Assessment
โ
Customer Segmentation
โ
Underwriting Recommendation
โ
Interactive Dashboard
Predicts estimated medical insurance charges based on customer information such as:
- Age
- Gender
- BMI
- Number of Children
- Smoking Status
The prediction model is trained using historical medical insurance data.
Example output:
Predicted Insurance Charges: โน24,850
Calculates a health risk score from 0โ100 using factors such as:
- Age
- BMI
- Smoking Status
- Number of Children
Customers are categorized into:
- Low Risk
- Moderate Risk
- High Risk
Example:
Risk Score: 64.5
Risk Category: High Risk
Uses K-Means Clustering to group customers based on:
- Age
- BMI
- Number of Children
- Predicted Insurance Charges
Customer segments include:
- Young Healthy Adult
- Family Protector
- High Risk Individual
- Senior Citizen
Example:
Cluster: 1
Segment: Family Protector
Generates underwriting recommendations based on:
- Health Risk Score
- Predicted Insurance Charges
Possible recommendations include:
Basic Coverage
Standard Coverage
Premium Plan + Medical Screening
Example:
Risk Level: High
Recommendation:
Premium Plan + Medical Screening
The backend is built using FastAPI and exposes REST API endpoints for each analytics feature.
Available endpoints:
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
API health/welcome endpoint |
| POST | /predict |
Predict insurance charges |
| POST | /risk-score |
Calculate health risk score |
| POST | /segment |
Predict customer segment |
| POST | /underwriting |
Generate underwriting recommendation |
Interactive API documentation is available through Swagger UI.
http://127.0.0.1:8000/docs
The frontend is built with Next.js and TypeScript.
It provides:
- Customer profile input form
- Real-time prediction results
- Insurance charge visualization
- Health risk score display
- Customer segment display
- Underwriting recommendation
- Loading states
- Error handling
- Responsive design
- Smooth UI animations
When a user submits customer information, the frontend executes the following pipeline:
Next.js Prediction Form
โ
POST /predict
โ
Predicted Insurance Charges
โ
POST /risk-score
โ
Risk Score + Risk Category
โ
POST /segment
โ
Customer Segment
โ
POST /underwriting
โ
Risk Level + Recommendation
โ
Interactive Results Dashboard
This demonstrates complete integration between:
Frontend
โ
REST API
โ
Machine Learning Model
โ
Analytics Engines
โ
Dashboard
The dataset was analyzed to understand:
- Feature distributions
- Relationships between variables
- Correlation with insurance charges
- Impact of smoking
- Impact of BMI
- Impact of age
The preprocessing workflow includes:
- Data inspection
- Categorical encoding
- Feature engineering
- Feature selection
- Train-test splitting
Additional BMI-based categories were explored during preprocessing:
Underweight
Normal
Overweight
Obese
Categorical variables were converted into machine-readable numerical representations.
A regression model predicts medical insurance charges.
Core input features used by the deployed prediction pipeline:
age
sex
bmi
children
smoker
K-Means Clustering is used for unsupervised customer segmentation.
Clustering features:
age
bmi
children
predicted_charges
The clustering pipeline uses feature scaling before K-Means prediction.
- Next.js
- React
- TypeScript
- Tailwind CSS
- Framer Motion
- Axios
- Lucide React
- FastAPI
- Python
- Uvicorn
- Scikit-learn
- Pandas
- NumPy
- Joblib
- Jupyter Notebook
- Git
- GitHub
- VS Code
- Swagger UI
InsurAI/
โ
โโโ backend/
โ โโโ app.py
โ โ
โ โโโ routes/
โ โ โโโ predict.py
โ โ โโโ risk.py
โ โ โโโ segmentation.py
โ โ โโโ underwriting.py
โ โ
โ โโโ utils/
โ โโโ risk_score.py
โ โโโ segment.py
โ โโโ underwriting_rules.py
โ
โโโ dataset/
โ โโโ insurance.csv
โ
โโโ frontend/
โ โโโ app/
โ โโโ components/
โ โโโ lib/
โ โโโ public/
โ โโโ types/
โ โโโ package.json
โ โโโ tailwind.config.ts
โ
โโโ ml/
โ โโโ notebooks/
โ โ โโโ Model_Training.ipynb
โ โ
โ โโโ saved_models/
โ โ โโโ insurance_model.pkl
โ โ โโโ feature_names.pkl
โ โ โโโ kmeans_model.pkl
โ โ โโโ scaler.pkl
โ โ
โ โโโ training/
โ โโโ customer_segmentation.py
โ
โโโ README.md
The project uses a medical insurance dataset containing customer demographic and health-related information.
| Feature | Description |
|---|---|
age |
Age of insured person |
sex |
Gender |
bmi |
Body Mass Index |
children |
Number of dependents |
smoker |
Smoking status |
region |
Residential region |
charges |
Medical insurance charges |
Target variable:
charges
git clone <your-repository-url>
cd InsurAIpip install fastapi uvicorn pandas numpy scikit-learn joblibFrom the project root:
python -m uvicorn backend.app:app --reloadBackend server:
http://127.0.0.1:8000
Swagger documentation:
http://127.0.0.1:8000/docs
Open another terminal:
cd frontend
npm installnpm run devFrontend application:
http://localhost:3000
Endpoint:
POST /predict
Example request:
{
"age": 25,
"sex": "male",
"bmi": 24.5,
"children": 1,
"smoker": "no"
}Example response:
{
"predicted_charges": 8420.5
}Endpoint:
POST /risk-score
Example request:
{
"age": 25,
"bmi": 24.5,
"smoker": "no",
"children": 1
}Example response:
{
"risk_score": 24.25,
"risk_category": "Low Risk"
}Endpoint:
POST /segment
Example request:
{
"age": 25,
"bmi": 24.5,
"children": 1,
"predicted_charges": 8420.5
}Example response:
{
"cluster": 0,
"segment": "Young Healthy Adult"
}Endpoint:
POST /underwriting
Example request:
{
"risk_score": 24.25,
"predicted_charges": 8420.5
}Example response:
{
"risk_level": "Low",
"recommendation": "Basic Coverage"
}- Estimate potential medical insurance charges
- Understand health risk classification
- Receive a simplified insurance profile
- Customer risk profiling
- Customer segmentation
- Underwriting decision support
- Data-driven insurance analytics
Add screenshots of the working application here.
Suggested screenshots:
1. Landing Page
2. Prediction Form
3. Complete Prediction Dashboard
4. Swagger API Documentation
Example:

Potential future improvements include:
- SHAP-based model explainability
- Advanced ensemble regression models
- Model comparison experiments
- Database-backed prediction history
- User authentication
- Cloud deployment
- Docker containerization
- Automated testing
- CI/CD pipeline
- Model monitoring
- Real claim prediction using claim-labeled datasets
InsurAI demonstrates practical experience with:
- End-to-end Machine Learning development
- Regression modeling
- Unsupervised learning with K-Means
- Feature preprocessing
- Model serialization with Joblib
- REST API development with FastAPI
- Frontend development with Next.js
- Type-safe API integration with TypeScript
- Frontend-backend integration
- Error handling
- ML model deployment architecture
Satyam Kulkarni
AI & Data Science Student
InsurAI v1 โ Completed
Core functionality is implemented and working end-to-end:
- โ Insurance Charge Prediction
- โ Health Risk Scoring
- โ Customer Segmentation
- โ Underwriting Recommendation
- โ FastAPI Backend
- โ Next.js Frontend
- โ Frontend-Backend Integration