Workers who inspect and clean drains and sewers face a combination of oxygen deficiency, toxic and flammable gases, heat and flooding, yet routine practice still depends on visual checks and instruments that report one quantity at a time. This paper describes a software prototype, the AI-Based Drainage Safety Assistant, that merges six environmental readings (O2, H2S, CH4, temperature, humidity and water level) into one risk verdict of Safe, Warning or Danger. Readings are validated and placed in a fixed feature order, then classified by a Random Forest model built with Scikit-learn. A Flask dashboard shows each reading, the colour-coded verdict and a matching recommendation, and a buzzer or on-screen alarm is triggered for Danger. The model was trained and tested on a simulated dataset of 198 labelled records. On a stratified 80/20 hold-out split it reached 87.5% accuracy, and four-fold cross-validation gave 83.8% ± 1.5%, against 77.3% for a majority-class guess. Danger was recognised well (98.0% recall in pooled cross-validation), Warning poorly, and Safe could not be learned because it has only four examples; errors leaned towards over-warning. Seven other classifiers scored 80.8% to 86.4%, so no superiority of the Random Forest is claimed. Because the data are simulated, the findings demonstrate that the pipeline works and do not certify field safety; limits and a route towards calibrated sensors, real data and a rule-based safeguard are discussed.
Introduction
The text presents an AI-based Drainage and Sewer Safety Monitoring System designed to improve the safety of workers operating in confined spaces such as drains, manholes, and sewer systems. These environments expose workers to serious hazards, including toxic hydrogen sulphide (H?S), flammable methane (CH?), oxygen deficiency, high temperatures, and sudden increases in water levels. Traditional safety practices often depend on portable gas detectors and manual interpretation of individual sensor readings, which can make it difficult to assess multiple hazards simultaneously.
To address this problem, the proposed system integrates multiple environmental parameters with a machine learning-based classification model to provide a simple and understandable safety status. The system uses a Random Forest classifier to categorize drainage conditions into three classes: Safe, Warning, and Danger. Its primary objective is to assist workers and safety personnel in identifying potential risks and receiving early warnings.
The literature survey examines occupational safety guidelines and existing research related to hazardous gases, confined-space safety, machine learning algorithms, and web-based monitoring technologies. Previous studies explain the dangers of toxic gases and oxygen deficiency and establish the importance of atmospheric testing, ventilation, and supervised entry. However, they generally address individual gas hazards or safety procedures rather than providing an integrated system that combines multiple sensor readings with automated risk classification.
The research identifies a major gap in the availability of a compact, reproducible application that combines multi-parameter environmental monitoring, machine learning-based risk assessment, a web dashboard, and an alert mechanism.
The proposed system considers six important environmental parameters:
Oxygen concentration (%).
Hydrogen sulphide concentration (H?S in ppm).
Methane concentration (CH? in ppm).
Temperature (°C).
Relative humidity (%).
Water level (cm).
The methodology consists of five main modules: input, preprocessing, classification, presentation, and alerting. The input readings are collected from simulated data or manually entered values. During preprocessing, missing values and invalid inputs are checked, and all six parameters are arranged in a fixed feature order.
The Random Forest model consists of 100 decision trees trained using labelled datasets. The model uses an 80:20 stratified training-testing split and predicts the appropriate safety category through majority voting. The trained model and label encoder are saved using Joblib for integration with the web application.
The presentation and alerting module uses a Flask-based dashboard to display the predicted safety condition through colour-coded indicators:
Safe (Green): Continue routine monitoring.
Warning (Amber): Proceed with caution and arrange further inspection.
Danger (Red): Do not enter, alert safety personnel, and activate the alarm.
The proposed hardware implementation includes electrochemical oxygen and H?S sensors, methane sensors, temperature and humidity sensors, and ultrasonic or float-based water-level sensors. A low-power microcontroller can collect these readings and transmit them to the Flask application through wired or wireless communication. A buzzer can provide an additional warning when a Danger condition is detected.
The implementation uses Python, Flask, Scikit-learn, Pandas, and Joblib. Importantly, the initial evaluation is based on a simulated dataset, so the system's predictions require further validation using real sensor measurements and actual drainage conditions.
Conclusion
The assistant shows that six drainage readings can be fused into a single colour-coded verdict with a Random Forest and delivered through a lightweight Flask dashboard. On simulated data it beat a majority-class baseline (87.5 % hold-out, 83.8 % cross-validated) and recognised Danger reliably (98.0 % recall in pooled cross-validation), with errors leaning towards over-warning. Other standard classifiers scored 80.8 % to 86.4 %, so the Random Forest is not claimed to be the best model on this data, and the evaluation exposes the need for balanced, realistic labels. Planned work: connect physical IoT sensors; collect and label field data with expert input; add the rule-based safeguard and sensor-fault handling; revisit the choice of classifier on real data; send SMS, e-mail or app notifications; store history for trend analysis; add flood forecasting from rainfall data; support GPS location of manholes; and offer a Tamil-language interface for sanitation workers.
References
[1] World Health Organization (WHO), “Hydrogen Sulfide,” Public Health and Environmental Information.
[2] Occupational Safety and Health Administration (OSHA), “Permit-Required Confined Spaces,” U.S. Department of Labor.
[3] NIOSH, “Preventing Occupational Fatalities in Confined Spaces.”
[4] NIOSH, “NIOSH Pocket Guide to Chemical Hazards: Hydrogen Sulfide.”
[5] NIOSH, “NIOSH Pocket Guide to Chemical Hazards: Methane.”
[6] NIOSH, “Criteria for a Recommended Standard: Working in Confined Spaces.”
[7] L. Breiman, “Random Forests,” Machine Learning, vol. 45, pp. 5–32, 2001.
[8] [8] C. Cortes and V. Vapnik, “Support-Vector Networks,” Machine Learning, vol. 20, pp. 273–297, 1995.
[9] [9] J. Han, M. Kamber and J. Pei, Data Mining: Concepts and Techniques, Morgan Kaufmann.
[10] A. Géron, Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, O’Reilly Media.
[11] Pallets Projects, “Flask Documentation.”
[12] Python Software Foundation, “Python Documentation.”
[13] Scikit-learn Developers, “Random Forest Classifier Documentation.”
[14] Scikit-learn Developers, “Data Preprocessing Documentation.”
[15] W. McKinney, “Data Structures for Statistical Computing in Python,” Proc. 9th Python in Science Conf., pp. 56–61, 2010.
[16] F. Pedregosa et al., “Scikit-learn: Machine Learning in Python,” J. Mach. Learn. Res., vol. 12, pp. 2825–2830, 2011.
[17] R. S. Pressman and B. R. Maxim, Software Engineering: A Practitioner’s Approach, McGraw-Hill.