# dipeshpadole786/asymptote_ps09 architecture

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

- Interactive diagram: https://gitdiagram.com/dipeshpadole786/asymptote_ps09
- Repository: https://github.com/dipeshpadole786/asymptote_ps09

## Overview

KisanPlan is a mobile farm-planning app: a farmer signs in, sets a farm location and crop, then views weather, soil, and sensor conditions to get irrigation, spraying, and weekly field guidance. The app also offers crop scanning, a field map, alerts, and demo sensor controls. The graph follows the documented app/context/planning relationships and sampled imports; backend and device wiring not demonstrated in the excerpts is left unconnected.

Main entry points: [`App.tsx`](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/App.tsx) (App routing), [`screens/DashboardScreen.tsx`](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/DashboardScreen.tsx) (Dashboard), [`context/PlanContext.tsx`](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/context/PlanContext.tsx) (Plan state), [`logic/plannerLogic.ts`](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/logic/plannerLogic.ts) (Weekly plan)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Mobile app"]
  node_app["App routing<br/>[App.tsx]"]
  node_dashboard["Dashboard"]
  node_alerts["Alerts screen<br/>[AlertsScreen.tsx]"]
  node_ui["Shared UI<br/>[ui.tsx]"]
  node_nav["Bottom navigation"]
end

subgraph group_farm["Farm setup"]
  node_farmstate["Farm state<br/>[FarmContext.tsx]"]
  node_session["Session guard"]
  node_farmsetup["Farm setup"]
  node_login["Sign in<br/>[LoginScreen.tsx]"]
  node_map["Field map<br/>[FieldMapScreen.tsx]"]
  node_scan["Crop scan<br/>[ScanCropScreen.tsx]"]
  node_more["Farm settings<br/>[MoreScreen.tsx]"]
  node_cropcard["Crop check card<br/>[CropCheckCard.tsx]"]
end

subgraph group_planning["Farm planning"]
  node_planner["Planner screen<br/>[PlannerScreen.tsx]"]
  node_planstate["Plan state<br/>[PlanContext.tsx]"]
  node_plannerwidget["Seven-day planner"]
  node_weathercard["Weather card<br/>[WeatherCard.tsx]"]
  node_soilcard["Soil moisture card"]
  node_alertcard["Alert card<br/>[AlertCard.tsx]"]
  node_motorcard["Motor activity"]
end

subgraph group_integrations["Data integrations"]
  node_weather["Weather service<br/>[weatherService.ts]"]
  node_soil["Soil service<br/>[soilService.ts]"]
  node_sensors["Sensor service<br/>[sensorService.ts]"]
  node_prediction["Crop prediction<br/>[predictService.ts]"]
  node_location["Location service<br/>[locationService.ts]"]
  node_grok["Grok advisor<br/>[grokService.ts]"]
end

subgraph group_rules["Planning logic"]
  node_plannerlogic["Weekly plan<br/>[plannerLogic.ts]"]
  node_irrigation["Irrigation rules<br/>[irrigationLogic.ts]"]
  node_spraying["Spraying rules<br/>[sprayingLogic.ts]"]
  node_thresholds["Decision thresholds<br/>[thresholds.ts]"]
end

node_farmer(("Farmer"))
node_weatherapi{{"Open-Meteo"}}
node_soilgrids{{"SoilGrids"}}
node_sensorapi{{"IoT sensor endpoint"}}

node_farmer -->|"uses"| node_app
node_app -->|"routes to"| node_farmsetup
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_map
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_planner
node_app -->|"routes to"| node_alerts
node_app -->|"routes to"| node_scan
node_app -->|"routes to"| node_more
node_app -->|"provides state"| node_farmstate
node_app -->|"provides state"| node_planstate
node_farmsetup -->|"saves profile"| node_farmstate
node_login -->|"updates session"| node_farmstate
node_map -->|"uses location"| node_location
node_farmsetup -->|"uses location"| node_location
node_dashboard -->|"checks session"| node_session
node_planner -->|"checks session"| node_session
node_scan -->|"checks session"| node_session
node_map -->|"checks session"| node_session
node_more -->|"checks session"| node_session
node_scan -->|"requests prediction"| node_prediction
node_planstate -->|"reads farm state"| node_farmstate
node_planstate -->|"loads forecast"| node_weather
node_planstate -->|"loads soil data"| node_soil
node_planstate -->|"loads readings"| node_sensors
node_planstate -->|"builds plan"| node_plannerlogic
node_planstate -->|"checks advisor"| node_grok
node_plannerlogic -->|"decides irrigation"| node_irrigation
node_plannerlogic -->|"decides spraying"| node_spraying
node_irrigation -->|"reads limits"| node_thresholds
node_spraying -->|"reads limits"| node_thresholds
node_weather -->|"fetches forecast"| node_weatherapi
node_soil -->|"fetches soil"| node_soilgrids
node_sensors -->|"fetches readings"| node_sensorapi
node_dashboard -->|"renders"| node_plannerwidget
node_dashboard -->|"renders"| node_weathercard
node_dashboard -->|"renders"| node_soilcard
node_dashboard -->|"renders"| node_alertcard
node_dashboard -->|"renders"| node_cropcard
node_dashboard -->|"renders"| node_motorcard
node_dashboard -->|"renders"| node_nav
node_planner -->|"renders"| node_plannerwidget
node_plannerwidget -->|"reads plan types"| node_plannerlogic
node_weathercard -->|"reads forecast"| node_weather
node_soilcard -->|"reads sensor data"| node_sensors
node_soilcard -->|"reads soil data"| node_soil
node_motorcard -->|"reads motor data"| node_sensors
node_alertcard -->|"reads alert types"| node_plannerlogic

