# winterhell823/agritech architecture

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

- Interactive diagram: https://gitdiagram.com/winterhell823/agritech
- Repository: https://github.com/winterhell823/agritech

## Overview

AI Crop Intelligence combines a React GIS dashboard, Spring Boot domain APIs, and a Python multimodal inference service. Users inspect field conditions over maps and time, receive crop-type, phenology, and moisture-stress insights, and use those insights for irrigation decisions and reports. The README documents the high-level flow and integrations; sampled code confirms frontend routing and AI route registration. Most backend and model internals were not sampled, so detailed implementation links are intentionally omitted.

Main entry points: [`src/main/java/com/agritech/CropIntelligenceApplication.java`](https://github.com/winterhell823/agritech/blob/main/src/main/java/com/agritech/CropIntelligenceApplication.java) (Spring REST API), [`ai-service/app/models/multimodal_model.py`](https://github.com/winterhell823/agritech/blob/main/ai-service/app/models/multimodal_model.py) (Multimodal model), [`frontend/src/App.jsx`](https://github.com/winterhell823/agritech/blob/main/frontend/src/App.jsx) (React app routes), [`ai-service/main.py`](https://github.com/winterhell823/agritech/blob/main/ai-service/main.py) (AI service routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_app["React app routes<br/>[App.jsx]"]
  node_dashboard["GIS dashboard<br/>[DashboardPage.jsx]"]
  node_fieldviews["Field monitoring"]
  node_fielddetails["Field details"]
  node_maps["Map layers<br/>[GISMap.jsx]"]
  node_timeslider["Observation timeline<br/>[TimeSlider.jsx]"]
  node_reportsview["Reports UI<br/>[ReportsPage.jsx]"]
end

subgraph group_backend["Domain APIs"]
  node_api["Spring REST API"]
  node_fielddomain["Field management"]
  node_satellite["Satellite scenes"]
  node_prediction["Predictions"]
  node_phenology["Phenology records"]
  node_stress["Stress records"]
  node_report["Report lifecycle<br/>[ReportService.java]"]
  node_chat["RAG assistant"]
  node_weather["Weather data API"]
end

subgraph group_ai["AI inference"]
  node_aiapi["AI service routes<br/>[main.py]"]
  node_predict["Multi-task prediction<br/>[predict.py]"]
  node_explain["Model explanations<br/>[explain.py]"]
  node_phenroute["Phenology analysis<br/>[phenology.py]"]
  node_stressroute["Stress analysis<br/>[stress.py]"]
  node_model["Multimodal model"]
  node_prithvi["Prithvi encoder<br/>[prithvi_lora.py]"]
  node_fusion["Feature fusion<br/>[fusion_module.py]"]
  node_sar["SAR encoder<br/>[sar_cnn.py]"]
  node_weatherenc["Weather encoder<br/>[weather_mlp.py]"]
  node_inference["Inference runtime<br/>[predictor.py]"]
end

subgraph group_data["Data and training"]
  node_preprocess["Input preprocessing"]
  node_features["Satellite features"]
  node_training["Model training<br/>[train.py]"]
  node_s3[("Geospatial object storage<br/>[s3_client.py]")]
end

node_user(("Agriculture user"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_fieldviews
node_app -->|"routes to"| node_fielddetails
node_app -->|"routes to"| node_reportsview
node_dashboard -->|"visualizes fields"| node_maps
node_dashboard -->|"browses dates"| node_timeslider
node_app -.->|"requests insights"| node_api
node_api -.->|"serves field data"| node_fielddomain
node_api -.->|"manages scenes"| node_satellite
node_api -.->|"serves predictions"| node_prediction
node_api -.->|"serves stages"| node_phenology
node_api -.->|"serves stress"| node_stress
node_api -.->|"handles reports"| node_report
node_api -.->|"supports queries"| node_chat
node_api -->|"calls REST service"| node_aiapi
node_aiapi -->|"registers route"| node_predict
node_aiapi -->|"registers route"| node_explain
node_aiapi -->|"registers route"| node_phenroute
node_aiapi -->|"registers route"| node_stressroute
node_predict -->|"runs inference"| node_model
node_model -->|"extracts EO features"| node_prithvi
node_model -->|"encodes SAR"| node_sar
node_model -->|"encodes weather"| node_weatherenc
node_model -->|"fuses modalities"| node_fusion
node_preprocess -->|"aligns inputs"| node_model
node_model -.->|"produces predictions"| node_inference
node_training -.->|"trains model"| node_model
node_satellite -->|"stores raster objects"| node_s3
node_weather -.->|"provides weather input"| node_preprocess
node_prediction -->|"visualizes insights"| node_maps
node_stress -->|"supports irrigation priorities"| node_dashboard

click node_app "https://github.com/winterhell823/agritech/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/winterhell823/agritech/blob/main/frontend/src/pages/DashboardPage.jsx"
click node_fieldviews "https://github.com/winterhell823/agritech/blob/main/frontend/src/pages/FieldMonitoringPage.jsx"
click node_fielddetails "https://github.com/winterhell823/agritech/blob/main/frontend/src/pages/FieldDetailsPage.jsx"
click node_maps "https://github.com/winterhell823/agritech/blob/main/frontend/src/components/map/GISMap.jsx"
click node_timeslider "https://github.com/winterhell823/agritech/blob/main/frontend/src/components/map/TimeSlider.jsx"
click node_reportsview "https://github.com/winterhell823/agritech/blob/main/frontend/src/pages/ReportsPage.jsx"
click node_api "https://github.com/winterhell823/agritech/blob/main/src/main/java/com/agritech/CropIntelligenceApplication.java"
click node_fielddomain "https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/field"
click node_satellite "https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/satellite"
click node_prediction "https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/prediction"
click node_phenology "https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/phenology"
click node_stress "https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/stress"
click node_report "https://github.com/winterhell823/agritech/blob/main/src/main/java/com/agritech/report/service/ReportService.java"
click node_chat "https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/chat"
click node_aiapi "https://github.com/winterhell823/agritech/blob/main/ai-service/main.py"
click node_predict "https://github.com/winterhell823/agritech/blob/main/ai-service/app/api/routes/predict.py"
click node_explain "https://github.com/winterhell823/agritech/blob/main/ai-service/app/api/routes/explain.py"
click node_phenroute "https://github.com/winterhell823/agritech/blob/main/ai-service/app/api/routes/phenology.py"
click node_stressroute "https://github.com/winterhell823/agritech/blob/main/ai-service/app/api/routes/stress.py"
click node_model "https://github.com/winterhell823/agritech/blob/main/ai-service/app/models/multimodal_model.py"
click node_prithvi "https://github.com/winterhell823/agritech/blob/main/ai-service/app/models/prithvi/prithvi_lora.py"
click node_fusion "https://github.com/winterhell823/agritech/blob/main/ai-service/app/models/fusion/fusion_module.py"
click node_sar "https://github.com/winterhell823/agritech/blob/main/ai-service/app/models/sar_encoder/sar_cnn.py"
click node_weatherenc "https://github.com/winterhell823/agritech/blob/main/ai-service/app/models/weather_encoder/weather_mlp.py"
click node_preprocess "https://github.com/winterhell823/agritech/tree/main/ai-service/app/preprocessing"
click node_features "https://github.com/winterhell823/agritech/blob/main/ai-service/app/features/optical_features.py"
click node_inference "https://github.com/winterhell823/agritech/blob/main/ai-service/app/inference/predictor.py"
click node_training "https://github.com/winterhell823/agritech/blob/main/ai-service/app/training/train.py"
click node_s3 "https://github.com/winterhell823/agritech/blob/main/ai-service/app/storage/s3_client.py"
click node_weather "https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/weather"

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_fieldviews,node_fielddetails,node_maps,node_timeslider,node_reportsview,node_user toneBlue
class node_api,node_fielddomain,node_satellite,node_prediction,node_phenology,node_stress,node_report,node_chat,node_weather toneAmber
class node_aiapi,node_predict,node_explain,node_phenroute,node_stressroute,node_model,node_prithvi,node_fusion,node_sar,node_weatherenc,node_inference toneMint
class node_preprocess,node_features,node_training,node_s3 toneRose
```

## Components

### User experience

- [React app routes](https://github.com/winterhell823/agritech/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [GIS dashboard](https://github.com/winterhell823/agritech/blob/main/frontend/src/pages/DashboardPage.jsx): `frontend/src/pages/DashboardPage.jsx`
- [Field monitoring](https://github.com/winterhell823/agritech/blob/main/frontend/src/pages/FieldMonitoringPage.jsx): `frontend/src/pages/FieldMonitoringPage.jsx`
- [Field details](https://github.com/winterhell823/agritech/blob/main/frontend/src/pages/FieldDetailsPage.jsx): `frontend/src/pages/FieldDetailsPage.jsx`
- [Map layers](https://github.com/winterhell823/agritech/blob/main/frontend/src/components/map/GISMap.jsx): `frontend/src/components/map/GISMap.jsx`
- [Observation timeline](https://github.com/winterhell823/agritech/blob/main/frontend/src/components/map/TimeSlider.jsx): `frontend/src/components/map/TimeSlider.jsx`
- [Reports UI](https://github.com/winterhell823/agritech/blob/main/frontend/src/pages/ReportsPage.jsx): `frontend/src/pages/ReportsPage.jsx`

### Domain APIs

- [Spring REST API](https://github.com/winterhell823/agritech/blob/main/src/main/java/com/agritech/CropIntelligenceApplication.java): `src/main/java/com/agritech/CropIntelligenceApplication.java`
- [Field management](https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/field): `src/main/java/com/agritech/field`
- [Satellite scenes](https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/satellite): `src/main/java/com/agritech/satellite`
- [Predictions](https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/prediction): `src/main/java/com/agritech/prediction`
- [Phenology records](https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/phenology): `src/main/java/com/agritech/phenology`
- [Stress records](https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/stress): `src/main/java/com/agritech/stress`
- [Report lifecycle](https://github.com/winterhell823/agritech/blob/main/src/main/java/com/agritech/report/service/ReportService.java): `src/main/java/com/agritech/report/service/ReportService.java`
- [RAG assistant](https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/chat): `src/main/java/com/agritech/chat`
- [Weather data API](https://github.com/winterhell823/agritech/tree/main/src/main/java/com/agritech/weather): `src/main/java/com/agritech/weather`

### AI inference

- [AI service routes](https://github.com/winterhell823/agritech/blob/main/ai-service/main.py): `ai-service/main.py`
- [Multi-task prediction](https://github.com/winterhell823/agritech/blob/main/ai-service/app/api/routes/predict.py): `ai-service/app/api/routes/predict.py`
- [Model explanations](https://github.com/winterhell823/agritech/blob/main/ai-service/app/api/routes/explain.py): `ai-service/app/api/routes/explain.py`
- [Phenology analysis](https://github.com/winterhell823/agritech/blob/main/ai-service/app/api/routes/phenology.py): `ai-service/app/api/routes/phenology.py`
- [Stress analysis](https://github.com/winterhell823/agritech/blob/main/ai-service/app/api/routes/stress.py): `ai-service/app/api/routes/stress.py`
- [Multimodal model](https://github.com/winterhell823/agritech/blob/main/ai-service/app/models/multimodal_model.py): `ai-service/app/models/multimodal_model.py`
- [Prithvi encoder](https://github.com/winterhell823/agritech/blob/main/ai-service/app/models/prithvi/prithvi_lora.py): `ai-service/app/models/prithvi/prithvi_lora.py`
- [Feature fusion](https://github.com/winterhell823/agritech/blob/main/ai-service/app/models/fusion/fusion_module.py): `ai-service/app/models/fusion/fusion_module.py`
- [SAR encoder](https://github.com/winterhell823/agritech/blob/main/ai-service/app/models/sar_encoder/sar_cnn.py): `ai-service/app/models/sar_encoder/sar_cnn.py`
- [Weather encoder](https://github.com/winterhell823/agritech/blob/main/ai-service/app/models/weather_encoder/weather_mlp.py): `ai-service/app/models/weather_encoder/weather_mlp.py`
- [Inference runtime](https://github.com/winterhell823/agritech/blob/main/ai-service/app/inference/predictor.py): `ai-service/app/inference/predictor.py`

### Data and training

- [Input preprocessing](https://github.com/winterhell823/agritech/tree/main/ai-service/app/preprocessing): `ai-service/app/preprocessing`
- [Satellite features](https://github.com/winterhell823/agritech/blob/main/ai-service/app/features/optical_features.py): `ai-service/app/features/optical_features.py`
- [Model training](https://github.com/winterhell823/agritech/blob/main/ai-service/app/training/train.py): `ai-service/app/training/train.py`
- [Geospatial object storage](https://github.com/winterhell823/agritech/blob/main/ai-service/app/storage/s3_client.py): `ai-service/app/storage/s3_client.py`

### Other components

- **Agriculture user**

## Connections

- Agriculture user → React app routes: uses
- React app routes → GIS dashboard: routes to (evidence: `frontend/src/App.jsx`)
- React app routes → Field monitoring: routes to (evidence: `frontend/src/App.jsx`)
- React app routes → Field details: routes to (evidence: `frontend/src/App.jsx`)
- React app routes → Reports UI: routes to (evidence: `frontend/src/App.jsx`)
- GIS dashboard → Map layers: visualizes fields
- GIS dashboard → Observation timeline: browses dates
- React app routes → Spring REST API: requests insights
- Spring REST API → Field management: serves field data
- Spring REST API → Satellite scenes: manages scenes
- Spring REST API → Predictions: serves predictions
- Spring REST API → Phenology records: serves stages
- Spring REST API → Stress records: serves stress
- Spring REST API → Report lifecycle: handles reports
- Spring REST API → RAG assistant: supports queries
- Spring REST API → AI service routes: calls REST service
- AI service routes → Multi-task prediction: registers route (evidence: `ai-service/main.py`)
- AI service routes → Model explanations: registers route (evidence: `ai-service/main.py`)
- AI service routes → Phenology analysis: registers route (evidence: `ai-service/main.py`)
- AI service routes → Stress analysis: registers route (evidence: `ai-service/main.py`)
- Multi-task prediction → Multimodal model: runs inference
- Multimodal model → Prithvi encoder: extracts EO features
- Multimodal model → SAR encoder: encodes SAR
- Multimodal model → Weather encoder: encodes weather
- Multimodal model → Feature fusion: fuses modalities
- Input preprocessing → Multimodal model: aligns inputs
- Multimodal model → Inference runtime: produces predictions
- Model training → Multimodal model: trains model
- Satellite scenes → Geospatial object storage: stores raster objects
- Weather data API → Input preprocessing: provides weather input
- Predictions → Map layers: visualizes insights
- Stress records → GIS dashboard: supports irrigation priorities
