# wcsbrintel/iwt_globalobservatory architecture

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

- Interactive diagram: https://gitdiagram.com/wcsbrintel/iwt_globalobservatory
- Repository: https://github.com/wcsbrintel/iwt_globalobservatory

## Overview

This repository supports a multilingual wildlife-trafficking observatory plus a restricted records workspace. The public-facing workflow presents case and route information through map/globe and reporting capabilities; the restricted workflow loads records after access checks and provides an explorer with localization, scientific-name formatting, and export support. The README documents canonical case and route feeds and ingestion safeguards. Source excerpts are strongest for restricted explorer helpers, Firestore access, and the mail transport; other public capabilities are represented from the tree and README without inferring unsampled call paths.

Main entry points: [`restricted/explorer.js`](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/explorer.js) (Records explorer), [`firebase/functions/index.js`](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/firebase/functions/index.js) (Firebase functions), [`documented-routes.js`](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/documented-routes.js) (Documented routes), [`restricted/secure.js`](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/secure.js) (Access and records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public observatory"]
  node_case_feed["Case data layer<br/>[case-context.js]"]
  node_case_media["Case media<br/>[case-media-data.js]"]
  node_routes["Documented routes"]
  node_map["Route map<br/>[route-map.js]"]
  node_globe["Globe view<br/>[globe-view.js]"]
  node_temporal["Temporal filtering<br/>[temporal-filter.js]"]
  node_search["Live search<br/>[live-search.js]"]
end

subgraph group_restricted["Restricted workspace"]
  node_restricted_app["Restricted app<br/>[app.js]"]
  node_secure["Access and records<br/>[secure.js]"]
  node_explorer["Records explorer<br/>[explorer.js]"]
  node_locale["Record localization<br/>[record-locale.js]"]
  node_scientific["Scientific formatting"]
  node_period["Period export"]
  node_xlsx["Spreadsheet export<br/>[xlsx-export.js]"]
end

subgraph group_services["Access and services"]
  node_firestore[("Firestore")]
  node_functions["Firebase functions<br/>[index.js]"]
  node_mail["Graph mail transport<br/>[graph-mail.js]"]
  node_github["GitHub reports API"]
end

subgraph group_support["Research and reporting"]
  node_weekly["Weekly reports<br/>[weekly-reports.js]"]
  node_research["Research app<br/>[app.js]"]
  node_reportage["Reportage app<br/>[app.js]"]
end

node_visitor(("Public visitor"))
node_restricted_user(("Authorized contributor"))

node_visitor -->|"explores cases"| node_case_feed
node_visitor -->|"views routes"| node_routes
node_routes -->|"feeds map layer"| node_map
node_routes -->|"feeds globe layer"| node_globe
node_visitor -.->|"filters activity"| node_temporal
node_visitor -.->|"searches cases"| node_search
node_visitor -.->|"views reports"| node_weekly
node_visitor -.->|"opens research"| node_research
node_visitor -.->|"opens reportage"| node_reportage
node_restricted_user -.->|"opens workspace"| node_restricted_app
node_restricted_app -.->|"checks access"| node_secure
node_secure -->|"reads and writes"| node_firestore
node_secure -.->|"loads records"| node_explorer
node_explorer -->|"localizes fields"| node_locale
node_explorer -->|"formats names"| node_scientific
node_explorer -->|"uses period logic"| node_period
node_explorer -->|"imports exporter"| node_xlsx
node_functions -->|"imports transport"| node_mail
node_functions -->|"accesses records"| node_firestore
node_functions -->|"fetches reports"| node_github

click node_case_feed "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/case-context.js"
click node_case_media "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/case-media-data.js"
click node_routes "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/documented-routes.js"
click node_map "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/route-map.js"
click node_globe "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/globe-view.js"
click node_temporal "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/temporal-filter.js"
click node_search "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/live-search.js"
click node_weekly "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/weekly-reports.js"
click node_research "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/research/app.js"
click node_reportage "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/reportage/app.js"
click node_restricted_app "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/app.js"
click node_secure "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/secure.js"
click node_explorer "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/explorer.js"
click node_locale "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/record-locale.js"
click node_scientific "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/scientific-format.js"
click node_period "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/restricted-period-export.js"
click node_xlsx "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/xlsx-export.js"
click node_functions "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/firebase/functions/index.js"
click node_mail "https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/firebase/functions/graph-mail.js"

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_case_feed,node_case_media,node_routes,node_map,node_globe,node_temporal,node_search toneBlue
class node_restricted_app,node_secure,node_explorer,node_locale,node_scientific,node_period,node_xlsx toneAmber
class node_firestore,node_functions,node_mail,node_github toneMint
class node_weekly,node_research,node_reportage toneRose
class node_visitor,node_restricted_user toneIndigo
```

## Components

### Public observatory

- [Case data layer](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/case-context.js): `case-context.js`
- [Case media](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/case-media-data.js): `case-media-data.js`
- [Documented routes](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/documented-routes.js): `documented-routes.js`
- [Route map](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/route-map.js): `route-map.js`
- [Globe view](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/globe-view.js): `globe-view.js`
- [Temporal filtering](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/temporal-filter.js): `temporal-filter.js`
- [Live search](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/live-search.js): `live-search.js`

### Restricted workspace

- [Restricted app](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/app.js): `restricted/app.js`
- [Access and records](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/secure.js): `restricted/secure.js`
- [Records explorer](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/explorer.js): `restricted/explorer.js`
- [Record localization](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/record-locale.js): `restricted/record-locale.js`
- [Scientific formatting](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/scientific-format.js): `restricted/scientific-format.js`
- [Period export](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/restricted/restricted-period-export.js): `restricted/restricted-period-export.js`
- [Spreadsheet export](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/xlsx-export.js): `xlsx-export.js`

### Access and services

- **Firestore**
- [Firebase functions](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/firebase/functions/index.js): `firebase/functions/index.js`
- [Graph mail transport](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/firebase/functions/graph-mail.js): `firebase/functions/graph-mail.js`
- **GitHub reports API**

### Research and reporting

- [Weekly reports](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/weekly-reports.js): `weekly-reports.js`
- [Research app](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/research/app.js): `research/app.js`
- [Reportage app](https://github.com/wcsbrintel/iwt_globalobservatory/blob/main/reportage/app.js): `reportage/app.js`

### Other components

- **Public visitor**
- **Authorized contributor**

## Connections

- Public visitor → Case data layer: explores cases (evidence: `README.md`)
- Public visitor → Documented routes: views routes (evidence: `README.md`)
- Documented routes → Route map: feeds map layer (evidence: `README.md`)
- Documented routes → Globe view: feeds globe layer (evidence: `README.md`)
- Public visitor → Temporal filtering: filters activity
- Public visitor → Live search: searches cases
- Public visitor → Weekly reports: views reports
- Public visitor → Research app: opens research
- Public visitor → Reportage app: opens reportage
- Authorized contributor → Restricted app: opens workspace
- Restricted app → Access and records: checks access
- Access and records → Firestore: reads and writes (evidence: `restricted/secure.js`)
- Access and records → Records explorer: loads records
- Records explorer → Record localization: localizes fields (evidence: `restricted/explorer.js`)
- Records explorer → Scientific formatting: formats names (evidence: `restricted/explorer.js`)
- Records explorer → Period export: uses period logic (evidence: `restricted/explorer.js`)
- Records explorer → Spreadsheet export: imports exporter (evidence: `restricted/explorer.js`)
- Firebase functions → Graph mail transport: imports transport (evidence: `firebase/functions/index.js`)
- Firebase functions → Firestore: accesses records (evidence: `firebase/functions/index.js`)
- Firebase functions → GitHub reports API: fetches reports (evidence: `firebase/functions/index.js`)
