Inspiration

Climate change and shifting weather patterns have intensified water scarcity, posing severe threats to agriculture, ecosystems, and municipal water supplies. Traditional drought monitoring tools are often slow, fragmented, or lack predictive intelligence. We were inspired to build TerraPredict to bridge this gap—providing local communities, farmers, and environmental planners with an intelligent, data-driven early warning dashboard that turns raw regional telemetry into actionable insights.

What it does

TerraPredict is an enterprise-grade sustainability dashboard that monitors regional drought metrics (such as affected area size and dry-spell duration). It leverages local LLM intelligence (Llama 3.2) alongside a robust smart fallback engine to generate instant, context-aware AI risk predictions. All telemetry data and AI assessments are securely stored and queried in real-time from a cloud-hosted Aiven PostgreSQL database, featuring a responsive UI complete with live search filtering and dynamic metrics counters.

How I built it

Backend: Built using Node.js and Express.js to handle RESTful API routes (/api/towns, /api/droughts).

Database: Integrated a cloud-hosted Aiven PostgreSQL database using the pg client (process.env.DATABASE_URL), featuring automated table creation, secure SSL configurations, and pre-seeded regional datasets.

AI Engine: Integrated Llama 3.2 via Ollama API for natural language risk assessment, backed by an intelligent heuristic algorithmic fallback generator to ensure 100% uptime.

Frontend: Designed with HTML5, modern CSS3 (featuring an extended professional palette of deep emerald greens, slate grays, and sage accents), and vanilla JavaScript for smooth asynchronous data binding and live search filtering.

Challenges I ran into Database Security & SSL: Navigating strict cloud database protocols, specifically handling self-signed certificate constraints (rejectUnauthorized: false) for secure connections to Aiven PostgreSQL while ensuring credentials remained hidden via environment variables.

LLM Availability: Handling scenarios where local AI runtimes (like Ollama) are offline in deployment environments, which we solved by engineering a seamless fallback predictive heuristic.

State & Error Management: Ensuring clear feedback loops between frontend forms, asynchronous API calls, and backend error logging so users always know the exact status of their data submissions.

Accomplishments that I'm proud of Successfully deploying and securing a production-ready cloud database connection with zero data-loss workflows.

Crafting a fault-tolerant AI layer that gracefully shifts between local LLMs and fast algorithmic predictions.

Delivering a clean, modern, scrollable user interface with zero external frontend framework bloat.

What I learned

The critical importance of graceful degradation in AI-powered web apps—ensuring the application remains fully functional even if external or local AI services drop offline.

Best practices for production security, particularly abstracting sensitive credentials out of source control using environment variables (process.env.DATABASE_URL).

What's next for TerraPredict

Real-Time Satellite Integration: Connecting external APIs (such as NASA or ESA Sentinel earth observation data) to automatically calculate town drought sizes.

Data Visualization: Integrating interactive charting libraries (like Chart.js) to map historical moisture trends and severity curves over time.

Built With

Share this project:

Updates

Submission history