# shrirambhat-2508/agriguard architecture

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

- Interactive diagram: https://gitdiagram.com/shrirambhat-2508/agriguard
- Repository: https://github.com/shrirambhat-2508/agriguard

## Overview

AgriGuard is an offline-oriented crop monitoring web app. Users can review field conditions, capture a crop photo for an AI-style analysis flow, and inspect saved reports and trends; they can also manage crops and settings. The sampled code shows screen selection and record state in the app shell, with local mock records and sensor readings rather than a demonstrated backend or physical sensor connection. The README is empty, so capability coverage and relationships rely on the source index and shown excerpts; some screen internals were not sampled.

Main entry points: [`src/App.tsx`](https://github.com/shrirambhat-2508/agriguard/blob/main/src/App.tsx) (App shell), [`src/data/mockData.ts`](https://github.com/shrirambhat-2508/agriguard/blob/main/src/data/mockData.ts) (Local records), [`src/components/MetricCard.tsx`](https://github.com/shrirambhat-2508/agriguard/blob/main/src/components/MetricCard.tsx) (Metric card), [`src/screens/SettingsScreen.tsx`](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/SettingsScreen.tsx) (Settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Crop analysis"]
  node_crop_photo["Crop photo"]
  node_ai_analysis["AI analysis"]
  node_crop_result["Crop result"]
  node_error["Error states<br/>[ErrorScreen.tsx]"]
end

subgraph group_monitor["Field monitoring"]
  node_home["Home dashboard<br/>[HomeScreen.tsx]"]
  node_sensor["Sensor view<br/>[SensorScreen.tsx]"]
  node_metric_detail["Metric detail"]
end

subgraph group_records["Reports and insights"]
  node_history["History<br/>[HistoryScreen.tsx]"]
  node_history_detail["History detail"]
  node_saved_report["Saved report"]
  node_insights["Insights<br/>[InsightsScreen.tsx]"]
  node_overall["Overall analysis"]
end

subgraph group_manage["Farm management"]
  node_manage_crops["Manage crops"]
  node_settings["Settings<br/>[SettingsScreen.tsx]"]
  node_crop_catalog["Crop catalog<br/>[crops.ts]"]
end

subgraph group_shared["Shared app layer"]
  node_app["App shell<br/>[App.tsx]"]
  node_records_data["Local records<br/>[mockData.ts]"]
  node_metric_card["Metric card<br/>[MetricCard.tsx]"]
  node_button["Action button<br/>[Button.tsx]"]
  node_topbar["Screen header<br/>[TopBar.tsx]"]
  node_navigation["App navigation<br/>[BottomNav.tsx]"]
  node_sidebar["Sidebar navigation<br/>[Sidebar.tsx]"]
  node_chart["Insight chart<br/>[InsightChart.tsx]"]
end

node_user(("Farmer"))

node_user -.->|"uses"| node_app
node_app -->|"renders"| node_home
node_app -->|"renders"| node_sensor
node_app -->|"renders"| node_crop_photo
node_app -->|"renders"| node_ai_analysis
node_app -->|"renders"| node_crop_result
node_app -->|"renders"| node_error
node_app -->|"renders"| node_history
node_app -->|"renders"| node_history_detail
node_app -->|"renders"| node_saved_report
node_app -->|"renders"| node_insights
node_app -->|"renders"| node_overall
node_app -->|"renders"| node_metric_detail
node_app -->|"renders"| node_manage_crops
node_app -->|"renders"| node_settings
node_app -->|"renders"| node_navigation
node_app -->|"renders"| node_sidebar
node_home -->|"reads"| node_records_data
node_home -->|"reads"| node_crop_catalog
node_home -->|"renders"| node_metric_card
node_sensor -->|"reads"| node_records_data
node_sensor -->|"renders"| node_metric_card
node_crop_result -->|"reads"| node_records_data
node_crop_result -->|"renders"| node_metric_card
node_history -->|"reads"| node_records_data
node_history -->|"renders"| node_metric_card
node_history_detail -->|"reads"| node_records_data
node_history_detail -->|"renders"| node_metric_card
node_saved_report -->|"renders"| node_metric_card
node_insights -->|"reads"| node_records_data
node_insights -->|"renders"| node_chart
node_metric_detail -->|"reads"| node_records_data
node_manage_crops -->|"searches"| node_crop_catalog
node_settings -->|"reads"| node_crop_catalog
node_settings -->|"reads"| node_records_data
node_crop_photo -->|"renders"| node_button
node_settings -->|"renders"| node_button
node_settings -->|"renders"| node_topbar

click node_app "https://github.com/shrirambhat-2508/agriguard/blob/main/src/App.tsx"
click node_home "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/HomeScreen.tsx"
click node_sensor "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/SensorScreen.tsx"
click node_crop_photo "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/CropPhotoScreen.tsx"
click node_ai_analysis "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/AIAnalysisScreen.tsx"
click node_crop_result "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/CropResultScreen.tsx"
click node_error "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/ErrorScreen.tsx"
click node_history "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/HistoryScreen.tsx"
click node_history_detail "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/HistoryDetailScreen.tsx"
click node_saved_report "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/SavedReportScreen.tsx"
click node_insights "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/InsightsScreen.tsx"
click node_overall "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/OverallAnalysisScreen.tsx"
click node_metric_detail "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/MetricDetailScreen.tsx"
click node_manage_crops "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/ManageCropsScreen.tsx"
click node_settings "https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/SettingsScreen.tsx"
click node_crop_catalog "https://github.com/shrirambhat-2508/agriguard/blob/main/src/data/crops.ts"
click node_records_data "https://github.com/shrirambhat-2508/agriguard/blob/main/src/data/mockData.ts"
click node_metric_card "https://github.com/shrirambhat-2508/agriguard/blob/main/src/components/MetricCard.tsx"
click node_button "https://github.com/shrirambhat-2508/agriguard/blob/main/src/components/Button.tsx"
click node_topbar "https://github.com/shrirambhat-2508/agriguard/blob/main/src/components/TopBar.tsx"
click node_navigation "https://github.com/shrirambhat-2508/agriguard/blob/main/src/components/BottomNav.tsx"
click node_sidebar "https://github.com/shrirambhat-2508/agriguard/blob/main/src/components/Sidebar.tsx"
click node_chart "https://github.com/shrirambhat-2508/agriguard/blob/main/src/components/InsightChart.tsx"

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_crop_photo,node_ai_analysis,node_crop_result,node_error toneBlue
class node_home,node_sensor,node_metric_detail toneAmber
class node_history,node_history_detail,node_saved_report,node_insights,node_overall toneMint
class node_manage_crops,node_settings,node_crop_catalog toneRose
class node_app,node_records_data,node_metric_card,node_button,node_topbar,node_navigation,node_sidebar,node_chart,node_user toneIndigo
```

## Components

### Crop analysis

- [Crop photo](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/CropPhotoScreen.tsx): `src/screens/CropPhotoScreen.tsx`
- [AI analysis](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/AIAnalysisScreen.tsx): `src/screens/AIAnalysisScreen.tsx`
- [Crop result](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/CropResultScreen.tsx): `src/screens/CropResultScreen.tsx`
- [Error states](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/ErrorScreen.tsx): `src/screens/ErrorScreen.tsx`

### Field monitoring

- [Home dashboard](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/HomeScreen.tsx): `src/screens/HomeScreen.tsx`
- [Sensor view](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/SensorScreen.tsx): `src/screens/SensorScreen.tsx`
- [Metric detail](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/MetricDetailScreen.tsx): `src/screens/MetricDetailScreen.tsx`

### Reports and insights

- [History](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/HistoryScreen.tsx): `src/screens/HistoryScreen.tsx`
- [History detail](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/HistoryDetailScreen.tsx): `src/screens/HistoryDetailScreen.tsx`
- [Saved report](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/SavedReportScreen.tsx): `src/screens/SavedReportScreen.tsx`
- [Insights](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/InsightsScreen.tsx): `src/screens/InsightsScreen.tsx`
- [Overall analysis](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/OverallAnalysisScreen.tsx): `src/screens/OverallAnalysisScreen.tsx`

### Farm management

- [Manage crops](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/ManageCropsScreen.tsx): `src/screens/ManageCropsScreen.tsx`
- [Settings](https://github.com/shrirambhat-2508/agriguard/blob/main/src/screens/SettingsScreen.tsx): `src/screens/SettingsScreen.tsx`
- [Crop catalog](https://github.com/shrirambhat-2508/agriguard/blob/main/src/data/crops.ts): `src/data/crops.ts`

### Shared app layer

- [App shell](https://github.com/shrirambhat-2508/agriguard/blob/main/src/App.tsx): `src/App.tsx`
- [Local records](https://github.com/shrirambhat-2508/agriguard/blob/main/src/data/mockData.ts): `src/data/mockData.ts`
- [Metric card](https://github.com/shrirambhat-2508/agriguard/blob/main/src/components/MetricCard.tsx): `src/components/MetricCard.tsx`
- [Action button](https://github.com/shrirambhat-2508/agriguard/blob/main/src/components/Button.tsx): `src/components/Button.tsx`
- [Screen header](https://github.com/shrirambhat-2508/agriguard/blob/main/src/components/TopBar.tsx): `src/components/TopBar.tsx`
- [App navigation](https://github.com/shrirambhat-2508/agriguard/blob/main/src/components/BottomNav.tsx): `src/components/BottomNav.tsx`
- [Sidebar navigation](https://github.com/shrirambhat-2508/agriguard/blob/main/src/components/Sidebar.tsx): `src/components/Sidebar.tsx`
- [Insight chart](https://github.com/shrirambhat-2508/agriguard/blob/main/src/components/InsightChart.tsx): `src/components/InsightChart.tsx`

### Other components

- **Farmer**

## Connections

- Farmer → App shell: uses
- App shell → Home dashboard: renders (evidence: `src/App.tsx`)
- App shell → Sensor view: renders (evidence: `src/App.tsx`)
- App shell → Crop photo: renders (evidence: `src/App.tsx`)
- App shell → AI analysis: renders (evidence: `src/App.tsx`)
- App shell → Crop result: renders (evidence: `src/App.tsx`)
- App shell → Error states: renders (evidence: `src/App.tsx`)
- App shell → History: renders (evidence: `src/App.tsx`)
- App shell → History detail: renders (evidence: `src/App.tsx`)
- App shell → Saved report: renders (evidence: `src/App.tsx`)
- App shell → Insights: renders (evidence: `src/App.tsx`)
- App shell → Overall analysis: renders (evidence: `src/App.tsx`)
- App shell → Metric detail: renders (evidence: `src/App.tsx`)
- App shell → Manage crops: renders (evidence: `src/App.tsx`)
- App shell → Settings: renders (evidence: `src/App.tsx`)
- App shell → App navigation: renders (evidence: `src/App.tsx`)
- App shell → Sidebar navigation: renders (evidence: `src/App.tsx`)
- Home dashboard → Local records: reads (evidence: `src/screens/HomeScreen.tsx`)
- Home dashboard → Crop catalog: reads (evidence: `src/screens/HomeScreen.tsx`)
- Home dashboard → Metric card: renders (evidence: `src/screens/HomeScreen.tsx`)
- Sensor view → Local records: reads (evidence: `src/screens/SensorScreen.tsx`)
- Sensor view → Metric card: renders (evidence: `src/screens/SensorScreen.tsx`)
- Crop result → Local records: reads (evidence: `src/screens/CropResultScreen.tsx`)
- Crop result → Metric card: renders (evidence: `src/screens/CropResultScreen.tsx`)
- History → Local records: reads (evidence: `src/screens/HistoryScreen.tsx`)
- History → Metric card: renders (evidence: `src/screens/HistoryScreen.tsx`)
- History detail → Local records: reads (evidence: `src/screens/HistoryDetailScreen.tsx`)
- History detail → Metric card: renders (evidence: `src/screens/HistoryDetailScreen.tsx`)
- Saved report → Metric card: renders (evidence: `src/screens/SavedReportScreen.tsx`)
- Insights → Local records: reads (evidence: `src/screens/InsightsScreen.tsx`)
- Insights → Insight chart: renders (evidence: `src/screens/InsightsScreen.tsx`)
- Metric detail → Local records: reads (evidence: `src/screens/MetricDetailScreen.tsx`)
- Manage crops → Crop catalog: searches (evidence: `src/screens/ManageCropsScreen.tsx`)
- Settings → Crop catalog: reads (evidence: `src/screens/SettingsScreen.tsx`)
- Settings → Local records: reads (evidence: `src/screens/SettingsScreen.tsx`)
- Crop photo → Action button: renders (evidence: `src/screens/CropPhotoScreen.tsx`)
- Settings → Action button: renders (evidence: `src/screens/SettingsScreen.tsx`)
- Settings → Screen header: renders (evidence: `src/screens/SettingsScreen.tsx`)
