Inspiration

In 2021, Prince Edward Island faced a devastating potato wart outbreak that resulted in over $500 million in losses and massive food wastage. This crisis exposed a critical gap in Canada's agricultural infrastructure: farmers lacked real-time awareness of disease outbreaks in neighboring regions. By the time farmers learned about nearby threats, it was often too late to prevent spread across the island. PEI produces 25% of Canada's potato crop, making rapid disease coordination essential. CropGuard was born from the need to transform reactive damage control into proactive prevention through regional collaboration and early warning systems.

What it does

CropGuard is an interactive crop disease alert system that enables real-time coordination across PEI's three counties (Prince, Queens, and Kings). Farmers can report crop diseases through a mobile-optimized interface, agricultural authorities verify reports through a dedicated dashboard, and the system automatically propagates warnings to adjacent regions. When an alert is verified in one county, neighboring counties automatically enter "Under Observation" status on a color-coded map (Green = Normal, Yellow = Under Observation, Red = Active Alert). Authorities can also broadcast preventive advisories to at-risk regions. The system bridges the gap between isolated incident reports and regional awareness, enabling farmers to take preventive action before diseases reach their farms.

How we built it

CropGuard is built on a modern, production-ready technology stack:

  • Frontend: Next.js 15 with TypeScript and App Router for server-side rendering and optimal performance
  • UI Framework: Tailwind CSS with ShadCN UI components for accessible, mobile-first design
  • Interactive Maps: Leaflet.js with react-leaflet to render PEI's county boundaries using GeoJSON data from Statistics Canada's 2021 Census Division boundaries
  • Backend & Database: Firebase for authentication (role-based access for farmers vs authorities) and Firestore for real-time data synchronization
  • Deployment: Vercel for continuous deployment and edge network optimization
  • Real-time Updates: Firestore listeners ensure map status updates propagate instantly to all connected users without polling

The regional adjacency logic automatically calculates propagation (Prince ↔ Queens ↔ Kings) using geographic boundary analysis.

Challenges we ran into

Map Integration: Finding and processing accurate county-level GeoJSON data for PEI proved challenging. Statistics Canada provides detailed census division boundaries, but we had to filter and simplify 4.7 MB of national data down to PEI's three counties while preserving boundary accuracy for proper adjacency detection.

Vercel Deployment: Firebase configuration in a serverless environment required careful environment variable management and initialization logic to prevent cold start errors and connection timeouts.

Dual-Audience UX Design: Designing a single system that serves both low-tech-literacy farmers (often using mobile devices outdoors with gloves) and data-focused authorities (needing efficient bulk verification workflows) required extensive user flow iteration. We solved this with role-based routing, large touch targets for mobile, and differentiated dashboards.

Real-time Synchronization: Ensuring map status updates propagated instantly across all active sessions while maintaining data consistency required implementing Firestore listeners with optimistic UI updates and proper error handling.

Accomplishments that we're proud of

  • Fully Functional End-to-End System: Built a complete, production-ready application from authentication to real-time map updates within the hackathon timeframe
  • Intelligent Regional Propagation: Implemented automatic adjacency-based alert spreading that transforms isolated reports into coordinated regional awareness
  • Dual-Role Architecture: Successfully designed distinct user experiences for farmers and authorities while maintaining a unified codebase
  • Mobile-First Accessibility: Created a farmer interface optimized for outdoor use with high contrast, large touch targets, and minimal steps to report alerts
  • Real-time Coordination: Achieved instant map synchronization across all users using Firestore's real-time listeners—no polling or manual refresh required
  • Scalable Foundation: Built with Firebase and Vercel infrastructure that can scale from 3 PEI counties to province-wide or national deployment

What we learned

  • User-Centered Design Matters: Agricultural technology must account for real-world constraints—farmers wearing gloves, poor cellular connectivity in fields, and varying technical literacy levels
  • Geographic Data Processing: Working with GeoJSON boundary data, coordinate systems, and spatial relationships requires careful validation and testing to ensure accuracy
  • Real-time Architecture: Implementing real-time updates taught us the trade-offs between optimistic UI updates, server-side validation, and data consistency
  • Role-Based Systems: Designing for multiple user types requires separating concerns early—different dashboards, permissions, and workflows prevent feature bloat in shared interfaces
  • Deployment Complexities: Serverless environments (Vercel) have unique constraints around Firebase initialization, environment variables, and cold start performance
  • The Power of MVP Scope: Focusing on county-level alerts (not farm-level precision) allowed us to ship a functional system rather than an incomplete ambitious one

What's next for CropGuard

  • Authenticated Farmer IDs: PEI assigns each registered farmer a unique identification number. Integrating this system would add verified identity to reports, preventing false flags and enabling regulatory compliance tracking
  • Farm-Level Precision: Expand from county-level to individual farm boundaries, allowing pinpoint disease tracking and more targeted advisory messages
  • Disease Classification AI: Integrate image upload with computer vision models to help farmers identify diseases before submitting reports, improving report accuracy
  • Historical Analytics Dashboard: Provide authorities with seasonal trend analysis, outbreak prediction models, and historical heatmaps to inform policy decisions
  • Cross-Province Expansion: Scale the system to other agricultural regions in Canada, starting with neighboring Maritime provinces (New Brunswick, Nova Scotia)
  • SMS/WhatsApp Alerts: Add push notifications and SMS alerts for farmers without smartphone data access, ensuring no farmer is left behind
  • Integration with Government Systems: Connect with Agriculture and Agri-Food Canada databases and provincial extension services for official outbreak reporting

Demo Credentials

Farmer Account

Authority Account

Links

Built With

Share this project:

Updates