Skip to content

About

AI for Industrial Knowledge Intelligence is a RAG-powered platform that unifies industrial documents into a searchable knowledge hub, enabling faster decisions, predictive maintenance, and compliance monitoring.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

⚙️ KIRA

Knowledge Intelligence for Rapid Analysis

An industrial AI operating system — plant documents and live operational data in, decisions out.

Next.js 15 · FastAPI · PostgreSQL · Neo4j · Qdrant · Redis · MinIO · Docker


🔍 The problem

Industrial plants run on knowledge that's scattered and stale. Decades of manuals, P&IDs, inspection reports, maintenance logs, and compliance records live in disconnected PDFs, spreadsheets, and filing cabinets. When something fails at 2am:

  • The engineer who knew the fix retired years ago
  • The relevant SOP is buried in a 400-page PDF nobody can search
  • Maintenance history, compliance status, and equipment data live in three different systems that don't talk
  • Answers come from tribal memory, not evidence — and mistakes are expensive and unsafe

The data exists. It's just fragmented, unsearchable, and disconnected from live plant state.

💡 How we solve it

Turn every document and every live signal into one connected, queryable knowledge layer — and put an AI on top that always cites its source.

  1. Ingest everything — PDFs, spreadsheets, images, CSVs go through auto text + entity extraction
  2. Connect it — extracted entities (equipment, standards, failures) become a knowledge graph, fused with live plant state: work orders, failures, technicians, open violations
  3. Ground every answer — the Copilot orchestrates retrieval + graph + analytics tools; every response is traceable to the exact source passage, with a confidence score
  4. Close the loop — compliance violations detect automatically, follow maintenance progress, and auto-close when the condition clears — no manual reconciliation

🎯 How it helps

Role Value
Plant engineer Ask a question, get a cited answer in seconds instead of digging through PDFs
Maintenance lead One board for work orders, MTTR/cost analytics, and auto-assignment — no spreadsheet juggling
Compliance officer Violations surface and close themselves as equipment is repaired; audit trail is automatic
Operations Live plant health, availability, and risk on one dashboard — decisions from evidence, not memory

🌐 Live Demo

Try the app directly — no setup required:

Live site straining-crumpet-handset.ngrok-free.dev
Demo account demo@kira.example.com / password-password123
Simulation straining-crumpet-handset.ngrok-free.dev/sim-control.html — drive a live plant simulation

🚀 Quickstart

Prereqs: Docker Desktop + Node 20+

cp .env.example .env
npm run infra:up        # builds & starts all 8 services
Service URL
Web app http://localhost:3000
API docs (OpenAPI) http://localhost:8000/docs
Neo4j browser http://localhost:7474
MinIO console http://localhost:9001

Create a workspace on the web app, upload a document, ask the Copilot. Runs fully offline — no LLM key required (set LLM_PROVIDER + LLM_API_KEY in .env to upgrade answers).

✨ What's inside

📄 Documents PDF/DOCX/XLSX/CSV/images → auto-extract → entities → graph. Public/private visibility by role.
🕸️ Knowledge Graph 3D force graph: equipment, standards, failures, work orders, technicians, violations — docs + live plant state
🔧 Maintenance Work-order kanban with a validated state machine, engineer assignment, MTTR/cost analytics
🛡️ Compliance Rules engine detects violations, mirrors maintenance progress, auto-closes when the condition clears
📊 Analytics Plant health, availability, compliance score, AI quality metrics, CSV export
🤖 KIRA Copilot Streaming chat with citations + confidence, orchestrating retrieval/graph/analytics/compliance tools
🎛️ Simulation localhost:3000/sim-control.html — drive a live plant simulation (degrade → fail → repair)

👥 Roles

Lead creates the org and approves engineers. Engineers register with the same org name → join request → lead approves from the bell or Team page. All data is org-scoped.

🛠️ Development

# backend tests (~100, no containers needed)
cd apps/backend && python -m pytest tests/

