# jorgedsprojects/inari architecture

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

- Interactive diagram: https://gitdiagram.com/jorgedsprojects/inari
- Repository: https://github.com/jorgedsprojects/inari

## Overview

INARI connects plant equipment to an ISA-95 namespace, archives raw MQTT traffic, normalizes it into versioned silver data, and exposes that data through dashboards and a tool-limited natural-language assistant. The graph preserves the documented bronze-to-silver flow and the separate dashboard and copilot branches. Source excerpts show selected service wiring; README statements support the cross-service links and unsampled capabilities, so those links are cited as documented rather than as inspected implementation.

Main entry points: [`UNS_HISTORIAN/ingestor/app/main.py`](https://github.com/jorgedsprojects/inari/blob/master/UNS_HISTORIAN/ingestor/app/main.py) (Raw MQTT ingestor), [`UNS_SILVER/normalizer/app/batch.py`](https://github.com/jorgedsprojects/inari/blob/master/UNS_SILVER/normalizer/app/batch.py) (Batch transformation), [`UNS_DASHBOARD/backend/app/main.py`](https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/backend/app/main.py) (Dashboard API), [`UNS_HISTORIAN/ingestor/app/db.py`](https://github.com/jorgedsprojects/inari/blob/master/UNS_HISTORIAN/ingestor/app/db.py) (Bronze history)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_manager["Namespace management"]
  node_manager_ui["Namespace panel<br/>[App.tsx]"]
  node_manager_api["Hierarchy and broker API<br/>[main.py]"]
  node_manager_model["ISA-95 namespace model<br/>[uns.py]"]
  node_mqtt_service["MQTT publishing<br/>[mqtt_service.py]"]
end

subgraph group_data["Industrial data pipeline"]
  node_historian_ingestor["Raw MQTT ingestor<br/>[main.py]"]
  node_ingest_handler["Message handling<br/>[handler.py]"]
  node_dedup_buffer["Deduplication and buffer<br/>[dedup.py]"]
  node_historian_store[("Bronze history<br/>[db.py]")]
  node_silver_normalizer["Silver normalizer<br/>[main.py]"]
  node_silver_batch["Batch transformation<br/>[batch.py]"]
  node_silver_catalog["Versioned signal catalog<br/>[catalog.py]"]
  node_silver_store[("Typed readings and events<br/>[db.py]")]
end

subgraph group_copilot["Natural-language assistant"]
  node_copilot_api["Copilot chat API<br/>[chat.py]"]
  node_agent["Tool-calling agent<br/>[loop.py]"]
  node_tools["Read-only data tools<br/>[executor.py]"]
  node_conversation_store[("Conversation history<br/>[chat.py]")]
end

subgraph group_dashboard["Dashboards"]
  node_dashboard_ui["Dashboard editor and viewer<br/>[App.tsx]"]
  node_dashboard_api_client["Dashboard API client<br/>[client.ts]"]
  node_dashboard_api["Dashboard API<br/>[main.py]"]
  node_dashboard_model["Dashboard and chart data<br/>[dashboard.py]"]
  node_dashboard_store[("Dashboard database<br/>[database.py]")]
  node_historical_query["Historical historian queries<br/>[historian_query.py]"]
  node_live_bridge["MQTT-to-Redis bridge<br/>[main.py]"]
  node_live_stream["Live dashboard stream<br/>[stream.py]"]
end

node_machines(("Sensors and PLCs"))
node_broker["MQTT broker"]
node_operator(("Plant user"))
node_llm["OpenAI-compatible LLM"]
node_redis[("Live-data cache")]

node_machines -->|"publish readings"| node_broker
node_manager_ui -.->|"manage namespace"| node_manager_api
node_manager_api -.->|"models hierarchy"| node_manager_model
node_manager_api -->|"configures MQTT"| node_mqtt_service
node_mqtt_service -->|"publishes metadata"| node_broker
node_broker -->|"delivers raw messages"| node_historian_ingestor
node_historian_ingestor -->|"handles messages"| node_ingest_handler
node_historian_ingestor -->|"deduplicates and buffers"| node_dedup_buffer
node_historian_ingestor -->|"writes batches"| node_historian_store
node_historian_store -->|"bronze input"| node_silver_normalizer
node_silver_normalizer -->|"processes batches"| node_silver_batch
node_silver_normalizer -->|"applies retention"| node_silver_store
node_silver_batch -->|"reads bronze rows"| node_historian_store
node_silver_batch -->|"normalizes catalog"| node_silver_catalog
node_silver_batch -->|"writes typed data"| node_silver_store
node_operator -->|"asks plant questions"| node_copilot_api
node_copilot_api -.->|"runs chat workflow"| node_agent
node_agent -.->|"requests completion"| node_llm
node_agent -.->|"dispatches tools"| node_tools
node_tools -->|"queries silver data"| node_silver_store
node_copilot_api -.->|"stores conversations"| node_conversation_store
node_operator -->|"creates and views dashboards"| node_dashboard_ui
node_dashboard_ui -->|"requests dashboard data"| node_dashboard_api_client
node_dashboard_api_client -->|"calls REST endpoints"| node_dashboard_api
node_dashboard_api -.->|"serves dashboard CRUD"| node_dashboard_model
node_dashboard_api -.->|"persists dashboards"| node_dashboard_store
node_dashboard_api -.->|"serves history queries"| node_historical_query
node_historical_query -->|"reads historian data"| node_historian_store
node_broker -->|"streams MQTT data"| node_live_bridge
node_live_bridge -->|"writes live data"| node_redis
node_live_stream -.->|"serves live data"| node_redis

click node_manager_ui "https://github.com/jorgedsprojects/inari/blob/master/UNS_MANAGER/frontend/src/App.tsx"
click node_manager_api "https://github.com/jorgedsprojects/inari/blob/master/UNS_MANAGER/backend/app/main.py"
click node_manager_model "https://github.com/jorgedsprojects/inari/blob/master/UNS_MANAGER/backend/app/models/uns.py"
click node_mqtt_service "https://github.com/jorgedsprojects/inari/blob/master/UNS_MANAGER/backend/app/services/mqtt_service.py"
click node_historian_ingestor "https://github.com/jorgedsprojects/inari/blob/master/UNS_HISTORIAN/ingestor/app/main.py"
click node_ingest_handler "https://github.com/jorgedsprojects/inari/blob/master/UNS_HISTORIAN/ingestor/app/handler.py"
click node_dedup_buffer "https://github.com/jorgedsprojects/inari/blob/master/UNS_HISTORIAN/ingestor/app/dedup.py"
click node_historian_store "https://github.com/jorgedsprojects/inari/blob/master/UNS_HISTORIAN/ingestor/app/db.py"
click node_silver_normalizer "https://github.com/jorgedsprojects/inari/blob/master/UNS_SILVER/normalizer/app/main.py"
click node_silver_batch "https://github.com/jorgedsprojects/inari/blob/master/UNS_SILVER/normalizer/app/batch.py"
click node_silver_catalog "https://github.com/jorgedsprojects/inari/blob/master/UNS_SILVER/normalizer/app/catalog.py"
click node_silver_store "https://github.com/jorgedsprojects/inari/blob/master/UNS_SILVER/normalizer/app/db.py"
click node_copilot_api "https://github.com/jorgedsprojects/inari/blob/master/UNS_COPILOT/backend/app/routers/chat.py"
click node_agent "https://github.com/jorgedsprojects/inari/blob/master/UNS_COPILOT/backend/app/agent/loop.py"
click node_tools "https://github.com/jorgedsprojects/inari/blob/master/UNS_COPILOT/backend/app/tools/executor.py"
click node_conversation_store "https://github.com/jorgedsprojects/inari/blob/master/UNS_COPILOT/backend/app/models/chat.py"
click node_dashboard_ui "https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/frontend/src/App.tsx"
click node_dashboard_api_client "https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/frontend/src/api/client.ts"
click node_dashboard_api "https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/backend/app/main.py"
click node_dashboard_model "https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/backend/app/models/dashboard.py"
click node_dashboard_store "https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/backend/app/database.py"
click node_historical_query "https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/backend/app/services/historian_query.py"
click node_live_bridge "https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/bridge/app/main.py"
click node_live_stream "https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/backend/app/routers/stream.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_manager_ui,node_manager_api,node_manager_model,node_mqtt_service,node_operator toneBlue
class node_historian_ingestor,node_ingest_handler,node_dedup_buffer,node_historian_store,node_silver_normalizer,node_silver_batch,node_silver_catalog,node_silver_store,node_redis toneAmber
class node_copilot_api,node_agent,node_tools,node_conversation_store toneMint
class node_dashboard_ui,node_dashboard_api_client,node_dashboard_api,node_dashboard_model,node_dashboard_store,node_historical_query,node_live_bridge,node_live_stream toneRose
class node_machines,node_broker,node_llm toneIndigo
```

## Components

### Namespace management

- [Namespace panel](https://github.com/jorgedsprojects/inari/blob/master/UNS_MANAGER/frontend/src/App.tsx): `UNS_MANAGER/frontend/src/App.tsx`
- [Hierarchy and broker API](https://github.com/jorgedsprojects/inari/blob/master/UNS_MANAGER/backend/app/main.py): `UNS_MANAGER/backend/app/main.py`
- [ISA-95 namespace model](https://github.com/jorgedsprojects/inari/blob/master/UNS_MANAGER/backend/app/models/uns.py): `UNS_MANAGER/backend/app/models/uns.py`
- [MQTT publishing](https://github.com/jorgedsprojects/inari/blob/master/UNS_MANAGER/backend/app/services/mqtt_service.py): `UNS_MANAGER/backend/app/services/mqtt_service.py`

### Industrial data pipeline

- [Raw MQTT ingestor](https://github.com/jorgedsprojects/inari/blob/master/UNS_HISTORIAN/ingestor/app/main.py): `UNS_HISTORIAN/ingestor/app/main.py`
- [Message handling](https://github.com/jorgedsprojects/inari/blob/master/UNS_HISTORIAN/ingestor/app/handler.py): `UNS_HISTORIAN/ingestor/app/handler.py`
- [Deduplication and buffer](https://github.com/jorgedsprojects/inari/blob/master/UNS_HISTORIAN/ingestor/app/dedup.py): `UNS_HISTORIAN/ingestor/app/dedup.py`
- [Bronze history](https://github.com/jorgedsprojects/inari/blob/master/UNS_HISTORIAN/ingestor/app/db.py): `UNS_HISTORIAN/ingestor/app/db.py`
- [Silver normalizer](https://github.com/jorgedsprojects/inari/blob/master/UNS_SILVER/normalizer/app/main.py): `UNS_SILVER/normalizer/app/main.py`
- [Batch transformation](https://github.com/jorgedsprojects/inari/blob/master/UNS_SILVER/normalizer/app/batch.py): `UNS_SILVER/normalizer/app/batch.py`
- [Versioned signal catalog](https://github.com/jorgedsprojects/inari/blob/master/UNS_SILVER/normalizer/app/catalog.py): `UNS_SILVER/normalizer/app/catalog.py`
- [Typed readings and events](https://github.com/jorgedsprojects/inari/blob/master/UNS_SILVER/normalizer/app/db.py): `UNS_SILVER/normalizer/app/db.py`

### Natural-language assistant

- [Copilot chat API](https://github.com/jorgedsprojects/inari/blob/master/UNS_COPILOT/backend/app/routers/chat.py): `UNS_COPILOT/backend/app/routers/chat.py`
- [Tool-calling agent](https://github.com/jorgedsprojects/inari/blob/master/UNS_COPILOT/backend/app/agent/loop.py): `UNS_COPILOT/backend/app/agent/loop.py`
- [Read-only data tools](https://github.com/jorgedsprojects/inari/blob/master/UNS_COPILOT/backend/app/tools/executor.py): `UNS_COPILOT/backend/app/tools/executor.py`
- [Conversation history](https://github.com/jorgedsprojects/inari/blob/master/UNS_COPILOT/backend/app/models/chat.py): `UNS_COPILOT/backend/app/models/chat.py`

### Dashboards

- [Dashboard editor and viewer](https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/frontend/src/App.tsx): `UNS_DASHBOARD/frontend/src/App.tsx`
- [Dashboard API client](https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/frontend/src/api/client.ts): `UNS_DASHBOARD/frontend/src/api/client.ts`
- [Dashboard API](https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/backend/app/main.py): `UNS_DASHBOARD/backend/app/main.py`
- [Dashboard and chart data](https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/backend/app/models/dashboard.py): `UNS_DASHBOARD/backend/app/models/dashboard.py`
- [Dashboard database](https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/backend/app/database.py): `UNS_DASHBOARD/backend/app/database.py`
- [Historical historian queries](https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/backend/app/services/historian_query.py): `UNS_DASHBOARD/backend/app/services/historian_query.py`
- [MQTT-to-Redis bridge](https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/bridge/app/main.py): `UNS_DASHBOARD/bridge/app/main.py`
- [Live dashboard stream](https://github.com/jorgedsprojects/inari/blob/master/UNS_DASHBOARD/backend/app/routers/stream.py): `UNS_DASHBOARD/backend/app/routers/stream.py`

### Other components

- **Sensors and PLCs**
- **MQTT broker**
- **Plant user**
- **OpenAI-compatible LLM**
- **Live-data cache**

## Connections

- Sensors and PLCs → MQTT broker: publish readings (evidence: `README.md`)
- Namespace panel → Hierarchy and broker API: manage namespace (evidence: `README.md`)
- Hierarchy and broker API → ISA-95 namespace model: models hierarchy
- Hierarchy and broker API → MQTT publishing: configures MQTT (evidence: `UNS_MANAGER/backend/app/main.py`)
- MQTT publishing → MQTT broker: publishes metadata (evidence: `UNS_MANAGER/backend/app/services/mqtt_service.py`)
- MQTT broker → Raw MQTT ingestor: delivers raw messages (evidence: `README.md`)
- Raw MQTT ingestor → Message handling: handles messages (evidence: `UNS_HISTORIAN/ingestor/app/main.py`)
- Raw MQTT ingestor → Deduplication and buffer: deduplicates and buffers (evidence: `UNS_HISTORIAN/ingestor/app/main.py`)
- Raw MQTT ingestor → Bronze history: writes batches (evidence: `UNS_HISTORIAN/ingestor/app/main.py`)
- Bronze history → Silver normalizer: bronze input (evidence: `README.md`)
- Silver normalizer → Batch transformation: processes batches (evidence: `UNS_SILVER/normalizer/app/main.py`)
- Silver normalizer → Typed readings and events: applies retention (evidence: `UNS_SILVER/normalizer/app/main.py`)
- Batch transformation → Bronze history: reads bronze rows (evidence: `README.md`)
- Batch transformation → Versioned signal catalog: normalizes catalog
- Batch transformation → Typed readings and events: writes typed data (evidence: `README.md`)
- Plant user → Copilot chat API: asks plant questions (evidence: `README.md`)
- Copilot chat API → Tool-calling agent: runs chat workflow (evidence: `README.md`)
- Tool-calling agent → OpenAI-compatible LLM: requests completion (evidence: `README.md`)
- Tool-calling agent → Read-only data tools: dispatches tools (evidence: `README.md`)
- Read-only data tools → Typed readings and events: queries silver data (evidence: `README.md`)
- Copilot chat API → Conversation history: stores conversations (evidence: `README.md`)
- Plant user → Dashboard editor and viewer: creates and views dashboards (evidence: `README.md`)
- Dashboard editor and viewer → Dashboard API client: requests dashboard data (evidence: `UNS_DASHBOARD/frontend/src/App.tsx`)
- Dashboard API client → Dashboard API: calls REST endpoints (evidence: `UNS_DASHBOARD/frontend/src/api/client.ts`)
- Dashboard API → Dashboard and chart data: serves dashboard CRUD (evidence: `UNS_DASHBOARD/backend/app/main.py`)
- Dashboard API → Dashboard database: persists dashboards (evidence: `UNS_DASHBOARD/backend/app/main.py`)
- Dashboard API → Historical historian queries: serves history queries (evidence: `README.md`)
- Historical historian queries → Bronze history: reads historian data (evidence: `README.md`)
- MQTT broker → MQTT-to-Redis bridge: streams MQTT data (evidence: `README.md`)
- MQTT-to-Redis bridge → Live-data cache: writes live data (evidence: `UNS_DASHBOARD/bridge/app/main.py`)
- Live dashboard stream → Live-data cache: serves live data (evidence: `README.md`)