click node_app "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/App.tsx"
click node_farmstate "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/context/FarmContext.tsx"
click node_session "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/hooks/useRequireSession.ts"
click node_farmsetup "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/FarmSetupScreen.tsx"
click node_login "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/LoginScreen.tsx"
click node_map "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/FieldMapScreen.tsx"
click node_dashboard "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/DashboardScreen.tsx"
click node_planner "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/PlannerScreen.tsx"
click node_alerts "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/AlertsScreen.tsx"
click node_scan "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/ScanCropScreen.tsx"
click node_more "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/MoreScreen.tsx"
click node_planstate "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/context/PlanContext.tsx"
click node_plannerlogic "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/logic/plannerLogic.ts"
click node_irrigation "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/logic/irrigationLogic.ts"
click node_spraying "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/logic/sprayingLogic.ts"
click node_thresholds "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/logic/thresholds.ts"
click node_weather "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/services/weatherService.ts"
click node_soil "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/services/soilService.ts"
click node_sensors "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/services/sensorService.ts"
click node_prediction "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/services/predictService.ts"
click node_location "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/services/locationService.ts"
click node_grok "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/services/grokService.ts"
click node_ui "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/ui.tsx"
click node_nav "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/BottomNavigation.tsx"
click node_plannerwidget "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/SevenDayPlanner.tsx"
click node_weathercard "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/WeatherCard.tsx"
click node_soilcard "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/SoilMoistureCard.tsx"
click node_alertcard "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/AlertCard.tsx"
click node_cropcard "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/CropCheckCard.tsx"
click node_motorcard "https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/MotorActivityCard.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_app,node_dashboard,node_alerts,node_ui,node_nav toneBlue
class node_farmstate,node_session,node_farmsetup,node_login,node_map,node_scan,node_more,node_cropcard toneAmber
class node_planner,node_planstate,node_plannerwidget,node_weathercard,node_soilcard,node_alertcard,node_motorcard toneMint
class node_weather,node_soil,node_sensors,node_prediction,node_location,node_grok toneRose
class node_plannerlogic,node_irrigation,node_spraying,node_thresholds,node_farmer,node_weatherapi,node_soilgrids,node_sensorapi toneIndigo
```

## Components

### Mobile app

- [App routing](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/App.tsx): `App.tsx`
- [Dashboard](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/DashboardScreen.tsx): `screens/DashboardScreen.tsx`
- [Alerts screen](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/AlertsScreen.tsx): `screens/AlertsScreen.tsx`
- [Shared UI](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/ui.tsx): `components/ui.tsx`
- [Bottom navigation](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/BottomNavigation.tsx): `components/BottomNavigation.tsx`

### Farm setup

- [Farm state](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/context/FarmContext.tsx): `context/FarmContext.tsx`
- [Session guard](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/hooks/useRequireSession.ts): `hooks/useRequireSession.ts`
- [Farm setup](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/FarmSetupScreen.tsx): `screens/FarmSetupScreen.tsx`
- [Sign in](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/LoginScreen.tsx): `screens/LoginScreen.tsx`
- [Field map](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/FieldMapScreen.tsx): `screens/FieldMapScreen.tsx`
- [Crop scan](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/ScanCropScreen.tsx): `screens/ScanCropScreen.tsx`
- [Farm settings](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/MoreScreen.tsx): `screens/MoreScreen.tsx`
- [Crop check card](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/CropCheckCard.tsx): `components/CropCheckCard.tsx`

### Farm planning

- [Planner screen](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/screens/PlannerScreen.tsx): `screens/PlannerScreen.tsx`
- [Plan state](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/context/PlanContext.tsx): `context/PlanContext.tsx`
- [Seven-day planner](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/SevenDayPlanner.tsx): `components/SevenDayPlanner.tsx`
- [Weather card](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/WeatherCard.tsx): `components/WeatherCard.tsx`
- [Soil moisture card](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/SoilMoistureCard.tsx): `components/SoilMoistureCard.tsx`
- [Alert card](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/AlertCard.tsx): `components/AlertCard.tsx`
- [Motor activity](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/components/MotorActivityCard.tsx): `components/MotorActivityCard.tsx`

### Data integrations

- [Weather service](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/services/weatherService.ts): `services/weatherService.ts`
- [Soil service](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/services/soilService.ts): `services/soilService.ts`
- [Sensor service](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/services/sensorService.ts): `services/sensorService.ts`
- [Crop prediction](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/services/predictService.ts): `services/predictService.ts`
- [Location service](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/services/locationService.ts): `services/locationService.ts`
- [Grok advisor](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/services/grokService.ts): `services/grokService.ts`

### Planning logic

- [Weekly plan](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/logic/plannerLogic.ts): `logic/plannerLogic.ts`
- [Irrigation rules](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/logic/irrigationLogic.ts): `logic/irrigationLogic.ts`
- [Spraying rules](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/logic/sprayingLogic.ts): `logic/sprayingLogic.ts`
- [Decision thresholds](https://github.com/dipeshpadole786/asymptote_ps09/blob/main/logic/thresholds.ts): `logic/thresholds.ts`

### Other components

- **Farmer**
- **Open-Meteo**
- **SoilGrids**
- **IoT sensor endpoint**

## Connections

- Farmer → App routing: uses
- App routing → Farm setup: routes to (evidence: `App.tsx`)
- App routing → Sign in: routes to (evidence: `App.tsx`)
- App routing → Field map: routes to (evidence: `App.tsx`)
- App routing → Dashboard: routes to (evidence: `App.tsx`)
- App routing → Planner screen: routes to (evidence: `App.tsx`)
- App routing → Alerts screen: routes to (evidence: `App.tsx`)
- App routing → Crop scan: routes to (evidence: `App.tsx`)
- App routing → Farm settings: routes to (evidence: `App.tsx`)
- App routing → Farm state: provides state (evidence: `App.tsx`)
- App routing → Plan state: provides state (evidence: `App.tsx`)
- Farm setup → Farm state: saves profile (evidence: `screens/FarmSetupScreen.tsx`)
- Sign in → Farm state: updates session (evidence: `screens/LoginScreen.tsx`)
- Field map → Location service: uses location (evidence: `screens/FieldMapScreen.tsx`)
- Farm setup → Location service: uses location (evidence: `screens/FarmSetupScreen.tsx`)
- Dashboard → Session guard: checks session (evidence: `screens/DashboardScreen.tsx`)
- Planner screen → Session guard: checks session (evidence: `screens/PlannerScreen.tsx`)
- Crop scan → Session guard: checks session (evidence: `screens/ScanCropScreen.tsx`)
- Field map → Session guard: checks session (evidence: `screens/FieldMapScreen.tsx`)
- Farm settings → Session guard: checks session (evidence: `screens/MoreScreen.tsx`)
- Crop scan → Crop prediction: requests prediction (evidence: `screens/ScanCropScreen.tsx`)
- Plan state → Farm state: reads farm state (evidence: `context/PlanContext.tsx`)
- Plan state → Weather service: loads forecast (evidence: `context/PlanContext.tsx`)
- Plan state → Soil service: loads soil data (evidence: `context/PlanContext.tsx`)
- Plan state → Sensor service: loads readings (evidence: `context/PlanContext.tsx`)
- Plan state → Weekly plan: builds plan (evidence: `context/PlanContext.tsx`)
- Plan state → Grok advisor: checks advisor (evidence: `context/PlanContext.tsx`)
- Weekly plan → Irrigation rules: decides irrigation (evidence: `logic/plannerLogic.ts`)
- Weekly plan → Spraying rules: decides spraying (evidence: `logic/plannerLogic.ts`)
- Irrigation rules → Decision thresholds: reads limits (evidence: `logic/irrigationLogic.ts`)
- Spraying rules → Decision thresholds: reads limits (evidence: `logic/sprayingLogic.ts`)
- Weather service → Open-Meteo: fetches forecast (evidence: `services/weatherService.ts`)
- Soil service → SoilGrids: fetches soil (evidence: `services/soilService.ts`)
- Sensor service → IoT sensor endpoint: fetches readings (evidence: `services/sensorService.ts`)
- Dashboard → Seven-day planner: renders (evidence: `screens/DashboardScreen.tsx`)
- Dashboard → Weather card: renders (evidence: `screens/DashboardScreen.tsx`)
- Dashboard → Soil moisture card: renders (evidence: `screens/DashboardScreen.tsx`)
- Dashboard → Alert card: renders (evidence: `screens/DashboardScreen.tsx`)
- Dashboard → Crop check card: renders (evidence: `screens/DashboardScreen.tsx`)
- Dashboard → Motor activity: renders (evidence: `screens/DashboardScreen.tsx`)
- Dashboard → Bottom navigation: renders (evidence: `screens/DashboardScreen.tsx`)
- Planner screen → Seven-day planner: renders (evidence: `screens/PlannerScreen.tsx`)
- Seven-day planner → Weekly plan: reads plan types (evidence: `components/SevenDayPlanner.tsx`)
- Weather card → Weather service: reads forecast (evidence: `components/WeatherCard.tsx`)
- Soil moisture card → Sensor service: reads sensor data (evidence: `components/SoilMoistureCard.tsx`)
- Soil moisture card → Soil service: reads soil data (evidence: `components/SoilMoistureCard.tsx`)
- Motor activity → Sensor service: reads motor data (evidence: `components/MotorActivityCard.tsx`)
- Alert card → Weekly plan: reads alert types (evidence: `components/AlertCard.tsx`)
