Skip to content

AnnaDatais designed to be your intelligent farming companion for data-driven agriculture management and crop optimisation. It brings together weather forecasting, soil monitoring, pest detection, commodity market prices, inventory tracking, financial analysis, and WhatsApp alert notifications into a single, easy-to-use web

Notifications You must be signed in to change notification settings

jjf2009/AnnaData-Smart-Farm-Management-Portal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌿 AnnaData β€” Intelligent Farming Companion

AnnaData is a full-stack smart agriculture management platform that gives farmers real-time data, AI-powered insights, and actionable tools to optimise crop yields, monitor field conditions, and manage day-to-day farm operations.


Table of Contents


Overview

AnnaData (repository name: AITD) is designed to be your intelligent farming companion for data-driven agriculture management and crop optimisation. It brings together weather forecasting, soil monitoring, pest detection, commodity market prices, inventory tracking, financial analysis, and WhatsApp alert notifications into a single, easy-to-use web application.


Features

🏠 Home Dashboard

A comprehensive at-a-glance overview of your farm:

  • Welcome Section β€” Quick platform introduction.
  • Technology Section β€” Overview of the three core pillars: Weather Monitoring, Soil Analysis, and Crop Management.
  • Soil Monitoring β€” Real-time metrics for soil moisture, temperature, and nitrogen levels with progress indicators and actionable recommendations.
  • Commodity Market Prices β€” Live price tracking (Wheat, Corn, Soybeans, Cotton) with trend indicators.
  • Crop Alerts β€” Colour-coded alert cards highlighting fields that need attention.
  • Farm Weather Widget β€” Current temperature, humidity, wind speed, and a 3-day forecast.
  • Agricultural Pest Monitor β€” Field scan results with pest-risk indicators (Aphid Activity, Corn Borer Risk) and a "Run field scan" action button.
  • Agriculture News β€” Latest news headlines relevant to farming.
  • Farm Management Quick Links β€” Shortcuts to Crop Reports, Yield Analytics, and Farm Settings.

🌦️ Weather Dashboard (/Weather)

  • Scrolling critical-update ticker banner.
  • Weekly Forecast Carousel β€” Interactive card carousel sourced from the OpenWeatherMap API, defaulting to the user's geolocation or Mapusa (Goa, India) as a fallback.
  • Weather Details Grid β€” Detailed breakdown for the selected forecast day.
  • Informational text section explaining the data sources and methodology.

🌱 Farm Management (/resources)

A full suite of farm-operations tools:

Module Description
Crop Management Track crop varieties, planting dates, growth stages, and growth-progress bars with pest-risk alerts.
Yield Predictions AI-powered yield predictions (bu/acre) compared against current yields with percentage-change indicators.
Inventory Management Four-category inventory (Seeds, Fertilizers, Equipment, Harvested Crops) with a recent-transactions table.
Financial Overview Annual revenue, expenses, and predicted profit with an expense-breakdown chart (Seeds, Equipment, Labour, Fuel).
Resource Consumption Usage tracking for Diesel Fuel, Water, and Electricity with an AI-generated optimisation suggestion.
Product Shelf Life Tracks harvested produce expiry dates and raises alerts when stock is nearing end-of-shelf-life.
Market Operations Buy/sell transaction log with selling, buying, and net revenue summaries.
Task Scheduler Prioritised farm-task list (High / Medium / Low) with date and time scheduling and completion tracking.

πŸ“² WhatsApp Alerts (Twilio)

The backend exposes a /notify-farmer endpoint that sends WhatsApp messages via the Twilio Sandbox to a farmer's phone number. Three alert types are supported:

  • weather β€” Rain forecast notification.
  • drought β€” Prolonged dry-period warning.
  • fertilizer β€” Fertiliser application reminder.

🌐 Internationalisation

The UI supports English and Hindi via i18next with automatic browser-language detection.


Tech Stack

Frontend

