Envirolytics_backend / manual_testing_guide.md
Ayush Modi
Clean deploy with LFS
e4667e2

Envirolytics Manual Testing Guide (Postman)

Base URL: http://localhost:8000

1. Live Status & Source Attribution

Endpoint: GET /api/live-status

  • Output: Raw Air Quality Data.

Endpoint: GET /api/analysis/source-attribution

  • Output:
    {
        "analysis_type": "SOURCE_ATTRIBUTION",
        "primary_source": "INDUSTRY",
        "confidence_scores": { "INDUSTRY": 0.8, "TRAFFIC": 0.2 },
        "message": "The model attributes the current pollution profile mostly to INDUSTRY."
    }
    

2. Green QR (Multi-Mode)

Endpoint: POST /api/enforce/green-qr

Scenario A: Metro Reward (50 Credits)

  • Body (JSON):
    {
        "user_gps": [28.6139, 77.2090],
        "station_gps": [28.6140, 77.2090],
        "transport_mode": "METRO"
    }
    
  • Expected Output: "credits_earned": 50

Scenario B: Carpool (20 Credits)

  • Body (JSON):
    {
        "user_gps": [28.6139, 77.2090],
        "station_gps": [28.6140, 77.2090],
        "transport_mode": "CARPOOL"
    }
    
  • Expected Output: "credits_earned": 20

3. Biomass Marketplace

Endpoint: POST /api/marketplace/list-biomass

Scenario A: List Stubble

  • Body (JSON):
    {
        "farmer_id": "F_009",
        "biomass_type": "STUBBLE",
        "quantity_kg": 1000,
        "price_per_kg": 2.0,
        "gps": [30.5, 76.5],
        "contact_info": "Phone: 9999999999"
    }
    
  • Expected Output: "status": "LISTED"

Endpoint: GET /api/marketplace/browse

  • Output: List of active listings.

4. Industry Audit (Fraud Detection)

Endpoint: POST /api/government/audit-industry

Scenario: Under-Reporting Fraud

Station says 200, Industry says 10.

  • Body (JSON):
    {
        "industry_id": "IND_LYING",
        "nearest_station_pm25": 200.0,
        "sensor_readings": {
            "pm25": 10.0, "no2": 20.0, "so2": 5.0, "co": 0.5, "wind": 2.5, "temp": 25.0
        }
    }
    
  • Expected Output: "audit_result": "POSSIBLE_UNDER_REPORTING"

5. Farmer Subsidy (Double Dip Check)

Endpoint: POST /api/enforce/farmer-subsidy

Scenario: Fraud Detected

Claiming sales but Satellite sees Fire.

  • Body (JSON):
    {
        "farmer_id": "FARM_FRAUD",
        "gps": [30.5, 76.5],
        "claimed_biomass_sold_kg": 500.0,
        "debug_fire_co": 5.0
    }
    
  • Expected Output: "status": "FRAUD_DETECTED"