# palmacitra/tni-diwas architecture

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

- Interactive diagram: https://gitdiagram.com/palmacitra/tni-diwas
- Repository: https://github.com/palmacitra/tni-diwas

## Overview

TNI-DIWAS is presented as a sovereign ISR fusion platform: sensor feeds enter imaging and fusion processing, producing a tactical picture for operator-facing APIs, AR/mobile outputs, and external integrations. The sampled Rust code confirms the server routes, imaging pipeline stages, track store, fusion ingestion, AR frame construction, and Palantir client operations. Several README capabilities are documented but their implementation was not sampled; links for those capabilities cite the README. The fusion implementation shown is explicitly a stub for most report types.

Main entry points: [`src/fusion/mod.rs`](https://github.com/palmacitra/tni-diwas/blob/main/src/fusion/mod.rs) (Tactical Picture), [`src/imaging/mod.rs`](https://github.com/palmacitra/tni-diwas/blob/main/src/imaging/mod.rs) (Imaging Pipeline), [`src/api`](https://github.com/palmacitra/tni-diwas/tree/main/src/api) (REST And WebSocket API), [`src/palantir/mod.rs`](https://github.com/palmacitra/tni-diwas/blob/main/src/palantir/mod.rs) (Foundry Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Sensor Processing"]
  node_imaging["Imaging Pipeline<br/>[mod.rs]"]
  node_imaging_stages["Imaging Algorithms"]
end

subgraph group_fusion["Fusion Core"]
  node_fusion_engine["Fusion Engine<br/>[mod.rs]"]
  node_tactical_picture[("Tactical Picture<br/>[mod.rs]")]
  node_fusion_stages["Tracking And Threat"]
  node_geostore[("PostGIS Enrichment")]
end

subgraph group_delivery["Operator Delivery"]
  node_server["DIWAS Server<br/>[main.rs]"]
  node_api["REST And WebSocket API"]
  node_ar_builder["AR Frame Builder<br/>[mod.rs]"]
  node_alert_bus["Sentinel Alert Bus"]
end

subgraph group_integration["External Integration"]
  node_palantir_client["Foundry Client<br/>[mod.rs]"]
  node_arcgis["ESRI ArcGIS"]
  node_stanag["STANAG 4559"]
  node_satellite_api["LAPAN/BRIN API"]
end

node_sensor_feeds(("Sensor Feeds"))
node_field_devices(("Field Devices"))
node_foundry["Foundry AIP"]

node_sensor_feeds -->|"supply frames"| node_imaging
node_imaging -->|"runs stages"| node_imaging_stages
node_sensor_feeds -->|"submit reports"| node_fusion_engine
node_fusion_engine -->|"upserts tracks"| node_tactical_picture
node_fusion_engine -.->|"uses algorithms"| node_fusion_stages
node_server -->|"routes requests"| node_api
node_api -.->|"serves track state"| node_tactical_picture
node_tactical_picture -->|"provides tracks"| node_ar_builder
node_ar_builder -->|"delivers overlays"| node_field_devices
node_tactical_picture -.->|"distributes alerts"| node_alert_bus
node_api -->|"serves field clients"| node_field_devices
node_palantir_client -->|"pushes tracks"| node_foundry
node_palantir_client -->|"queries agent"| node_foundry
node_imaging -->|"exports GeoJSON"| node_arcgis
node_tactical_picture -->|"supplies fused tracks"| node_palantir_client
node_sensor_feeds -.->|"exchanges data"| node_stanag
node_sensor_feeds -.->|"receives imagery"| node_satellite_api
node_tactical_picture -.->|"enriches tracks"| node_geostore

click node_imaging "https://github.com/palmacitra/tni-diwas/blob/main/src/imaging/mod.rs"
click node_imaging_stages "https://github.com/palmacitra/tni-diwas/tree/main/src/imaging"
click node_fusion_engine "https://github.com/palmacitra/tni-diwas/blob/main/src/fusion/mod.rs"
click node_tactical_picture "https://github.com/palmacitra/tni-diwas/blob/main/src/fusion/mod.rs"
click node_fusion_stages "https://github.com/palmacitra/tni-diwas/tree/main/src/fusion"
click node_server "https://github.com/palmacitra/tni-diwas/blob/main/src/main.rs"
click node_api "https://github.com/palmacitra/tni-diwas/tree/main/src/api"
click node_ar_builder "https://github.com/palmacitra/tni-diwas/blob/main/src/ar/mod.rs"
click node_palantir_client "https://github.com/palmacitra/tni-diwas/blob/main/src/palantir/mod.rs"

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_imaging,node_imaging_stages toneBlue
class node_fusion_engine,node_tactical_picture,node_fusion_stages,node_geostore toneAmber
class node_server,node_api,node_ar_builder,node_alert_bus toneMint
class node_palantir_client,node_arcgis,node_stanag,node_satellite_api toneRose
class node_sensor_feeds,node_field_devices,node_foundry toneIndigo
```

## Components

### Sensor Processing

- [Imaging Pipeline](https://github.com/palmacitra/tni-diwas/blob/main/src/imaging/mod.rs): `src/imaging/mod.rs`
- [Imaging Algorithms](https://github.com/palmacitra/tni-diwas/tree/main/src/imaging): `src/imaging`

### Fusion Core

- [Fusion Engine](https://github.com/palmacitra/tni-diwas/blob/main/src/fusion/mod.rs): `src/fusion/mod.rs`
- [Tactical Picture](https://github.com/palmacitra/tni-diwas/blob/main/src/fusion/mod.rs): `src/fusion/mod.rs`
- [Tracking And Threat](https://github.com/palmacitra/tni-diwas/tree/main/src/fusion): `src/fusion`
- **PostGIS Enrichment**

### Operator Delivery

- [DIWAS Server](https://github.com/palmacitra/tni-diwas/blob/main/src/main.rs): `src/main.rs`
- [REST And WebSocket API](https://github.com/palmacitra/tni-diwas/tree/main/src/api): `src/api`
- [AR Frame Builder](https://github.com/palmacitra/tni-diwas/blob/main/src/ar/mod.rs): `src/ar/mod.rs`
- **Sentinel Alert Bus**

### External Integration

- [Foundry Client](https://github.com/palmacitra/tni-diwas/blob/main/src/palantir/mod.rs): `src/palantir/mod.rs`
- **ESRI ArcGIS**
- **STANAG 4559**
- **LAPAN/BRIN API**

### Other components

- **Sensor Feeds**
- **Field Devices**
- **Foundry AIP**

## Connections

- Sensor Feeds → Imaging Pipeline: supply frames (evidence: `README.md`)
- Imaging Pipeline → Imaging Algorithms: runs stages (evidence: `src/imaging/mod.rs`)
- Sensor Feeds → Fusion Engine: submit reports (evidence: `README.md`)
- Fusion Engine → Tactical Picture: upserts tracks (evidence: `src/fusion/mod.rs`)
- Fusion Engine → Tracking And Threat: uses algorithms
- DIWAS Server → REST And WebSocket API: routes requests (evidence: `src/main.rs`)
- REST And WebSocket API → Tactical Picture: serves track state
- Tactical Picture → AR Frame Builder: provides tracks (evidence: `src/ar/mod.rs`)
- AR Frame Builder → Field Devices: delivers overlays (evidence: `README.md`)
- Tactical Picture → Sentinel Alert Bus: distributes alerts (evidence: `README.md`)
- REST And WebSocket API → Field Devices: serves field clients (evidence: `README.md`)
- Foundry Client → Foundry AIP: pushes tracks (evidence: `src/palantir/mod.rs`)
- Foundry Client → Foundry AIP: queries agent (evidence: `src/palantir/mod.rs`)
- Imaging Pipeline → ESRI ArcGIS: exports GeoJSON (evidence: `README.md`)
- Tactical Picture → Foundry Client: supplies fused tracks (evidence: `src/palantir/mod.rs`)
- Sensor Feeds → STANAG 4559: exchanges data (evidence: `README.md`)
- Sensor Feeds → LAPAN/BRIN API: receives imagery (evidence: `README.md`)
- Tactical Picture → PostGIS Enrichment: enriches tracks (evidence: `README.md`)
