Changelog
All notable changes to the EduBotX ML API will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[3.0.0]
Breaking Changes
- Removed deprecated V1 reusability endpoint (
/api/predict/reusabilitywith basic response) - Removed deprecated endpoints:
/predict,/recommend-treatment - Renamed V2 reusability to main endpoint -
/api/predict/reusabilitynow returns the enhanced response with CPCB compliance - Removed
reusability_v2model ID - Usereusabilityfor all reusability predictions - Updated
WastewaterInputschema - Now includes optional effluent values (previouslyWastewaterInputV2)
Changed
- Unified reusability prediction - Single endpoint with full CPCB compliance, treatment recommendations, and effluent estimation
- Simplified API structure - Removed V1/V2 versioning in favor of single, feature-complete endpoints
- Updated model version - Reusability model now reports version 3.0
- Cleaner schema endpoint - Only
reusabilityandtreatmentmodel IDs supported
Migration Guide
If upgrading from v2.x:
# Before (v2.x)
POST /api/predict/reusability # Basic prediction
POST /api/predict/reusability/v2 # Enhanced with CPCB
# After (v3.0)
POST /api/predict/reusability # Enhanced with CPCB (only option)
// Before (v2.x)
import { useReusabilityPredictionV2, WastewaterInputV2 } from "@/lib/ml-api";
// After (v3.0)
import { useReusabilityPrediction, WastewaterInput } from "@/lib/ml-api";
[2.1.0]
Added
-
Treatment Endpoint Enhancements
use_casequery parameter for treatment endpoint (Irrigation, Domestic Use, Industrial Use, Drinking Water, Aquaculture)quality_score- Water quality score (0-100) based on input parametersparameter_status- Good/Moderate/Poor classification for each parameterchemical_suggestions- Chlorine and alum dosing recommendations, RO recommendationrisk_assessment- Risk level (Low/Medium/High) with reasonscumulative_sequence- Full treatment sequence from Primary to recommended stagepredicted_stagevsrecommended_stagedifferentiation (adjusted for use case)
-
Documentation
- Enhanced FastAPI OpenAPI documentation with proper tags and descriptions
- Added CHANGELOG.md for version tracking
- Updated API documentation with all new endpoints and features
Changed
- Cleaned up imports and removed unused dependencies
- Improved code organization with section headers
- Updated API version to 2.1.0
Fixed
- Removed deprecated
validatorimport from pydantic
[2.0.0]
Added
-
Reusability Prediction V2 (
/api/predict/reusability/v2)- CPCB inland surface water compliance check
- Treatment upgrade recommendations
- Effluent value estimation when not provided
- Smart verdict combining model prediction and CPCB status
- Alternative reuse class suggestions
-
Reference Endpoints
GET /api/class-info- Reusability class metadataGET /api/cpcb-limits- CPCB discharge limits
-
Batch Prediction (
/api/predict/batch)- Process multiple samples in one request
- Support for both reusability and treatment models
-
PDF Report Generation (
/api/report/generate)- Generate downloadable PDF treatment reports
-
Model Schema Endpoint (
/api/schema/{model_id})- Dynamic form generation support for Next.js
Changed
- Standardized API response format with
status,data,message,timestamp - Added global exception handlers for consistent error responses
- Migrated from
on_eventtolifespancontext manager
[1.0.0]
Added
-
Initial release
-
Reusability Prediction (
/api/predict/reusability)- Predict water reusability class based on wastewater parameters
- Returns prediction, confidence, and class probabilities
-
Treatment Recommendation (
/api/predict/treatment)- Recommend treatment stage (Primary/Secondary/Tertiary/Advanced)
- Returns treatment steps and descriptions
-
Health Endpoints
GET /- API statusGET /health- Detailed health check with model statusGET /api/models- List available models
Models
- Reusability Predictor (v1) - Uses
models_v1/artifacts (joblib) - Treatment Recommender (v1) - Uses
models_v2/artifacts (pickle)
Model Artifacts
models_v1/ (Reusability Prediction)
| File | Description |
|---|---|
model.joblib | Trained classifier model |
imputer.joblib | Missing value imputer |
scaler.joblib | Feature scaler |
label_encoder.joblib | Class label encoder |
features.joblib | Feature names list |
models_v2/ (Treatment Recommendation)
| File | Description |
|---|---|
sih_model.pkl | Trained classifier model |
sih_scaler.pkl | Feature scaler |
sih_label_encoder.pkl | Stage label encoder |
WebSocket Integration
Endpoints
| Endpoint | Description |
|---|---|
/ws/reusability | Real-time reusability predictions |
/ws/treatment | Real-time treatment recommendations |
SCADA Simulator
A Python script (ws_scada_simulator.py) is provided for testing WebSocket integration:
# Run the simulator
python ws_scada_simulator.py
Features:
- Connects to both WebSocket endpoints
- Generates realistic sensor data
- Supports sequential or parallel streaming
- Configurable frame count and interval
Last Updated: December 2024