Technology Version Purpose
React 19 UI library
Vite 6 Dev server and build tool
Tailwind CSS 4 Utility-first CSS
React Router 7 Client-side routing
Lucide React 0.487 Icon library
i18next 24 Internationalisation
Radix UI latest Accessible UI primitives
class-variance-authority 0.7 Component variant management

Backend

Technology Version Purpose
Node.js 18+ Runtime
Express 5 HTTP server
node-fetch 3 Server-side HTTP requests
Twilio 5 WhatsApp alert messaging
dotenv 16 Environment variable management
cors 2 Cross-origin resource sharing

External APIs


Project Structure

AITD/
β”œβ”€β”€ Backend/
β”‚   β”œβ”€β”€ package.json
β”‚   └── src/
β”‚       β”œβ”€β”€ server.js        # Express server, Weather API proxy, Twilio alerts
β”‚       └── test.rest        # Manual API test file
└── Frontend/
    β”œβ”€β”€ index.html
    β”œβ”€β”€ vite.config.js
    β”œβ”€β”€ package.json
    └── src/
        β”œβ”€β”€ main.jsx         # React entry point
        β”œβ”€β”€ App.jsx          # Root layout (Navbar + Outlet + Footer)
        β”œβ”€β”€ i18.js           # i18next configuration
        β”œβ”€β”€ routers/
        β”‚   └── router.jsx   # Application routes
        β”œβ”€β”€ pages/
        β”‚   β”œβ”€β”€ Home.jsx         # Home dashboard
        β”‚   β”œβ”€β”€ Weather.jsx      # Weather dashboard
        β”‚   β”œβ”€β”€ FarmManagement.jsx  # /resources page
        β”‚   β”œβ”€β”€ Detect.jsx       # Detect page (in development)
        β”‚   β”œβ”€β”€ Manage.jsx       # Manage page (in development)
        β”‚   └── Login.jsx        # Login page
        β”œβ”€β”€ components/
        β”‚   β”œβ”€β”€ Navbar.jsx
        β”‚   β”œβ”€β”€ Footer.jsx
        β”‚   β”œβ”€β”€ WelcomeSection.jsx
        β”‚   β”œβ”€β”€ TechnologySection.jsx
        β”‚   β”œβ”€β”€ FeatureCards.jsx
        β”‚   β”œβ”€β”€ SoilMonitoring.jsx
        β”‚   β”œβ”€β”€ CommodityPrices.jsx
        β”‚   β”œβ”€β”€ CropAlerts.jsx
        β”‚   β”œβ”€β”€ FarmWeather.jsx
        β”‚   β”œβ”€β”€ PestMonitor.jsx
        β”‚   β”œβ”€β”€ AgricultureNews.jsx
        β”‚   β”œβ”€β”€ FarmManagement.jsx
        β”‚   β”œβ”€β”€ CardCarousel.jsx
        β”‚   β”œβ”€β”€ GridSection.jsx
        β”‚   β”œβ”€β”€ ScrollingText.jsx
        β”‚   β”œβ”€β”€ Separator.jsx
        β”‚   β”œβ”€β”€ TextSection.jsx
        β”‚   β”œβ”€β”€ PageHeader.jsx
        β”‚   └── farm-management/
        β”‚       β”œβ”€β”€ CropManagement.jsx
        β”‚       β”œβ”€β”€ YieldPredictions.jsx
        β”‚       β”œβ”€β”€ InventoryManagement.jsx
        β”‚       β”œβ”€β”€ FinancialOverview.jsx
        β”‚       β”œβ”€β”€ ResourceConsumption.jsx
        β”‚       β”œβ”€β”€ ProductShelfLife.jsx
        β”‚       β”œβ”€β”€ MarketOperations.jsx
        β”‚       └── TaskScheduler.jsx
        β”œβ”€β”€ locales/
        β”‚   β”œβ”€β”€ en/translation.json   # English strings
        β”‚   └── hn/translation.json   # Hindi strings
        └── lib/
            └── utils.js

Getting Started

Prerequisites


Backend Setup

