Skip to content

Latest commit

ย 

History

40 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

TerraPulse AI โ€” Regenerative Agriculture & Carbon Intelligence Platform

Vite React Tailwind & CSS Tokens Status

TerraPulse AI is an agricultural intelligence and regenerative farming platform designed to empower farmers, agronomists, land managers, and carbon credit evaluators. By combining satellite land diagnostics, AI-driven plant and soil health analysis, and multi-year carbon sequestration forecasting, TerraPulse AI turns complex environmental data into actionable insights for sustainable land stewardship.


๐Ÿ“‹ Table of Contents


๐Ÿš€ Project Overview

The Problem

Global agricultural land faces severe degradation, loss of Soil Organic Carbon (SOC), unpredictable climate risks, and escalating crop disease outbreaks. At the same time, transitioning to regenerative practices (cover cropping, no-till, crop rotation) is often inhibited by a lack of accessible satellite monitoring tools and complex, unverified carbon credit estimation models.

The Solution

TerraPulse AI provides an intuitive, high-performance platform that unifies real-time farm health diagnostics and predictive carbon modeling:

  • Satellite Health Tracking: Monitor vegetation vigor (NDVI) and soil moisture levels across registered fields.
  • AI Diagnostics: Scan plant leaves and soil samples for instant disease detection, severity ratings, and treatment guidance.
  • Carbon Simulator: Simulate 3-year crop rotation scenarios to project SOC gains, crop resilience, and estimated voluntary carbon credits over a 5-year timeline.

โœจ Key Features

๐Ÿ“Š Executive Dashboard

  • Core Agronomic Metrics: Real-time visibility into average Soil Organic Carbon (SOC %), NDVI index, soil moisture percentage, and estimated annual carbon credits ($tCO_2e/yr$).
  • Interactive Field Selector: Switch between registered farm parcels (e.g., North Valley Field, East Meadow) to inspect localized telemetry.
  • Trend Charts: Visual tracking of historical NDVI and moisture trends powered by interactive Recharts line graphs.
  • Disease & Advisory Feed: Instant alerts on recent field scans and prioritized regenerative recommendations.

๐Ÿ›ฐ๏ธ Farm Health & Satellite Monitoring

  • Dual-Layer Map Visualization: Toggle between Normalized Difference Vegetation Index (NDVI) and Soil Moisture Heatmap visual overlays.
  • Multi-Satellite Source Selector: Inspect data resolution across Sentinel-2 (10m), PlanetScope (3m), and Landsat-9 (30m) providers.
  • Agronomic Action Plans: Field-specific recommendations including cover crop selection (e.g., Crimson Clover, Hairy Vetch) and bio-fertilizers (e.g., Mycorrhizal Inoculants).

๐Ÿ”ฌ AI Plant & Soil Scanner

  • Dual-Mode Diagnostics: Dedicated upload & analysis workflows for Plant Leaf Health and Soil Degradation.
  • Interactive Scan Workflow: Step-by-step image upload, simulated neural network analysis, and diagnostic report generation.
  • Comprehensive Diagnostic Reports:
    • Disease/Condition identification with confidence score.
    • Severity level assessment (e.g., Moderate, Severe).
    • Symptom breakdown and root cause analysis.
    • Localized treatment and prevention protocols.
    • Soil organic matter estimation and nutrient deficiency breakdown.

๐ŸŒฑ Regenerative Carbon Simulator

  • Interactive Crop Rotation Builder: Configure 3-year crop sequences (e.g., Corn $\rightarrow$ Soybeans $\rightarrow$ Crimson Clover) across custom acreage.
  • Soil Baseline Selector: Choose baseline soil types (e.g., Silt Loam, Clay Loam, Sandy Loam) and enter historical yield baselines.
  • Predictive Engine:
    • Soil Organic Carbon (SOC %) trajectory over 5 years.
    • Climate Resilience Score improvements.
    • Carbon Sequestration Rate ($tCO_2e/\text{acre}/\text{year}$).
    • Annual Carbon Credit Forecast ($tCO_2e$) for voluntary carbon markets.

๐ŸŒ Global Multilingual Localization System

  • Unified Global Locale: Immediate, client-side, page-reload-free language switching across the entire dashboard application.
  • Regional Languages: Fully supports 5 major agricultural languages of India:
    • English (en-IN)
    • Hindi (hi-IN)
    • Bengali (bn-IN)
    • Marathi (mr-IN)
    • Kannada (kn-IN)
  • Backend LLM Localization: Passes the selected language context to the backend Gemini AI generation prompts. Translates AI strategic analyses, RAG outputs, scanner descriptions, and copilot responses on-the-fly while strictly keeping JSON schemas in English to maintain visual compatibility.
  • T-Hook Enhancements: Built-in default string parameter fallbacks on hook queries to guarantee zero unlocalized UI glitches.

