Your Aadhaar Analytics Platform now features a complete ML pipeline with dynamic, AI-generated insights and suggestions using the Gemini API.
- Train a Random Forest model on your Aadhaar dataset
- Model automatically saves as
aadhaar_model.pkl - Reusable across sessions without retraining
- Loads the
.pklmodel file - Generates predictions on your data
- Computes statistical summaries (total, mean, max, min, by state)
- Sends prediction data to Gemini API
- Generates professional policy insights with:
- Finding: What the data reveals
- Impact: Operational implications
- Recommendation: Actionable next steps
- Takes the generated insight as input
- Uses Gemini API to create 3-5 specific, actionable suggestions
- Tailored to UIDAI operations and policy
1. Upload Dataset → 2. Train Model → 3. Generate Predictions → 4. Ask Questions → 5. Get AI Insights + Suggestions
- Go to Predictive Model page
- Click "Train Prediction Model"
- Model trains and saves as
aadhaar_model.pkl - View R² score and MAE metrics
- Click "Generate Predictions"
- View predicted activity statistics
- See sample predictions in table
- Go to Insight Chat page
- Type your question (e.g., "What are the predicted trends?")
- Choose:
- Get Insight: AI-generated insight only
- Get Insight + Suggestions: Insight + actionable suggestions
run_model_pipeline(df)- Train model and save as .pklload_model()- Load trained model from .pklmake_predictions(df)- Generate predictions using modelget_prediction_summary(df, predictions)- Compute statistics
classify_intent(question)- Check if question is Aadhaar-relatedgenerate_insight_from_predictions(data, question)- Generate insight from predictionsgenerate_suggestions_from_insight(insight)- Generate actionable suggestions
respond_to_query(query, df)- Main query handler with dynamic insightsget_dynamic_suggestions(query, df)- Get both insight + suggestions
generate_insights(df)- Basic statistical insightsgenerate_prediction_insights(predictions_df)- Prediction-specific insights
Ensure GEMINI_API_KEY is set:
setx GEMINI_API_KEY "your-api-key-here"- "What are the predicted activity trends for high-population states?"
- "Which regions will require more resources based on predictions?"
- "What demographic patterns do the predictions reveal?"
- "How should UIDAI allocate infrastructure based on forecasts?"
✅ Persistent Model - Train once, use many times via .pkl file
✅ Dynamic Insights - AI analyzes predictions in real-time
✅ Actionable Suggestions - Specific recommendations from Gemini
✅ Smart Intent Detection - Filters non-Aadhaar questions
✅ Fallback Handling - Static responses if model not trained
✅ State-wise Analysis - Regional breakdowns in predictions
- If model not found → Prompts to train model first
- If Gemini API fails → Returns formatted fallback responses
- If prediction fails → Uses static insights from data
- Data-Driven Decisions: Predictions inform resource allocation
- AI-Powered Analysis: Gemini interprets complex patterns
- Actionable Outputs: Clear recommendations for policy makers
- Scalable: Train on new data anytime
- Professional Format: Finding/Impact/Recommendation structure