# centre-for-open-societal-systems/oan_dashboards architecture

> Architecture diagram of the GitHub repository centre-for-open-societal-systems/oan_dashboards, 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/centre-for-open-societal-systems/oan_dashboards
- Repository: https://github.com/centre-for-open-societal-systems/oan_dashboards

## Overview

ATI Farmer Profile Dashboard is a Next.js application for exploring farmer registries and related crop, livestock, catalog, credit-access, and infrastructure data. Users enter through a dashboard selector, choose a dashboard, apply filters, and inspect tables, charts, or maps; registry views also support export. The backend serves dashboard and chart requests through an API route into Elysia handlers, data services, and PostgreSQL queries. The README documents additional dashboard data domains, but their storage and detailed runtime wiring are not fully shown in the excerpts.

Main entry points: [`components/dashboard-client.tsx`](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/dashboard-client.tsx) (Dashboard selector), [`hooks/use-data.ts`](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/hooks/use-data.ts) (Dashboard data hooks), [`components/farmer-overview-dashboard.tsx`](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/farmer-overview-dashboard.tsx) (Registry views), [`components/crop-sown-dashboard.tsx`](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/crop-sown-dashboard.tsx) (Crop registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Dashboard experience"]
  node_dashboard_page["Dashboard entry<br/>[page.tsx]"]
  node_dashboard_shell["Dashboard selector"]
  node_filter_sidebar["Global filters"]
end

subgraph group_domain_views["Dashboard domains"]
  node_registry_views["Registry views"]
  node_crop_view["Crop registry"]
  node_livestock_view["Livestock registry"]
  node_catalogs_view["Catalogs"]
  node_a2c_view["Access to Credit<br/>[a2c-dashboard.tsx]"]
  node_devops_view["DevOps monitoring"]
end

subgraph group_visualization["Maps and exports"]
  node_chart_views["Indicator charts"]
  node_map_visibility["Visible map loader"]
  node_map_loader["Map loader<br/>[map-loader.tsx]"]
  node_ethiopia_map["Ethiopia map<br/>[ethiopia-map.tsx]"]
  node_registry_export["Registry export<br/>[export-button.tsx]"]
  node_registry_data["Registry shaping<br/>[registry-data.ts]"]
end

subgraph group_backend["API and data"]
  node_data_hook["Dashboard data hooks<br/>[use-data.ts]"]
  node_api_route["API route adapter<br/>[route.ts]"]
  node_api_handlers["Elysia API handlers<br/>[elysia-app.ts]"]
  node_data_service["Dashboard data service<br/>[data-service.ts]"]
  node_chart_service["Chart data service"]
  node_chart_queries["Chart queries<br/>[chart-queries.ts]"]
  node_map_api["Map level endpoint<br/>[route.ts]"]
end

subgraph group_storage["Data storage"]
  node_database_access["Database access<br/>[database.ts]"]
  node_postgres[("PostgreSQL")]
end

node_user(("Dashboard user"))

node_user -.->|"opens"| node_dashboard_page
node_dashboard_page -->|"renders"| node_dashboard_shell
node_dashboard_shell -->|"selects"| node_registry_views
node_dashboard_shell -->|"selects"| node_crop_view
node_dashboard_shell -->|"selects"| node_livestock_view
node_dashboard_shell -->|"selects"| node_catalogs_view
node_dashboard_shell -->|"selects"| node_a2c_view
node_dashboard_shell -->|"selects"| node_devops_view
node_dashboard_shell -->|"renders"| node_filter_sidebar
node_registry_views -->|"loads data"| node_data_hook
node_crop_view -->|"loads data"| node_data_hook
node_livestock_view -.->|"loads data"| node_data_hook
node_catalogs_view -->|"loads data"| node_data_hook
node_a2c_view -->|"loads data"| node_data_hook
node_devops_view -->|"loads data"| node_data_hook
node_data_hook -->|"fetches API"| node_api_route
node_api_route -->|"forwards requests"| node_api_handlers
node_api_handlers -->|"calls"| node_data_service
node_api_handlers -->|"validates charts"| node_chart_service
node_api_handlers -->|"executes queries"| node_chart_queries
node_api_handlers -->|"queries locations"| node_database_access
node_data_service -->|"fetches records"| node_database_access
node_database_access -.->|"reads and writes"| node_postgres
node_chart_service -->|"runs queries"| node_chart_queries
node_registry_views -->|"renders map"| node_map_visibility
node_crop_view -->|"renders map"| node_map_visibility
node_a2c_view -->|"renders map"| node_map_visibility
node_map_visibility -->|"loads when visible"| node_map_loader
node_map_loader -->|"loads map"| node_ethiopia_map
node_registry_views -->|"offers export"| node_registry_export
node_crop_view -->|"offers export"| node_registry_export
node_livestock_view -->|"offers export"| node_registry_export
node_registry_views -->|"shapes trends"| node_registry_data
node_crop_view -->|"shapes trends"| node_registry_data

click node_dashboard_page "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/app/page.tsx"
click node_dashboard_shell "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/dashboard-client.tsx"
click node_registry_views "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/farmer-overview-dashboard.tsx"
click node_crop_view "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/crop-sown-dashboard.tsx"
click node_livestock_view "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/livestock-dashboard.tsx"
click node_catalogs_view "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/catalogs-dashboard.tsx"
click node_a2c_view "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/a2c-dashboard.tsx"
click node_devops_view "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/devops-dashboard.tsx"
click node_filter_sidebar "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/global-filters-sidebar.tsx"
click node_chart_views "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/indicator-charts.tsx"
click node_map_visibility "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/lazy/map-when-visible.tsx"
click node_map_loader "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/lazy/map-loader.tsx"
click node_ethiopia_map "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/ethiopia-map.tsx"
click node_registry_export "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/registry/export-button.tsx"
click node_registry_data "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/registry/registry-data.ts"
click node_data_hook "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/hooks/use-data.ts"
click node_api_route "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/app/api/%5B%5B...slugs%5D%5D/route.ts"
click node_api_handlers "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/server/elysia-app.ts"
click node_data_service "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/lib/data-service.ts"
click node_chart_service "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/lib/chart-data-service.ts"
click node_chart_queries "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/lib/chart-queries.ts"
click node_database_access "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/lib/database.ts"
click node_map_api "https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/app/api/maps/%5Blevel%5D/route.ts"

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_page,node_dashboard_shell,node_filter_sidebar,node_user toneBlue
class node_registry_views,node_crop_view,node_livestock_view,node_catalogs_view,node_a2c_view,node_devops_view toneAmber
class node_chart_views,node_map_visibility,node_map_loader,node_ethiopia_map,node_registry_export,node_registry_data toneMint
class node_data_hook,node_api_route,node_api_handlers,node_data_service,node_chart_service,node_chart_queries,node_map_api toneRose
class node_database_access,node_postgres toneIndigo
```

## Components

### Dashboard experience

- [Dashboard entry](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/app/page.tsx): `app/page.tsx`
- [Dashboard selector](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/dashboard-client.tsx): `components/dashboard-client.tsx`
- [Global filters](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/global-filters-sidebar.tsx): `components/global-filters-sidebar.tsx`

### Dashboard domains

- [Registry views](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/farmer-overview-dashboard.tsx): `components/farmer-overview-dashboard.tsx`
- [Crop registry](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/crop-sown-dashboard.tsx): `components/crop-sown-dashboard.tsx`
- [Livestock registry](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/livestock-dashboard.tsx): `components/livestock-dashboard.tsx`
- [Catalogs](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/catalogs-dashboard.tsx): `components/catalogs-dashboard.tsx`
- [Access to Credit](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/a2c-dashboard.tsx): `components/a2c-dashboard.tsx`
- [DevOps monitoring](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/devops-dashboard.tsx): `components/devops-dashboard.tsx`

### Maps and exports

- [Indicator charts](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/indicator-charts.tsx): `components/indicator-charts.tsx`
- [Visible map loader](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/lazy/map-when-visible.tsx): `components/lazy/map-when-visible.tsx`
- [Map loader](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/lazy/map-loader.tsx): `components/lazy/map-loader.tsx`
- [Ethiopia map](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/ethiopia-map.tsx): `components/ethiopia-map.tsx`
- [Registry export](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/registry/export-button.tsx): `components/registry/export-button.tsx`
- [Registry shaping](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/components/registry/registry-data.ts): `components/registry/registry-data.ts`

### API and data

- [Dashboard data hooks](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/hooks/use-data.ts): `hooks/use-data.ts`
- [API route adapter](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/app/api/%5B%5B...slugs%5D%5D/route.ts): `app/api/[[...slugs]]/route.ts`
- [Elysia API handlers](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/server/elysia-app.ts): `server/elysia-app.ts`
- [Dashboard data service](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/lib/data-service.ts): `lib/data-service.ts`
- [Chart data service](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/lib/chart-data-service.ts): `lib/chart-data-service.ts`
- [Chart queries](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/lib/chart-queries.ts): `lib/chart-queries.ts`
- [Map level endpoint](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/app/api/maps/%5Blevel%5D/route.ts): `app/api/maps/[level]/route.ts`

### Data storage

- [Database access](https://github.com/centre-for-open-societal-systems/oan_dashboards/blob/main/lib/database.ts): `lib/database.ts`
- **PostgreSQL**

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Dashboard entry: opens (evidence: `README.md`)
- Dashboard entry → Dashboard selector: renders (evidence: `app/page.tsx`)
- Dashboard selector → Registry views: selects (evidence: `components/dashboard-client.tsx`)
- Dashboard selector → Crop registry: selects (evidence: `components/dashboard-client.tsx`)
- Dashboard selector → Livestock registry: selects (evidence: `components/dashboard-client.tsx`)
- Dashboard selector → Catalogs: selects (evidence: `components/dashboard-client.tsx`)
- Dashboard selector → Access to Credit: selects (evidence: `components/dashboard-client.tsx`)
- Dashboard selector → DevOps monitoring: selects (evidence: `components/dashboard-client.tsx`)
- Dashboard selector → Global filters: renders (evidence: `components/dashboard-client.tsx`)
- Registry views → Dashboard data hooks: loads data (evidence: `components/farmer-overview-dashboard.tsx`)
- Crop registry → Dashboard data hooks: loads data (evidence: `components/crop-sown-dashboard.tsx`)
- Livestock registry → Dashboard data hooks: loads data
- Catalogs → Dashboard data hooks: loads data (evidence: `components/catalogs-dashboard.tsx`)
- Access to Credit → Dashboard data hooks: loads data (evidence: `components/a2c-dashboard.tsx`)
- DevOps monitoring → Dashboard data hooks: loads data (evidence: `components/devops-dashboard.tsx`)
- Dashboard data hooks → API route adapter: fetches API (evidence: `hooks/use-data.ts`)
- API route adapter → Elysia API handlers: forwards requests (evidence: `app/api/[[...slugs]]/route.ts`)
- Elysia API handlers → Dashboard data service: calls (evidence: `server/elysia-app.ts`)
- Elysia API handlers → Chart data service: validates charts (evidence: `server/elysia-app.ts`)
- Elysia API handlers → Chart queries: executes queries (evidence: `server/elysia-app.ts`)
- Elysia API handlers → Database access: queries locations (evidence: `server/elysia-app.ts`)
- Dashboard data service → Database access: fetches records (evidence: `lib/data-service.ts`)
- Database access → PostgreSQL: reads and writes (evidence: `README.md`)
- Chart data service → Chart queries: runs queries (evidence: `lib/chart-data-service.ts`)
- Registry views → Visible map loader: renders map (evidence: `components/farmer-overview-dashboard.tsx`)
- Crop registry → Visible map loader: renders map (evidence: `components/crop-sown-dashboard.tsx`)
- Access to Credit → Visible map loader: renders map (evidence: `components/a2c-dashboard.tsx`)
- Visible map loader → Map loader: loads when visible (evidence: `components/lazy/map-when-visible.tsx`)
- Map loader → Ethiopia map: loads map (evidence: `components/lazy/map-loader.tsx`)
- Registry views → Registry export: offers export (evidence: `components/farmer-overview-dashboard.tsx`)
- Crop registry → Registry export: offers export (evidence: `components/crop-sown-dashboard.tsx`)
- Livestock registry → Registry export: offers export
- Registry views → Registry shaping: shapes trends (evidence: `components/farmer-overview-dashboard.tsx`)
- Crop registry → Registry shaping: shapes trends (evidence: `components/crop-sown-dashboard.tsx`)