๐Ÿ—๏ธ System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚               TerraPulse AI Web Client                 โ”‚
โ”‚      (React + Vite + Recharts + Lucide Icons)          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ฒโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚                           โ”‚
           HTTP Requests              WebSocket/Stream
                โ”‚                           โ”‚
                โ–ผ                           โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              FastAPI Application Server                โ”‚
โ”‚    (Uvicorn + Pydantic Settings + Custom CORS)         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ–ผ       โ–ผ               โ–ผ              โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Gemini   โ”‚โ”‚ OpenRouter  โ”‚โ”‚ Earth Engine โ”‚โ”‚ Firestore โ”‚
โ”‚  Service  โ”‚โ”‚ API Service โ”‚โ”‚  Satellite   โ”‚โ”‚ Database  โ”‚
โ”‚ (Advisory)โ”‚โ”‚  (Scanner)  โ”‚โ”‚  Telemetry   โ”‚โ”‚  Storage  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Note on Architecture: The application operates in dual-mode (Toggleable between DEMO and LIVE mode from the Topbar).

  • DEMO Mode: Front-end queries intercept requests to return high-fidelity local datasets instantly.
  • LIVE Mode: Requests route to the production FastAPI backend. The backend uses OpenRouter (Gemma 4 free-tier multimodal model) for image scans and the official Google Gemini SDK for advisory diagnostics, falling back to mock schemas gracefully on API failures.

๐Ÿ› ๏ธ Technology Stack

Frontend

Backend

  • Framework: FastAPI (Python 3.10+)
  • WSGI/ASGI Server: Uvicorn
  • AI Integrations: Official google-generativeai SDK (Gemini) & OpenRouter API (google/gemma-4-26b-a4b-it:free multimodal model).
  • Environment Management: Pydantic-Settings for secure, type-safe config loading.
  • Database / Cache Adapters: Firestore & Local fallback engines.
  • Testing: Complete pytest suite covering carbon calculations, telemetry aggregation, and risk analysis.

๐Ÿ“ Project Structure

TerraPulse-AI/
โ”œโ”€โ”€ Backend/                    # Python Backend API & ML Engine
โ”‚   โ”œโ”€โ”€ main.py                 # ASGI Uvicorn server entrypoint
โ”‚   โ”œโ”€โ”€ requirements.txt        # Python package dependencies
โ”‚   โ”œโ”€โ”€ Dockerfile              # Containerization definition
โ”‚   โ”œโ”€โ”€ app/                    # FastAPI application codebase
โ”‚   โ”‚   โ”œโ”€โ”€ main.py             # FastAPI App instance and middlewares config
โ”‚   โ”‚   โ”œโ”€โ”€ config.py           # Configuration schema and Pydantic settings loading
โ”‚   โ”‚   โ”œโ”€โ”€ routers/            # Endpoint handlers (scanner, advisory, simulator, copilot, satellite, voice)
โ”‚   โ”‚   โ”œโ”€โ”€ services/           # Business logic layer (Gemini, Speech synthesis, Carbon simulation, Risk engine)
โ”‚   โ”‚   โ”œโ”€โ”€ schemas/            # Request and response Pydantic models
โ”‚   โ”‚   โ””โ”€โ”€ utils/              # Helper utilities and audit loggers
โ”‚   โ””โ”€โ”€ tests/                  # Pytest unit testing suite
โ”‚
โ”œโ”€โ”€ Frontend/                   # Vite + React Frontend Application
โ”‚   โ”œโ”€โ”€ public/                 # Static public assets (favicons, icons)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ assets/             # Visual assets and logo images
โ”‚   โ”‚   โ”œโ”€โ”€ components/         # Reusable UI primitives, FarmMap, Layout sidebar/topbar
โ”‚   โ”‚   โ”œโ”€โ”€ data/               # Mock datasets and static parameter definitions
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/              # Custom React state hooks (useAsync, useAuth, useTranslation)
โ”‚   โ”‚   โ”œโ”€โ”€ locales/            # JSON translation dictionaries (en-IN, hi-IN, bn-IN, mr-IN, kn-IN)
โ”‚   โ”‚   โ”œโ”€โ”€ pages/              # Primary views (Landing, Dashboard, FarmHealth, AIScanner, CarbonSimulator, AICopilot, ActionCenter, IndiaIntelligence)
โ”‚   โ”‚   โ”œโ”€โ”€ services/           # Decoupled service layer for safeFetch API endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ styles/             # Modular CSS design system tokens and application layouts
โ”‚   โ”‚   โ””โ”€โ”€ main.jsx            # Application entrypoint & React Router provider
โ”‚   โ”œโ”€โ”€ eslint.config.js        # ESLint code hygiene rules
โ”‚   โ”œโ”€โ”€ index.html              # HTML DOM container
โ”‚   โ”œโ”€โ”€ package.json            # Node.js dependencies & scripts
โ”‚   โ””โ”€โ”€ vite.config.js          # Vite build & plugin settings
โ”‚
โ”œโ”€โ”€ .gitignore                  # Git untracked path rules
โ””โ”€โ”€ README.md                   # Project documentation