# frontend typecheck
cd apps/web && npx tsc --noEmit

# rebuild after changes
docker compose -f docker/docker-compose.yml up -d --build backend web

# seed demo data
python samples/seed_equipment.py     # 24 assets
python samples/simulate.py           # live plant simulation (Ctrl+C to stop)
bash samples/seed.sh                 # sample CSVs → documents → graph

🧭 First run walkthrough

  1. Register on /register — the first user for an org name becomes its Lead. Later users registering with the same org name become Engineers in a pending state until the lead approves them (bell → Approve, or the Team page).
  2. Seed data (optional): python samples/seed_equipment.py loads ~24 assets; bash samples/seed.sh uploads sample CSVs and builds the graph.
  3. Upload a document → open it → Analyze to extract entities into the graph.
  4. Knowledge Graph → Rebuild to project documents + live plant state (work orders, failures, technicians, violations).
  5. Compliance → Run Evaluation to detect violations; Maintenance to raise and work orders.
  6. Simulate a living plant: python samples/simulate.py (or open /sim-control.html) degrades assets, opens work orders, and repairs them on a loop.

🔄 How the loop closes

equipment goes offline ──► compliance detects a violation
        │                            │
        ▼                            ▼
  work order raised ──► engineer assigned (least-loaded)
        │                            │
        ▼                            ▼
  WO completed ──► asset restored ──► violation auto-closes
        │
        ▼
  graph + analytics + dashboard all reflect it on next refresh

Nothing is reconciled by hand — repairing an asset closes its compliance findings, and the knowledge graph reflects live state on every Rebuild.

⚙️ Configuration

Everything is env-driven (.env, see .env.example). Sensible local defaults ship in the compose file.

Group Keys Default
Auth JWT_SECRET_KEY, ACCESS_TOKEN_EXPIRE_MINUTES, REFRESH_TOKEN_EXPIRE_DAYS 30 min / 7 days
Postgres DATABASE_URL / POSTGRES_* local compose
Neo4j NEO4J_URI, NEO4J_USER, NEO4J_PASSWORD graph backend
Qdrant QDRANT_URL, QDRANT_COLLECTION kira_chunks
MinIO MINIO_ENDPOINT, MINIO_BUCKET, MINIO_SECURE object store
AI LLM_PROVIDER, LLM_MODEL, LLM_API_KEY, EMBEDDING_DIM none / 384-dim

LLM_PROVIDER=none (default) runs fully offline: heuristic entity extraction, deterministic summaries, hash-based embeddings. Set a provider + key to upgrade answers without any code change.

🔐 Security model

  • JWT access + rotating refresh tokens; refresh rotation detects reuse
  • Server-side sessions — revoke any session instantly from Settings
  • Account lockout after repeated failed logins
  • DB-backed RBAC — 30+ granular <resource>.<action> permissions (e.g. maintenance.approve, documents.delete); every API route re-checks, the UI only hides what you can't reach
  • Strict multi-tenancy — every query is org-scoped; no cross-org read is possible

🧪 Testing

cd apps/backend && python -m pytest tests/   # 19 suites: auth, RBAC, documents,
                                              # maintenance, compliance, graph, analytics, copilot
cd apps/web && npx tsc --noEmit               # frontend types

Tests use in-memory SQLite + in-memory storage/graph backends — no containers required.

📚 Docs

Doc Covers
Project Spec Vision, modules, roles, tenancy
Architecture Services, data flows, deployment
Backend Spec Layering, state machines, testing
Frontend Spec Pages, conventions, design tokens
API Spec Every endpoint group
Database Tables, relationships, migrations
AI Agents Orchestrator, tools, offline-first

About

AI for Industrial Knowledge Intelligence is a RAG-powered platform that unifies industrial documents into a searchable knowledge hub, enabling faster decisions, predictive maintenance, and compliance monitoring.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages