# jaxdeeznutz/geosustain_proj architecture

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

- Interactive diagram: https://gitdiagram.com/jaxdeeznutz/geosustain_proj
- Repository: https://github.com/jaxdeeznutz/geosustain_proj

## Overview

GeoSustain is a geospatial decision-support application for sustainable landscape management in Panabo City. Farmers and analysts map or select land, submit it for environmental analysis and crop ranking, then review recommendations, explanations, and saved history; analyst and admin screens provide broader reporting and management. The current documented runtime is Flutter plus FastAPI, with PostgreSQL/Supabase and environmental data providers. The graph follows documented and indexed relationships; frontend screen-to-screen behavior and unsampled route details are not inferred.

Main entry points: [`backend/fastapi_app.py`](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/fastapi_app.py) (FastAPI routes), [`backend/environmental_pipeline.py`](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/environmental_pipeline.py) (Environmental retrieval), [`lib/api_service.dart`](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/lib/api_service.dart) (API client), [`backend/model_ranking.py`](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/model_ranking.py) (Model ranking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Flutter client"]
  node_client_app["Flutter app<br/>[main.dart]"]
  node_mobile_screens["Mobile workflows"]
  node_web_screens["Analyst and admin screens"]
  node_api_client["API client<br/>[api_service.dart]"]
end

subgraph group_api["API and identity"]
  node_fastapi["FastAPI routes<br/>[fastapi_app.py]"]
  node_auth["Password authentication<br/>[password_auth.py]"]
  node_legacy_flask["Legacy Flask app<br/>[app.py]"]
end

subgraph group_analysis["Land analysis"]
  node_geometry["Parcel geometry<br/>[geometry.py]"]
  node_environmental["Environmental retrieval"]
  node_provider_data["Environmental data sources"]
  node_suitability["Suitability assessment<br/>[suitability.py]"]
  node_requirements["Crop requirements"]
  node_ranking["Model ranking<br/>[model_ranking.py]"]
  node_explainability["Model explanations"]
end

subgraph group_persistence["Persistence and providers"]
  node_database_helpers["Persistence helpers<br/>[database.py]"]
  node_postgres[("PostgreSQL / Supabase")]
end

node_farmer(("Farmer"))
node_analyst(("Analyst and admin"))
node_weather["Weather providers"]
node_earth_engine["Google Earth Engine"]

node_farmer -->|"uses"| node_client_app
node_analyst -->|"uses"| node_client_app
node_client_app -.->|"uses"| node_api_client
node_mobile_screens -.->|"requests data"| node_api_client
node_web_screens -.->|"requests data"| node_api_client
node_api_client -->|"calls API"| node_fastapi
node_fastapi -->|"uses"| node_auth
node_fastapi -->|"dispatches analysis"| node_environmental
node_fastapi -->|"normalizes parcels"| node_geometry
node_fastapi -->|"reads and writes"| node_database_helpers
node_fastapi -->|"replaces"| node_legacy_flask
node_environmental -->|"retrieves measurements"| node_provider_data
node_environmental -->|"assesses measurements"| node_suitability
node_environmental -->|"ranks crops"| node_ranking
node_environmental -->|"gets model snapshot"| node_explainability
node_suitability -->|"uses criteria"| node_requirements
node_ranking -->|"filters crops"| node_requirements
node_ranking -->|"finalizes explanation"| node_explainability
node_provider_data -->|"requests data"| node_weather
node_environmental -->|"retrieves geospatial data"| node_earth_engine
node_database_helpers -->|"persists records"| node_postgres
node_database_helpers -->|"normalizes parcels"| node_geometry

click node_client_app "https://github.com/jaxdeeznutz/geosustain_proj/blob/main/lib/main.dart"
click node_mobile_screens "https://github.com/jaxdeeznutz/geosustain_proj/tree/main/lib/screens"
click node_web_screens "https://github.com/jaxdeeznutz/geosustain_proj/tree/main/lib/web/screens"
click node_api_client "https://github.com/jaxdeeznutz/geosustain_proj/blob/main/lib/api_service.dart"
click node_fastapi "https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/fastapi_app.py"
click node_auth "https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/password_auth.py"
click node_legacy_flask "https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/app.py"
click node_geometry "https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/geometry.py"
click node_environmental "https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/environmental_pipeline.py"
click node_provider_data "https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/rainfallDatasets.py"
click node_suitability "https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/suitability.py"
click node_requirements "https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/crop_requirements.py"
click node_ranking "https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/model_ranking.py"
click node_explainability "https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/model_explainability.py"
click node_database_helpers "https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/database.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_client_app,node_mobile_screens,node_web_screens,node_api_client toneBlue
class node_fastapi,node_auth,node_legacy_flask toneAmber
class node_geometry,node_environmental,node_provider_data,node_suitability,node_requirements,node_ranking,node_explainability toneMint
class node_database_helpers,node_postgres toneRose
class node_farmer,node_analyst,node_weather,node_earth_engine toneIndigo
```

## Components

### Flutter client

- [Flutter app](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/lib/main.dart): `lib/main.dart`
- [Mobile workflows](https://github.com/jaxdeeznutz/geosustain_proj/tree/main/lib/screens): `lib/screens`
- [Analyst and admin screens](https://github.com/jaxdeeznutz/geosustain_proj/tree/main/lib/web/screens): `lib/web/screens`
- [API client](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/lib/api_service.dart): `lib/api_service.dart`

### API and identity

- [FastAPI routes](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/fastapi_app.py): `backend/fastapi_app.py`
- [Password authentication](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/password_auth.py): `backend/password_auth.py`
- [Legacy Flask app](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/app.py): `backend/app.py`

### Land analysis

- [Parcel geometry](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/geometry.py): `backend/geometry.py`
- [Environmental retrieval](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/environmental_pipeline.py): `backend/environmental_pipeline.py`
- [Environmental data sources](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/rainfallDatasets.py): `backend/rainfallDatasets.py`
- [Suitability assessment](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/suitability.py): `backend/suitability.py`
- [Crop requirements](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/crop_requirements.py): `backend/crop_requirements.py`
- [Model ranking](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/model_ranking.py): `backend/model_ranking.py`
- [Model explanations](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/model_explainability.py): `backend/model_explainability.py`

### Persistence and providers

- [Persistence helpers](https://github.com/jaxdeeznutz/geosustain_proj/blob/main/backend/database.py): `backend/database.py`
- **PostgreSQL / Supabase**

### Other components

- **Farmer**
- **Analyst and admin**
- **Weather providers**
- **Google Earth Engine**

## Connections

- Farmer → Flutter app: uses (evidence: `README.md`)
- Analyst and admin → Flutter app: uses (evidence: `README.md`)
- Flutter app → API client: uses
- Mobile workflows → API client: requests data
- Analyst and admin screens → API client: requests data
- API client → FastAPI routes: calls API (evidence: `README.md`)
- FastAPI routes → Password authentication: uses (evidence: `backend/fastapi_app.py`)
- FastAPI routes → Environmental retrieval: dispatches analysis (evidence: `backend/fastapi_app.py`)
- FastAPI routes → Parcel geometry: normalizes parcels (evidence: `backend/fastapi_app.py`)
- FastAPI routes → Persistence helpers: reads and writes (evidence: `backend/fastapi_app.py`)
- FastAPI routes → Legacy Flask app: replaces (evidence: `README.md`)
- Environmental retrieval → Environmental data sources: retrieves measurements (evidence: `backend/environmental_pipeline.py`)
- Environmental retrieval → Suitability assessment: assesses measurements (evidence: `backend/environmental_pipeline.py`)
- Environmental retrieval → Model ranking: ranks crops (evidence: `backend/environmental_pipeline.py`)
- Environmental retrieval → Model explanations: gets model snapshot (evidence: `backend/environmental_pipeline.py`)
- Suitability assessment → Crop requirements: uses criteria (evidence: `backend/suitability.py`)
- Model ranking → Crop requirements: filters crops (evidence: `backend/model_ranking.py`)
- Model ranking → Model explanations: finalizes explanation (evidence: `backend/model_ranking.py`)
- Environmental data sources → Weather providers: requests data (evidence: `README.md`)
- Environmental retrieval → Google Earth Engine: retrieves geospatial data (evidence: `backend/environmental_pipeline.py`)
- Persistence helpers → PostgreSQL / Supabase: persists records (evidence: `README.md`)
- Persistence helpers → Parcel geometry: normalizes parcels (evidence: `backend/database.py`)
