How darshanafk123/employee-attrition works
Employee Attrition Predictor accepts employee details through a Spring Boot API, validates them, forwards them to a Python Flask service, and returns a leave/stay prediction with probabilities. The Flask service validates inputs, fills unspecified profile features, encodes and scales the profile, then runs a trained Logistic Regression model. Training is a separate capability that produces the model and scaler artifacts consumed at runtime. The tree contains a frontend entry file, but its implementation was not sampled; its behavior is not inferred here.
Main entry points: PredictionController.java Prediction endpoint · app.py Prediction and health API · train_logistics.py Model training · PredictionService.java Upstream client
Components 15
Public API
- Prediction endpoint
springboot-service/src/main/java/com/attrition/controller/PredictionController.java - Input validation
springboot-service/src/main/java/com/attrition/dto/EmployeeInput.java - Error responses
springboot-service/src/main/java/com/attrition/exception/GlobalExceptionHandler.java - Upstream client
springboot-service/src/main/java/com/attrition/service/PredictionService.java
ML Prediction
- Prediction and health API
python-service/app.py - Input checks
python-service/app.py - Profile derivation
python-service/app.py - Model inference
python-service/app.py - Model and scaler
python-service/attrition_logistic_model.pkl
Model Training
- Model training
python-service/train_logistics.py - Training dataset
- Scaler artifact
python-service/data_scaler.pkl
Service Support
- Browser CORS
springboot-service/src/main/java/com/attrition/config/CorsConfig.java - Frontend entry
frontend/index.html
Other components
- API caller
Connections 15
- API caller → Prediction endpoint: submits prediction
README.md - Prediction endpoint → Input validation: validates input
springboot-service/src/main/java/com/attrition/controller/PredictionController.java - Prediction endpoint → Upstream client: requests prediction
springboot-service/src/main/java/com/attrition/controller/PredictionController.java - Upstream client → Prediction and health API: posts employee data
springboot-service/src/main/java/com/attrition/service/PredictionService.java - Prediction and health API → Input checks: checks request
python-service/app.py - Prediction and health API → Profile derivation: derives profile
python-service/app.py - Prediction and health API → Model inference: runs prediction
python-service/app.py - Model inference → Model and scaler: loads model
python-service/app.py - Model training → Training dataset: reads dataset
python-service/train_logistics.py - Model training → Model and scaler: writes model
python-service/train_logistics.py - Model training → Scaler artifact: writes scaler
python-service/train_logistics.py - Model inference → Scaler artifact: uses scaler
python-service/app.py - Prediction endpoint → Error responses: routes exceptions
springboot-service/src/main/java/com/attrition/controller/PredictionController.java - Frontend entry → Prediction endpoint: browser requests
README.md - Browser CORS → Prediction endpoint: allows browser requests
springboot-service/src/main/java/com/attrition/config/CorsConfig.java