# mostafaai10/field-shift-adapting-farms-with-nasa-data-2026 architecture

> Architecture diagram of the GitHub repository mostafaai10/field-shift-adapting-farms-with-nasa-data-2026, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026
- Repository: https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026

## Overview

Field Shift is a bilingual farm decision-support website for comparing crop rotations in the Sidi Salem–Qallin pilot area. A farmer or advisor selects a cell (or matches a location), adjusts scoring weights, and receives ranked options, crop and environmental context, and modeled irrigation comparisons. The backend validates pinned datasets at startup, serves cell and dashboard APIs, and computes custom-weight evaluations. The README also documents farm saving and planning, science/source transparency, themes, localization, and JSON export. Frontend-to-API wiring is not shown in excerpts, so those links are marked unverified.

Main entry points: [`website-v2/backend/app/api/routers/dashboard.py`](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/api/routers/dashboard.py) (Dashboard API), [`website-v2/backend/app/main.py`](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/main.py) (FastAPI app), [`website-v2/js/dashboard.js`](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/js/dashboard.js) (Dashboard UI), [`website-v2/backend/app/api/routers/cells.py`](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/api/routers/cells.py) (Cell API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Website experience"]
  node_dashboard["Dashboard UI<br/>[dashboard.js]"]
  node_farm_tools["Farm tools<br/>[app.js]"]
  node_map["Field map<br/>[field-map.js]"]
  node_browser_state[("Saved farms and tasks<br/>[app.js]")]
end

subgraph group_api["API and cell data"]
  node_app["FastAPI app<br/>[main.py]"]
  node_health["Readiness API<br/>[health.py]"]
  node_cells_api["Cell API<br/>[cells.py]"]
  node_dashboard_api["Dashboard API<br/>[dashboard.py]"]
  node_rotation_api["Rotation API<br/>[rotations.py]"]
  node_dataset_gate["Dataset dependency<br/>[dependencies.py]"]
  node_cell_service["Cell profiles and recommendations<br/>[cell_service.py]"]
end

subgraph group_analysis["Rotation analysis"]
  node_scoring["Weighted rotation scoring<br/>[scoring_service.py]"]
  node_request_schema["Weight request validation<br/>[rotations.py]"]
end

subgraph group_data["Validated datasets"]
  node_manifest["Dataset manifest<br/>[manifest.json]"]
  node_csv_data[("Processed cell and score tables")]
  node_repository["CSV validation and loading<br/>[csv_repository.py]"]
end

node_farmer(("Farmer / advisor"))
node_browser(("Browser"))
node_earth_data(("NASA and other source data"))

node_farmer -.->|"uses"| node_dashboard
node_dashboard -.->|"shows map"| node_map
node_farmer -.->|"manages farms"| node_farm_tools
node_farm_tools -.->|"saves locally"| node_browser_state
node_dashboard -.->|"renders in"| node_browser
node_app -->|"registers router"| node_health
node_app -->|"registers router"| node_cells_api
node_app -->|"registers router"| node_rotation_api
node_app -->|"registers router"| node_dashboard_api
node_app -->|"loads datasets"| node_repository
node_cells_api -->|"requires datasets"| node_dataset_gate
node_dashboard_api -->|"requires datasets"| node_dataset_gate
node_rotation_api -->|"requires datasets"| node_dataset_gate
node_health -->|"checks readiness"| node_dataset_gate
node_cells_api -->|"calls profiles"| node_cell_service
node_cells_api -->|"calls scores"| node_scoring
node_rotation_api -->|"evaluates weights"| node_scoring
node_dashboard_api -->|"evaluates rotations"| node_scoring
node_rotation_api -->|"accepts request"| node_request_schema
node_dashboard_api -->|"extends request"| node_request_schema
node_repository -->|"checks hashes"| node_manifest
node_repository -->|"loads and validates"| node_csv_data
node_earth_data -.->|"informs processed data"| node_csv_data
node_dashboard -.->|"requests results"| node_dashboard_api
node_farm_tools -.->|"requests evaluations"| node_dashboard_api

click node_dashboard "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/js/dashboard.js"
click node_farm_tools "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/js/app.js"
click node_map "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/js/field-map.js"
click node_browser_state "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/js/app.js"
click node_app "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/main.py"
click node_health "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/api/routers/health.py"
click node_cells_api "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/api/routers/cells.py"
click node_dashboard_api "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/api/routers/dashboard.py"
click node_rotation_api "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/api/routers/rotations.py"
click node_dataset_gate "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/api/dependencies.py"
click node_cell_service "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/services/cell_service.py"
click node_scoring "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/services/scoring_service.py"
click node_request_schema "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/schemas/rotations.py"
click node_manifest "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/data/manifest.json"
click node_csv_data "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/tree/main/website-v2/backend/data/processed"
click node_repository "https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/repositories/csv_repository.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_dashboard,node_farm_tools,node_map,node_browser_state,node_browser toneBlue
class node_app,node_health,node_cells_api,node_dashboard_api,node_rotation_api,node_dataset_gate,node_cell_service toneAmber
class node_scoring,node_request_schema toneMint
class node_manifest,node_csv_data,node_repository toneRose
class node_farmer,node_earth_data toneIndigo
```

## Components

### Website experience

- [Dashboard UI](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/js/dashboard.js): `website-v2/js/dashboard.js`
- [Farm tools](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/js/app.js): `website-v2/js/app.js`
- [Field map](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/js/field-map.js): `website-v2/js/field-map.js`
- [Saved farms and tasks](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/js/app.js): `website-v2/js/app.js`

### API and cell data

- [FastAPI app](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/main.py): `website-v2/backend/app/main.py`
- [Readiness API](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/api/routers/health.py): `website-v2/backend/app/api/routers/health.py`
- [Cell API](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/api/routers/cells.py): `website-v2/backend/app/api/routers/cells.py`
- [Dashboard API](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/api/routers/dashboard.py): `website-v2/backend/app/api/routers/dashboard.py`
- [Rotation API](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/api/routers/rotations.py): `website-v2/backend/app/api/routers/rotations.py`
- [Dataset dependency](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/api/dependencies.py): `website-v2/backend/app/api/dependencies.py`
- [Cell profiles and recommendations](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/services/cell_service.py): `website-v2/backend/app/services/cell_service.py`

### Rotation analysis

- [Weighted rotation scoring](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/services/scoring_service.py): `website-v2/backend/app/services/scoring_service.py`
- [Weight request validation](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/schemas/rotations.py): `website-v2/backend/app/schemas/rotations.py`

### Validated datasets

- [Dataset manifest](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/data/manifest.json): `website-v2/backend/data/manifest.json`
- [Processed cell and score tables](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/tree/main/website-v2/backend/data/processed): `website-v2/backend/data/processed`
- [CSV validation and loading](https://github.com/mostafaai10/field-shift-adapting-farms-with-nasa-data-2026/blob/main/website-v2/backend/app/repositories/csv_repository.py): `website-v2/backend/app/repositories/csv_repository.py`

### Other components

- **Farmer / advisor**
- **Browser**
- **NASA and other source data**

## Connections

- Farmer / advisor → Dashboard UI: uses
- Dashboard UI → Field map: shows map
- Farmer / advisor → Farm tools: manages farms
- Farm tools → Saved farms and tasks: saves locally (evidence: `README.md`)
- Dashboard UI → Browser: renders in
- FastAPI app → Readiness API: registers router (evidence: `website-v2/backend/app/main.py`)
- FastAPI app → Cell API: registers router (evidence: `website-v2/backend/app/main.py`)
- FastAPI app → Rotation API: registers router (evidence: `website-v2/backend/app/main.py`)
- FastAPI app → Dashboard API: registers router (evidence: `website-v2/backend/app/main.py`)
- FastAPI app → CSV validation and loading: loads datasets (evidence: `website-v2/backend/app/main.py`)
- Cell API → Dataset dependency: requires datasets (evidence: `website-v2/backend/app/api/routers/cells.py`)
- Dashboard API → Dataset dependency: requires datasets (evidence: `website-v2/backend/app/api/routers/dashboard.py`)
- Rotation API → Dataset dependency: requires datasets (evidence: `website-v2/backend/app/api/routers/rotations.py`)
- Readiness API → Dataset dependency: checks readiness (evidence: `website-v2/backend/app/api/routers/health.py`)
- Cell API → Cell profiles and recommendations: calls profiles (evidence: `website-v2/backend/app/api/routers/cells.py`)
- Cell API → Weighted rotation scoring: calls scores (evidence: `website-v2/backend/app/api/routers/cells.py`)
- Rotation API → Weighted rotation scoring: evaluates weights (evidence: `website-v2/backend/app/api/routers/rotations.py`)
- Dashboard API → Weighted rotation scoring: evaluates rotations (evidence: `website-v2/backend/app/api/routers/dashboard.py`)
- Rotation API → Weight request validation: accepts request (evidence: `website-v2/backend/app/api/routers/rotations.py`)
- Dashboard API → Weight request validation: extends request (evidence: `website-v2/backend/app/api/routers/dashboard.py`)
- CSV validation and loading → Dataset manifest: checks hashes (evidence: `website-v2/backend/app/repositories/csv_repository.py`)
- CSV validation and loading → Processed cell and score tables: loads and validates (evidence: `website-v2/backend/app/repositories/csv_repository.py`)
- NASA and other source data → Processed cell and score tables: informs processed data (evidence: `README.md`)
- Dashboard UI → Dashboard API: requests results
- Farm tools → Dashboard API: requests evaluations