๐Ÿš€ Getting Started

Prerequisites

  • Node.js: v18.0.0 or higher
  • npm: v9.0.0 or higher

Frontend Setup

  1. Navigate to the Frontend directory:

    cd Frontend
  2. Install Node dependencies:

    npm install
  3. Start the local development server:

    npm run dev

    The application will be accessible at http://localhost:5173.

  4. Build for production:

    npm run build

    The optimized production bundle will be generated in Frontend/dist/.

  5. Preview the production build locally:

    npm run preview

Backend Setup (In Development)

  1. Navigate to the Backend directory:

    cd Backend
  2. Create and activate a Python virtual environment:

    • Windows:
      python -m venv venv
      .\venv\Scripts\activate
    • macOS / Linux:
      python3 -m venv venv
      source venv/bin/activate
  3. Install Python packages:

    pip install -r requirements.txt

๐Ÿ” Environment Variables

The frontend service layer supports environment configuration. Create a .env file in the Frontend/ directory based on .env.example:

# Frontend Environment Configuration (.env.example)

# Base URL for Backend REST API
VITE_API_BASE_URL=http://localhost:8000/api

# Enable mock data fallback when backend service is offline
VITE_ENABLE_MOCK_SERVICES=true

Security Note: Never commit .env or files containing secret API keys, tokens, or credentials to version control.


๐Ÿ“ˆ Development Status

Component Status Details
UI/UX & Design System โœ… Completed Full responsive graphic design system with bold 2.5px black outlines & fresh organic green accents
Landing Page โœ… Completed Feature showcase, problem statement, CTA navigation
Executive Dashboard โœ… Completed Interactive metric summaries, Recharts graphs, field switcher
Farm Health Satellite View โœ… Completed Dual-layer NDVI / Soil Moisture map toggle & satellite provider selector
AI Disease & Soil Scanner โœ… Completed Interactive upload & diagnostic workflow powered by OpenRouter free-tier multimodal model (google/gemma-4-26b-a4b-it:free)
Carbon Simulator โœ… Completed 3-year crop rotation builder with 5-year SOC & carbon credit math engine
Service Layer Abstraction โœ… Completed Asynchronous service contracts (api.js) fully integrated with the FastAPI backend
Backend REST API โœ… Completed High-performance FastAPI server with 11 router endpoints, integrated config loaders, and schema validation
Live Satellite Proxy โœ… Completed Earth Engine Service telemetry computation and simulation for all registered farm fields
AI Advisory & Copilot โœ… Completed Gemini-powered local and regional agricultural advice & contextual chat system
Global Multilingual System โœ… Completed Unified localization supporting English, Hindi, Bengali, Marathi, and Kannada across all pages and AI prompts

๐Ÿ”ฎ Future Enhancements

  • Live Satellite Data Pipeline: Integration with Copernicus Sentinel-2 API for automated 5-day NDVI updates.
  • IoT Telemetry Ingestion: Support for MQTT soil moisture & temperature sensor streams.
  • PDF Certification Export: Exportable carbon sequestration verification reports for voluntary market auditors.

๐Ÿค Contributing

Contributions, issues, and feature requests are welcome!

  1. Fork the Repository.
  2. Create a Feature Branch:
    git checkout -b feature/amazing-feature
  3. Commit your changes:
    git commit -m "feat: add amazing feature"
  4. Push to the Branch:
    git push origin feature/amazing-feature
  5. Open a Pull Request.

๐Ÿ“„ License

This project is developed for hackathon demonstration and evaluation. Check the repository repository settings for specific license terms.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages