How paraggarg969/et-ai-prob-8 works
Purpose and Entry Points
GuardianRCA Hub is an industrial-safety knowledge system: it ingests plant documents, creates searchable semantic context, supports graph-oriented equipment/relationship data, and provides AI-assisted operations, root-cause analysis (RCA), and compliance responses. The unified server/frontend entry point is server.ts; the React client mounts at src/main.tsx and its primary application shell is src/App.tsx.
Client Application Boundary
The Vite/React client presents the dashboard, knowledge graph, copilot, RCA, and compliance-oriented workflows. It uses a dedicated API adapter rather than accessing persistence or AI providers directly:
• src/App.tsx
• src/services/api.ts
• src/types.ts
This keeps UI state and rendering separate from the Express MVC backend.
HTTP API and Controller Layer
Express route delegation is centralized in server/routes/api.ts. Controllers expose the main domain operations: agent conversations/RCA, document ingestion, source data access, and search. This is the primary boundary for client requests and server-side orchestration:
• server/routes/api.ts
• server/controllers/agentController.ts
• server/controllers/documentController.ts
Other domain endpoints include server/controllers/dataController.ts and server/controllers/searchController.ts.
Knowledge Ingestion and Semantic Retrieval
Document ingestion routes content through extraction/orchestration and then into retrieval-oriented services. Gemini supplies AI interpretation; vector/chroma services provide semantic indexing and lookup. Persisted local Chroma artifacts indicate the vector store can be backed by repository-local Chroma data:
• server/controllers/documentController.ts
• server/services/geminiService.ts
• server/services/vectorStore.ts
Related vector infrastructure is implemented in server/services/chromaService.ts, with stored data under server/chroma_data/chroma.sqlite3.
Multi-Agent Copilot, RCA, and Compliance
The agent controller is the high-level AI workflow coordinator. It selects or prompts specialized operational, root-cause, and regulatory reasoning modes, combining retrieved knowledge with Gemini generation to return cited/synthesized safety guidance, failure analyses, and compliance findings:
• server/controllers/agentController.ts
• server/services/geminiService.ts
• server/types/index.ts
Longer-running work can be decoupled through server/services/jobQueue.ts, an important control boundary for ingestion or AI-heavy tasks.
Persistence and Domain Model
Database access is centralized through the model layer and database configuration, rather than embedded in controllers. The intended relational schema covers documents, graph entities/links, RCA cases, and compliance records; seed support exists for initializing data:
• server/config/database.ts
• server/models/dbModel.ts
• server/database/schema.sql
The README identifies Neon PostgreSQL via DATABASE_URL; the database configuration is therefore the external persistence integration boundary.
Runtime and External Services
The application runs TypeScript on Node.js with Express coordinating the backend and Vite serving/building the React client. Material external dependencies are Google Gemini (GEMINI_API_KEY) for multimodal/LLM work, PostgreSQL/Neon for authoritative relational data, and Chroma/vector storage for RAG retrieval. Container-oriented server deployment is represented by:
• package.json
• server.ts
• server/compose.yaml
Main entry points: api.ts API Routes · agentController.ts Agent Controller · documentController.ts Document Controller · dbModel.ts Database Model Layer
Components 20
React Client
- Application Shell · Dashboard, graph, copilot, RCA, and compliance workflows.
src/App.tsx - Client Mount
src/main.tsx - API Adapter · Client-only boundary for backend requests.
src/services/api.ts - Client Types
src/types.ts
Express Backend
- Unified Entry · Starts the server and frontend integration.
server.ts - API Routes · Central route delegation boundary.
server/routes/api.ts - Agent Controller · Coordinates copilot, RCA, and compliance reasoning.
server/controllers/agentController.ts - Document Controller · Accepts and orchestrates document ingestion.
server/controllers/documentController.ts - Data Controller · Exposes source and graph-oriented data.
server/controllers/dataController.ts - Search Controller
server/controllers/searchController.ts - Container Deployment
server/compose.yaml - Server Contracts · Agent workflow and domain type definitions.
server/types/index.ts
AI & Retrieval
- Gemini Service · Interprets content and generates safety guidance.
server/services/geminiService.ts - Vector Store · Indexes and retrieves document context.
server/services/vectorStore.ts - Chroma Service
server/services/chromaService.ts - Job Queue · Decouples ingestion and AI-heavy tasks.
server/services/jobQueue.ts
Data Stores
- Database Model Layer · Centralizes relational data access.
server/models/dbModel.ts - PostgreSQL Configuration · Connects authoritative relational persistence through DATABASE_URL.
server/config/database.ts - Relational Schema · Documents, graph entities, RCA cases, and compliance records.
server/database/schema.sql - Chroma Local Data · Repository-local Chroma persistence.
server/chroma_data/chroma.sqlite3
Connections 24
- Client Mount → Application Shell: mounts
- Application Shell → API Adapter: uses
- Application Shell → Client Types: uses
- API Adapter → API Routes: HTTP requests
- Unified Entry → API Routes: mounts
- Container Deployment → Unified Entry: runs
- API Routes → Agent Controller: agent and RCA
- API Routes → Document Controller: document ingestion
- API Routes → Data Controller: source data
- API Routes → Search Controller: search
- Agent Controller → Gemini Service: generation
- Agent Controller → Vector Store: retrieved context
- Agent Controller → Server Contracts: uses
- Document Controller → Job Queue: queues heavy work
- Document Controller → Gemini Service: content interpretation
- Document Controller → Vector Store: indexes
- Search Controller → Vector Store: semantic lookup
- Vector Store → Chroma Service: uses
- Chroma Service → Chroma Local Data: persists vectors
- Data Controller → Database Model Layer: queries
- Document Controller → Database Model Layer: stores metadata
- Agent Controller → Database Model Layer: reads cases and records
- Database Model Layer → PostgreSQL Configuration: connects through
- Relational Schema → Database Model Layer: defines data model