An end-to-end Machine Learning project that predicts workplace incident outcomes using structured OSHA records and unstructured incident narratives. The solution combines data preprocessing, feature engineering, Natural Language Processing, and ensemble learning to support proactive workplace safety decisions.
- Project Overview
- Business Problem
- Objectives
- Dataset
- Tech Stack
- Project Workflow
- Repository Structure
- Exploratory Data Analysis
- Feature Engineering
- Machine Learning Pipeline
- Models Implemented
- Model Performance
- Key Business Insights
- Installation
- Running the Project
- Future Improvements
- Contributors
- Acknowledgements
Workplace injuries continue to impose significant operational, financial, and human costs across industries. Although organizations collect extensive incident records, these datasets are often used only for compliance reporting rather than predictive decision-making.
This project develops an AI-powered classification system capable of predicting workplace incident outcomes using historical OSHA Injury Tracking Application (ITA) Case Detail Data. By integrating structured organizational information with Natural Language Processing (NLP) features extracted from incident narratives, the model helps organizations identify high-risk incidents before they escalate.
The project follows a complete Data Science lifecycle including business understanding, exploratory data analysis, data preprocessing, feature engineering, machine learning, model evaluation, and business interpretation.
Traditional workplace safety management is reactive.
Organizations typically investigate incidents only after they occur, resulting in:
- Increased workplace injuries
- Higher compensation costs
- Productivity loss
- Regulatory penalties
- Delayed safety interventions
This project addresses these challenges by building a predictive system that estimates the likely outcome of a workplace incident using historical OSHA data.
- Predict workplace incident outcomes into four severity classes
- Analyze industry-level safety trends
- Extract insights from structured and textual OSHA data
- Compare multiple Machine Learning algorithms
- Select the most suitable production-ready model
- Support proactive workplace safety planning
Source
OSHA Injury Tracking Application (ITA) Case Detail Data
| Metric | Value |
|---|---|
| Original Records | 686,806 |
| Final Records | 683,962 |
| Original Features | 39 |
| Engineered Features | 586 |
| Text Columns | 7 |
| Target Classes | 4 |
- Days Away From Work
- Job Transfer / Restriction
- Other Recordable Case
- Death (Rare Class)
- Python
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-Learn
- LightGBM
- XGBoost
- Random Forest
- Logistic Regression
- TF-IDF Vectorization
- Frequency Encoding
- One-Hot Encoding
- Log Transformation
- Geospatial Encoding
- Temporal Feature Extraction
OSHA Dataset
β
βΌ
Business Understanding
β
βΌ
Data Cleaning
β
βΌ
Exploratory Data Analysis
β
βΌ
Feature Engineering
β
βΌ
Natural Language Processing
(TF-IDF)
β
βΌ
Feature Encoding
β
βΌ
Train-Test Split
β
βΌ
Model Training
β
βΌ
Model Evaluation
β
βΌ
Business Insights
AI-Workplace-Incident-Prediction
β
βββ data/
β
βββ notebooks/
β βββ Final_Capstone_GRP_5_2026.ipynb
β
βββ reports/
β βββ Interim_Report.pdf
β βββ Final_Report.pdf
β βββ Synopsis.pdf
β
βββ presentation/
β βββ Capstone_Presentation.pptx
β
βββ images/
β
βββ requirements.txt
β
βββ README.md
β
βββ LICENSE
The project includes extensive exploratory analysis to understand workplace injury patterns.
- California recorded the highest number of workplace incidents.
- Transportation and Healthcare sectors exhibited the highest safety risk.
- Physical injuries accounted for the majority of incidents.
- Death cases represented only 0.03% of the dataset, creating severe class imbalance.
- Most incidents occurred during regular working hours.
- Employee count and total hours worked showed strong positive correlation.
The preprocessing pipeline included:
- Duplicate removal
- Missing value treatment
- Identifier removal
- Outlier capping
- Datetime conversion
- Data type correction
- Feature scaling
- Class balancing
The project generated 586 predictive features.
- Incident Day
- Work Shift
- Season
- Weekend Indicator
- Hours After Shift Start
- Industry Sector
- SOC Group
- Working Hour
- Size Category
- Frequency Encoding
- One-Hot Encoding
- Label Encoding
Incident narratives from seven OSHA text columns were combined and transformed using TF-IDF Vectorization to generate 500 textual features.
The following models were trained and evaluated:
- Logistic Regression
- Random Forest
- XGBoost
- LightGBM
Evaluation Metrics
- Accuracy
- ROC-AUC
- Matthews Correlation Coefficient
- Cohen's Kappa
- Precision
- Recall
- F1 Score
| Model | Accuracy | ROC-AUC | MCC |
|---|---|---|---|
| Logistic Regression | 71.7% | 0.892 | 0.580 |
| Random Forest | 77.0% | 0.919 | 0.656 |
| XGBoost | 83.1% | 0.952 | 0.746 |
| β LightGBM | 82.7% | 0.953 | 0.742 |
- Accuracy: 82.7%
- ROC-AUC: 0.953
- MCC: 0.742
- Cohen's Kappa: 0.741
The LightGBM model was selected due to its strong overall performance, efficient handling of high-dimensional sparse features, and improved detection of the rare "Death" class compared to other evaluated models.
- Transportation and Healthcare industries represent the highest workplace safety risk.
- Physical injuries dominate OSHA incident records.
- Seasonal trends indicate increased workplace incidents during mid-year months.
- NLP-derived incident narratives significantly improve predictive performance.
- Machine Learning enables proactive safety planning instead of reactive reporting.
The application uses MySQL to store workplace incident prediction records generated by the Streamlit application.
| Component | Details |
|---|---|
| Database | osha_data_ai |
| Table | prediction_history |
| Connector | mysql-connector-python |
| Query Language | SQL |
User enters Incident Details
β
Streamlit Application
β
Data Preprocessing
β
LightGBM Prediction
β
Prediction + Confidence Score
β
save_prediction()
β
MySQL Database
β
prediction_history
Clone the repository
git clone https://github.com/yourusername/AI-Workplace-Incident-Prediction.gitMove into the project
cd AI-Workplace-Incident-PredictionInstall dependencies
pip install -r requirements.txtLaunch Jupyter Notebook
jupyter notebookOpen
Final_Capstone_GRP_5_2026.ipynb
Run all cells sequentially.
- Deploy the model using Streamlit or FastAPI
- Integrate transformer-based NLP models (BERT)
- Experiment with SMOTE and advanced imbalance learning techniques
- Real-time OSHA incident prediction dashboard
- Explainable AI using SHAP
- Cloud deployment using Azure or AWS
- Continuous model retraining with new OSHA records
The complete project presentation explains the business problem, data analysis, feature engineering, model development, evaluation, and business recommendations.
π₯ Download Presentation
β‘οΈ Capstone Presentation (PPTX)
- π Final Project Report
- π Jupyter Notebook
- Vikash Basfore
- Kavya Radheshwar
- Mumtaz Khan
- Mangasamudram Lokeswari
- Divyasree C.
- R. Haridharan
This project was successfully completed as part of the PGP in Data Science with Specialization in Generative AI Capstone Project.
Special thanks to:
- Great Learning for providing mentorship, guidance, and the capstone project framework.
- Occupational Safety and Health Administration (OSHA) for making the Injury Tracking Application (ITA) Case Detail Dataset publicly available.
- The Scikit-learn, LightGBM, XGBoost, Pandas, and NumPy open-source communities for developing powerful machine learning and data analysis libraries.
- My capstone teammates for their collaboration, discussions, and contributions throughout the project.
- All open-source contributors whose tools and documentation made this project possible.
This project was developed solely for educational and research purposes to demonstrate the practical application of Machine Learning and Natural Language Processing in workplace safety analytics.