Skip to content

feat(ai): AI Weather Anomaly & Crop Yield Loss Prediction Pipeline - #1343

Open
hrshjswniii wants to merge 3 commits into
Nitya-003:mainfrom
hrshjswniii:feature/ai-weather-yield-loss
Open

feat(ai): AI Weather Anomaly & Crop Yield Loss Prediction Pipeline#1343
hrshjswniii wants to merge 3 commits into
Nitya-003:mainfrom
hrshjswniii:feature/ai-weather-yield-loss

Conversation

@hrshjswniii

Copy link
Copy Markdown
Contributor

📌 Overview

This PR implements [feature] : AI Weather Anomaly & Crop Yield Loss Prediction Pipeline bringing predictive microclimate anomaly detection (Extreme Drought, Unseasonal Monsoons, Heatwave) and harvest yield loss percentage calculations to farmers and Mandi inventory operators.

Key Changes Introduced:

  1. ML Microservice Weather Pipeline Engine:
    • Created [ml-service/weather_pipeline.py]calculating yield loss risk percentage (0-100%), classifying climate anomalies, estimating harvest reduction (kg/acre), and generating crop protection tips.
  2. Flask ML Endpoint:
    • Updated [ml-service/app.py] adding POST /predict-yield-loss with rate limiting and API key verification.
  3. Backend Express Proxy Route:
    • Updated [backend/routes/aiRoutes.js]adding proxy route /api/ai/predict-yield-loss with automatic fallback calculation if ML service is offline.
  4. Automated Verification Script:
    • Created [ml-service/test_weather_pipeline.py] verifying microclimate anomaly classification and risk calculation bounds.

🛠️ Type of Change

  • ⛓️ Smart Contract (Solidity changes, Gas optimization)
  • 💻 Frontend (UI/UX, React components, Tailwind)
  • 🐍 AI ML Microservice & Backend (Python, Flask, Express, Scikit-Learn)
  • 📄 Documentation (README, Roadmap updates)
  • 🧪 Testing (Python unit tests)

🔗 Related Issue

Closes #1307


🧪 Testing & Verification

  • Smart Contracts: npx hardhat test passed? (N/A)
  • ML Microservice: python test_weather_pipeline.py passed? (Yes) — Passed cleanly.
  • Backend: Proxy route /api/ai/predict-yield-loss verified? (Yes).

✅ PR Checklist

  • My code follows the project's style guidelines.
  • I have commented my code, particularly in complex areas (e.g., rainfall deficit ratios & growth stage multipliers).
  • I have updated the documentation accordingly.
  • My changes generate no new warnings.

💬 Additional Notes

  • Created [ml-service/weather_pipeline.py]
  • Updated [ml-service/app.py]
  • Created [ml-service/test_weather_pipeline.py]
  • Updated [backend/routes/aiRoutes.js]

@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

@hrshjswniii is attempting to deploy a commit to the Nitya Gosain's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] : AI Weather Anomaly & Crop Yield Loss Prediction Pipeline

1 participant