# 1. Navigate to the backend directory
cd AITD/Backend

# 2. Install dependencies
npm install

# 3. Create the environment file
cp .env.example .env   # or create .env manually (see Environment Variables below)

# 4. Start the development server (auto-restarts on file changes)
npm run dev

The backend server starts at http://localhost:3000.


Frontend Setup

# 1. Navigate to the frontend directory
cd AITD/Frontend

# 2. Install dependencies
npm install

# 3. Start the Vite dev server
npm run dev

The frontend dev server starts at http://localhost:5173.

Note: The frontend proxies weather data through the backend at http://localhost:3000/api/weather. Make sure the backend is running before using the Weather Dashboard.

Other Frontend Scripts

Command Description
npm run dev Start development server
npm run build Production build (outputs to dist/)
npm run preview Preview the production build locally
npm run lint Run ESLint

Environment Variables

Create a .env file inside the Backend/ directory with the following keys:

# OpenWeatherMap API key
WEATHER_API_KEY=your_openweathermap_api_key

# Twilio credentials (for WhatsApp alerts)
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
Variable Required Description
WEATHER_API_KEY βœ… Yes API key from openweathermap.org
TWILIO_ACCOUNT_SID βœ… Yes (for alerts) Found in your Twilio Console Dashboard
TWILIO_AUTH_TOKEN βœ… Yes (for alerts) Found in your Twilio Console Dashboard

API Reference

All backend endpoints are served from http://localhost:3000.

GET /api/weather

Fetches current weather conditions and a 5-day / 3-hour forecast from OpenWeatherMap.

Query Parameters

Parameter Type Required Description
lat number No Latitude (defaults to Mapusa, Goa)
lon number No Longitude (defaults to Mapusa, Goa)

Example Request

GET /api/weather?lat=15.5957&lon=73.8091

Example Response

{
  "current": { /* OpenWeatherMap current weather object */ },
  "forecast": { /* OpenWeatherMap forecast object with list[] */ }
}

POST /notify-farmer

Sends a WhatsApp alert message to a farmer via the Twilio Sandbox.

Request Body

{
  "phone": "+919876543210",
  "alertType": "weather"
}
Field Type Required Values
phone string βœ… Yes Recipient phone number in E.164 format (e.g. +919876543210)
alertType string βœ… Yes "weather", "drought", or "fertilizer"

Example Response

{
  "success": true,
  "sid": "SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

Twilio Sandbox Note: The recipient must first opt-in to the Twilio WhatsApp Sandbox by sending join <sandbox-keyword> to +1 415 523 8886 before they can receive messages.


Pages & Routes

Route Page Description
/ Home Main dashboard with soil, weather, pest, commodity, and news widgets
/Weather Weather Dashboard Forecast carousel and detailed weather grid
/resources Farm Management Full farm-operations suite (crops, inventory, finance, tasks)
/detect Detect Disease/pest detection (in development)
/manage Manage Additional management tools (in development)
/login Login User authentication (in development)

Internationalisation

The frontend uses i18next with react-i18next and automatic browser-language detection.

  • English translations: Frontend/src/locales/en/translation.json
  • Hindi translations: Frontend/src/locales/hn/translation.json

The fallbackLng is set to "en", so English strings are used when a translation key is missing in the detected language.

To add a new language:

  1. Create a new folder under Frontend/src/locales/<lang-code>/.
  2. Add a translation.json file with the required keys.
  3. Import and register it in Frontend/src/i18.js.

Contributing

  1. Fork the repository and create a new branch: git checkout -b feature/your-feature-name
  2. Make your changes and ensure the code lints cleanly: npm run lint (in Frontend/)
  3. Commit your changes with a clear message.
  4. Open a Pull Request against the main branch.

About

AnnaDatais designed to be your intelligent farming companion for data-driven agriculture management and crop optimisation. It brings together weather forecasting, soil monitoring, pest detection, commodity market prices, inventory tracking, financial analysis, and WhatsApp alert notifications into a single, easy-to-use web

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5