# raghupathi24891a0545/ag-marknet architecture

> Architecture diagram of the GitHub repository raghupathi24891a0545/ag-marknet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raghupathi24891a0545/ag-marknet
- Repository: https://github.com/raghupathi24891a0545/ag-marknet

## Overview

Agri Connect is a bilingual smart-farming platform: farmers use the web app to provide farm details and location, request analysis, and receive crop/fertilizer recommendations alongside weather, soil, market, alert, and disease information. The frontend routes feature pages through a shared API client to Flask; backend analysis combines agronomic filtering and ML with location-based ETL, while a separate image-detection service supports crop diagnosis. The README documents major integrations and capabilities; some backend call details and several feature implementations were not sampled, so undocumented links are omitted.

Main entry points: [`frontend/js/app.js`](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/app.js) (Page Router), [`backend/api.py`](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/api.py) (Flask API), [`frontend/js/api.js`](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/api.js) (API Client), [`frontend/js/pages/analysis.js`](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/analysis.js) (Farm Analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Farmer Web App"]
  node_webapp["Page Router<br/>[app.js]"]
  node_api_client["API Client<br/>[api.js]"]
  node_analysis_page["Farm Analysis<br/>[analysis.js]"]
  node_weather_page["Weather Page<br/>[weather.js]"]
  node_market_page["Market Page<br/>[market.js]"]
  node_crop_page["Crop Doctor<br/>[cropDoctor.js]"]
  node_chatbot_page["Chatbot<br/>[chatbot.js]"]
  node_alerts_page["Alerts Page<br/>[alerts.js]"]
  node_experts_page["Expert Directory<br/>[experts.js]"]
  node_home_page["Home Dashboard<br/>[home.js]"]
  node_i18n["English-Telugu<br/>[i18n.js]"]
  node_charts["Data Charts<br/>[charts.js]"]
end

subgraph group_farm["Farm Intelligence"]
  node_flask["Flask API<br/>[api.py]"]
  node_predictions["Crop &amp; Fertilizer ML<br/>[predictions.py]"]
  node_database[("Farm Data Store<br/>[database.py]")]
end

subgraph group_data["Agricultural Data"]
  node_weather_etl["Weather ETL<br/>[weather_etl.py]"]
  node_soil_etl["Soil ETL<br/>[soil_etl.py]"]
  node_geo_etl["Geocoding ETL<br/>[geocoding_etl.py]"]
  node_market_etl["Market ETL<br/>[market_etl.py]"]
  node_news_etl["Agriculture News<br/>[news_etl.py]"]
end

subgraph group_care["Farmer Support"]
  node_alert_engine["Alert Engine<br/>[alert_engine.py]"]
  node_image_service["Leaf Disease Service<br/>[app.py]"]
end

node_farmer(("Farmer"))
node_weather_service["OpenWeatherMap"]
node_soil_service["SoilGrids"]
node_geocoding_services["Geocoding Providers"]
node_market_service["Agmarknet API"]
node_news_service["News Sources"]

node_farmer -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_analysis_page
node_webapp -->|"routes to"| node_weather_page
node_webapp -->|"routes to"| node_market_page
node_webapp -->|"routes to"| node_crop_page
node_webapp -->|"routes to"| node_chatbot_page
node_webapp -->|"routes to"| node_alerts_page
node_webapp -->|"routes to"| node_experts_page
node_webapp -->|"routes to"| node_home_page
node_analysis_page -->|"requests analysis"| node_api_client
node_weather_page -->|"requests data"| node_api_client
node_market_page -->|"requests prices"| node_api_client
node_crop_page -->|"requests diagnosis"| node_api_client
node_chatbot_page -->|"requests answers"| node_api_client
node_alerts_page -->|"requests alerts"| node_api_client
node_analysis_page -->|"renders charts"| node_charts
node_weather_page -->|"renders charts"| node_charts
node_market_page -->|"renders charts"| node_charts
node_webapp -->|"registers language changes"| node_i18n
node_api_client -->|"sends API requests"| node_flask
node_api_client -->|"uploads leaf images"| node_image_service
node_flask -->|"requests predictions"| node_predictions
node_flask -->|"uses models"| node_database
node_flask -->|"fetches weather"| node_weather_etl
node_flask -->|"fetches soil"| node_soil_etl
node_flask -->|"resolves location"| node_geo_etl
node_flask -->|"fetches prices"| node_market_etl
node_flask -->|"fetches news"| node_news_etl
node_flask -->|"generates alerts"| node_alert_engine
node_alert_engine -->|"fetches forecast"| node_weather_etl
node_weather_etl -->|"fetches conditions"| node_weather_service
node_soil_etl -->|"retrieves soil data"| node_soil_service
node_geo_etl -->|"resolves coordinates"| node_geocoding_services
node_market_etl -->|"fetches live prices"| node_market_service
node_news_etl -->|"collects news"| node_news_service

click node_webapp "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/app.js"
click node_api_client "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/api.js"
click node_analysis_page "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/analysis.js"
click node_weather_page "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/weather.js"
click node_market_page "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/market.js"
click node_crop_page "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/cropDoctor.js"
click node_chatbot_page "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/chatbot.js"
click node_alerts_page "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/alerts.js"
click node_experts_page "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/experts.js"
click node_home_page "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/home.js"
click node_i18n "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/i18n.js"
click node_charts "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/charts.js"
click node_flask "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/api.py"
click node_predictions "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/predictions.py"
click node_database "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/models/database.py"
click node_weather_etl "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/etl/weather_etl.py"
click node_soil_etl "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/etl/soil_etl.py"
click node_geo_etl "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/etl/geocoding_etl.py"
click node_market_etl "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/etl/market_etl.py"
click node_news_etl "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/etl/news_etl.py"
click node_alert_engine "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/alerts/alert_engine.py"
click node_image_service "https://github.com/raghupathi24891a0545/ag-marknet/blob/main/image_detection/app.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_api_client,node_analysis_page,node_weather_page,node_market_page,node_crop_page,node_chatbot_page,node_alerts_page,node_experts_page,node_home_page,node_i18n,node_charts toneBlue
class node_flask,node_predictions,node_database toneAmber
class node_weather_etl,node_soil_etl,node_geo_etl,node_market_etl,node_news_etl,node_market_service toneMint
class node_alert_engine,node_image_service toneRose
class node_farmer,node_weather_service,node_soil_service,node_geocoding_services,node_news_service toneIndigo
```

## Components

### Farmer Web App

- [Page Router](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [API Client](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/api.js): `frontend/js/api.js`
- [Farm Analysis](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/analysis.js): `frontend/js/pages/analysis.js`
- [Weather Page](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/weather.js): `frontend/js/pages/weather.js`
- [Market Page](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/market.js): `frontend/js/pages/market.js`
- [Crop Doctor](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/cropDoctor.js): `frontend/js/pages/cropDoctor.js`
- [Chatbot](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/chatbot.js): `frontend/js/pages/chatbot.js`
- [Alerts Page](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/alerts.js): `frontend/js/pages/alerts.js`
- [Expert Directory](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/experts.js): `frontend/js/pages/experts.js`
- [Home Dashboard](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/pages/home.js): `frontend/js/pages/home.js`
- [English-Telugu](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/i18n.js): `frontend/js/i18n.js`
- [Data Charts](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/frontend/js/charts.js): `frontend/js/charts.js`

### Farm Intelligence

- [Flask API](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/api.py): `backend/api.py`
- [Crop & Fertilizer ML](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/predictions.py): `backend/predictions.py`
- [Farm Data Store](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/models/database.py): `backend/models/database.py`

### Agricultural Data

- [Weather ETL](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/etl/weather_etl.py): `backend/etl/weather_etl.py`
- [Soil ETL](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/etl/soil_etl.py): `backend/etl/soil_etl.py`
- [Geocoding ETL](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/etl/geocoding_etl.py): `backend/etl/geocoding_etl.py`
- [Market ETL](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/etl/market_etl.py): `backend/etl/market_etl.py`
- [Agriculture News](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/etl/news_etl.py): `backend/etl/news_etl.py`

### Farmer Support

- [Alert Engine](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/backend/alerts/alert_engine.py): `backend/alerts/alert_engine.py`
- [Leaf Disease Service](https://github.com/raghupathi24891a0545/ag-marknet/blob/main/image_detection/app.py): `image_detection/app.py`

### Other components

- **Farmer**
- **OpenWeatherMap**
- **SoilGrids**
- **Geocoding Providers**
- **Agmarknet API**
- **News Sources**

## Connections

- Farmer → Page Router: uses (evidence: `README.md`)
- Page Router → Farm Analysis: routes to (evidence: `frontend/js/app.js`)
- Page Router → Weather Page: routes to (evidence: `frontend/js/app.js`)
- Page Router → Market Page: routes to (evidence: `frontend/js/app.js`)
- Page Router → Crop Doctor: routes to (evidence: `frontend/js/app.js`)
- Page Router → Chatbot: routes to (evidence: `frontend/js/app.js`)
- Page Router → Alerts Page: routes to (evidence: `frontend/js/app.js`)
- Page Router → Expert Directory: routes to (evidence: `frontend/js/app.js`)
- Page Router → Home Dashboard: routes to (evidence: `frontend/js/app.js`)
- Farm Analysis → API Client: requests analysis (evidence: `frontend/js/pages/analysis.js`)
- Weather Page → API Client: requests data (evidence: `frontend/js/pages/weather.js`)
- Market Page → API Client: requests prices (evidence: `frontend/js/pages/market.js`)
- Crop Doctor → API Client: requests diagnosis (evidence: `frontend/js/pages/cropDoctor.js`)
- Chatbot → API Client: requests answers (evidence: `frontend/js/pages/chatbot.js`)
- Alerts Page → API Client: requests alerts (evidence: `frontend/js/pages/alerts.js`)
- Farm Analysis → Data Charts: renders charts (evidence: `frontend/js/pages/analysis.js`)
- Weather Page → Data Charts: renders charts (evidence: `frontend/js/pages/weather.js`)
- Market Page → Data Charts: renders charts (evidence: `frontend/js/pages/market.js`)
- Page Router → English-Telugu: registers language changes (evidence: `frontend/js/app.js`)
- API Client → Flask API: sends API requests (evidence: `frontend/js/api.js`)
- API Client → Leaf Disease Service: uploads leaf images (evidence: `frontend/js/api.js`)
- Flask API → Crop & Fertilizer ML: requests predictions (evidence: `backend/api.py`)
- Flask API → Farm Data Store: uses models (evidence: `backend/api.py`)
- Flask API → Weather ETL: fetches weather (evidence: `backend/api.py`)
- Flask API → Soil ETL: fetches soil (evidence: `backend/api.py`)
- Flask API → Geocoding ETL: resolves location (evidence: `backend/api.py`)
- Flask API → Market ETL: fetches prices (evidence: `backend/api.py`)
- Flask API → Agriculture News: fetches news (evidence: `backend/api.py`)
- Flask API → Alert Engine: generates alerts (evidence: `backend/api.py`)
- Alert Engine → Weather ETL: fetches forecast (evidence: `backend/alerts/alert_engine.py`)
- Weather ETL → OpenWeatherMap: fetches conditions (evidence: `README.md`)
- Soil ETL → SoilGrids: retrieves soil data (evidence: `README.md`)
- Geocoding ETL → Geocoding Providers: resolves coordinates (evidence: `README.md`)
- Market ETL → Agmarknet API: fetches live prices (evidence: `README.md`)
- Agriculture News → News Sources: collects news (evidence: `README.md`)
