Skip to main content

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/reusability with basic response)
  • Removed deprecated endpoints: /predict, /recommend-treatment
  • Renamed V2 reusability to main endpoint - /api/predict/reusability now returns the enhanced response with CPCB compliance
  • Removed reusability_v2 model ID - Use reusability for all reusability predictions
  • Updated WastewaterInput schema - Now includes optional effluent values (previously WastewaterInputV2)

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 reusability and treatment model 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_case query parameter for treatment endpoint (Irrigation, Domestic Use, Industrial Use, Drinking Water, Aquaculture)
    • quality_score - Water quality score (0-100) based on input parameters
    • parameter_status - Good/Moderate/Poor classification for each parameter
    • chemical_suggestions - Chlorine and alum dosing recommendations, RO recommendation
    • risk_assessment - Risk level (Low/Medium/High) with reasons
    • cumulative_sequence - Full treatment sequence from Primary to recommended stage
    • predicted_stage vs recommended_stage differentiation (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 validator import 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 metadata
    • GET /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_event to lifespan context 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 status
    • GET /health - Detailed health check with model status
    • GET /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)

FileDescription
model.joblibTrained classifier model
imputer.joblibMissing value imputer
scaler.joblibFeature scaler
label_encoder.joblibClass label encoder
features.joblibFeature names list

models_v2/ (Treatment Recommendation)

FileDescription
sih_model.pklTrained classifier model
sih_scaler.pklFeature scaler
sih_label_encoder.pklStage label encoder

WebSocket Integration

Endpoints

EndpointDescription
/ws/reusabilityReal-time reusability predictions
/ws/treatmentReal-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