# rivai20/gis-produksi-kota-ternate architecture

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

- Interactive diagram: https://gitdiagram.com/rivai20/gis-produksi-kota-ternate
- Repository: https://github.com/rivai20/gis-produksi-kota-ternate

## Overview

GIS Produksi Kota Ternate is a Flask application for exploring fisheries and agriculture production by district, with map visualization and role-based data management. The main user flow is opening the dashboard, loading filtered district summaries and markers, then—if logged in—submitting production or dataset changes for the relevant admin to review. Separate importers prepare production data and district boundaries. The map and moderation links are supported by excerpts; unsampled template and schema details are represented only where the README documents them.

Main entry points: [`schema.sql`](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/schema.sql) (MySQL database), [`static/script.js`](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/static/script.js) (Map interface), [`app.py`](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/app.py) (Authentication), [`templates/index.html`](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/templates/index.html) (Map dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_map["Map experience"]
  node_dashboard["Map dashboard<br/>[index.html]"]
  node_map_ui["Map interface<br/>[script.js]"]
  node_leaflet["Leaflet maps"]
  node_basemaps["Map basemaps"]
end

subgraph group_workflow["Data workflows"]
  node_login["Login page<br/>[login.html]"]
  node_auth["Authentication<br/>[app.py]"]
  node_dataset_api["Map dataset API<br/>[app.py]"]
  node_production_requests["Marker submissions<br/>[app.py]"]
  node_production_review["Production verification<br/>[app.py]"]
  node_commodity_panel["Commodity management<br/>[script.js]"]
  node_commodity_requests["Dataset change review<br/>[app.py]"]
end

subgraph group_storage["Production data"]
  node_database[("MySQL database<br/>[schema.sql]")]
end

subgraph group_ingestion["Data preparation"]
  node_crop_import["Crop importer"]
  node_fish_import["Fisheries importer"]
  node_boundary_import["Boundary importer"]
  node_overlap_resolver["Zone overlap resolver"]
end

node_visitor(("Map visitor"))
node_account(("User or admin"))

node_visitor -.->|"opens"| node_dashboard
node_dashboard -.->|"loads"| node_map_ui
node_map_ui -->|"fetches dataset"| node_dataset_api
node_dataset_api -->|"reads summaries"| node_database
node_map_ui -->|"renders map"| node_leaflet
node_map_ui -->|"selects tiles"| node_basemaps
node_account -.->|"signs in"| node_login
node_login -.->|"submits credentials"| node_auth
node_auth -->|"checks account"| node_database
node_account -.->|"submits production"| node_production_requests
node_production_requests -->|"stores pending record"| node_database
node_map_ui -->|"sends decision"| node_production_review
node_production_review -->|"updates record"| node_database
node_account -.->|"manages commodities"| node_commodity_panel
node_commodity_panel -->|"loads records"| node_dataset_api
node_commodity_panel -->|"submits changes"| node_commodity_requests
node_commodity_requests -->|"records and reviews changes"| node_database
node_crop_import -->|"upserts crop data"| node_database
node_fish_import -->|"uses database connector"| node_auth
node_auth -->|"connects to"| node_database
node_boundary_import -->|"writes boundaries"| node_database
node_overlap_resolver -->|"updates zone geometry"| node_database

click node_dashboard "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/templates/index.html"
click node_map_ui "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/static/script.js"
click node_login "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/templates/login.html"
click node_auth "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/app.py"
click node_dataset_api "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/app.py"
click node_production_requests "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/app.py"
click node_production_review "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/app.py"
click node_commodity_panel "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/static/script.js"
click node_commodity_requests "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/app.py"
click node_database "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/schema.sql"
click node_crop_import "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/import_crop_data.py"
click node_fish_import "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/import_fish_data.py"
click node_boundary_import "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/import_public_boundaries.py"
click node_overlap_resolver "https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/resolve_zone_overlaps.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_map_ui,node_leaflet,node_basemaps,node_account toneBlue
class node_login,node_auth,node_dataset_api,node_production_requests,node_production_review,node_commodity_panel,node_commodity_requests toneAmber
class node_database toneMint
class node_crop_import,node_fish_import,node_boundary_import,node_overlap_resolver toneRose
class node_visitor toneIndigo
```

## Components

### Map experience

- [Map dashboard](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/templates/index.html): `templates/index.html`
- [Map interface](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/static/script.js): `static/script.js`
- **Leaflet maps**
- **Map basemaps**

### Data workflows

- [Login page](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/templates/login.html): `templates/login.html`
- [Authentication](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/app.py): `app.py`
- [Map dataset API](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/app.py): `app.py`
- [Marker submissions](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/app.py): `app.py`
- [Production verification](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/app.py): `app.py`
- [Commodity management](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/static/script.js): `static/script.js`
- [Dataset change review](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/app.py): `app.py`

### Production data

- [MySQL database](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/schema.sql): `schema.sql`

### Data preparation

- [Crop importer](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/import_crop_data.py): `import_crop_data.py`
- [Fisheries importer](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/import_fish_data.py): `import_fish_data.py`
- [Boundary importer](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/import_public_boundaries.py): `import_public_boundaries.py`
- [Zone overlap resolver](https://github.com/rivai20/gis-produksi-kota-ternate/blob/main/resolve_zone_overlaps.py): `resolve_zone_overlaps.py`

### Other components

- **Map visitor**
- **User or admin**

## Connections

- Map visitor → Map dashboard: opens (evidence: `README.md`)
- Map dashboard → Map interface: loads (evidence: `README.md`)
- Map interface → Map dataset API: fetches dataset (evidence: `static/script.js`)
- Map dataset API → MySQL database: reads summaries (evidence: `app.py`)
- Map interface → Leaflet maps: renders map (evidence: `static/script.js`)
- Map interface → Map basemaps: selects tiles (evidence: `static/script.js`)
- User or admin → Login page: signs in (evidence: `README.md`)
- Login page → Authentication: submits credentials (evidence: `README.md`)
- Authentication → MySQL database: checks account (evidence: `app.py`)
- User or admin → Marker submissions: submits production (evidence: `README.md`)
- Marker submissions → MySQL database: stores pending record (evidence: `app.py`)
- Map interface → Production verification: sends decision (evidence: `static/script.js`)
- Production verification → MySQL database: updates record (evidence: `app.py`)
- User or admin → Commodity management: manages commodities (evidence: `README.md`)
- Commodity management → Map dataset API: loads records (evidence: `static/script.js`)
- Commodity management → Dataset change review: submits changes (evidence: `static/script.js`)
- Dataset change review → MySQL database: records and reviews changes (evidence: `app.py`)
- Crop importer → MySQL database: upserts crop data (evidence: `import_crop_data.py`)
- Fisheries importer → Authentication: uses database connector (evidence: `import_fish_data.py`)
- Authentication → MySQL database: connects to (evidence: `app.py`)
- Boundary importer → MySQL database: writes boundaries (evidence: `import_public_boundaries.py`)
- Zone overlap resolver → MySQL database: updates zone geometry (evidence: `resolve_zone_overlaps.py`)
