# marcusteoqiyang/cte-ims architecture

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

- Interactive diagram: https://gitdiagram.com/marcusteoqiyang/cte-ims
- Repository: https://github.com/marcusteoqiyang/cte-ims

## Overview

CTEIMS is an inventory and equipment-management web application with a companion AI assistant. Users manage parts and projects, track stock, perform check-in/check-out/transfers, handle approvals and RFID reads, and monitor dashboards; administrators configure access and operational locations. The main workflow is web request to domain controller, optional service logic, and persisted application state. The tree and source index identify additional capabilities, but unsampled modules are represented only where their paths and subsystem roles are supported; uncertain links are omitted.

Main entry points: [`Data/AppDbContext.cs`](https://github.com/marcusteoqiyang/cte-ims/blob/main/Data/AppDbContext.cs) (Application database), [`Controllers/Transaction`](https://github.com/marcusteoqiyang/cte-ims/tree/main/Controllers/Transaction) (Stock transactions), [`AI/app.py`](https://github.com/marcusteoqiyang/cte-ims/blob/main/AI/app.py) (AI request app), [`Controllers/ApprovalController.cs`](https://github.com/marcusteoqiyang/cte-ims/blob/main/Controllers/ApprovalController.cs) (Transaction approvals)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflows"]
  node_parts["Parts and projects"]
  node_inventory["Inventory management"]
  node_transactions["Stock transactions"]
  node_approvals["Transaction approvals"]
  node_rfidweb["RFID workflows<br/>[RFIDController.cs]"]
  node_dashboard["Dashboard"]
  node_administration["Administration"]
  node_access["Permission checks"]
  node_assistantui["Chatbot interface<br/>[chatbot.js]"]
end

subgraph group_domain["Inventory domain"]
  node_partmodel["Parts and projects<br/>[Part.cs]"]
  node_stockmodel["Stock records<br/>[InventoryStock.cs]"]
  node_transactionmodel["Transaction records"]
  node_locationmodel["Operational locations"]
end

subgraph group_services["Application services"]
  node_risk["Inventory risk"]
  node_rfidservice["RFID services<br/>[RFIDService.cs]"]
  node_rfidgovernance["RFID governance"]
  node_notifications["Notifications"]
end

subgraph group_platform["Persistence and events"]
  node_db[("Application database<br/>[AppDbContext.cs]")]
  node_hub["Notification hub<br/>[NotificationHub.cs]"]
end

subgraph group_assistant["AI assistant"]
  node_aiapp["AI request app<br/>[app.py]"]
  node_guardrail["Input guardrail<br/>[guardrail.py]"]
  node_selector["Function selector"]
  node_executor["Function executor"]
  node_registry["Tool registry"]
  node_responder["LLM responder<br/>[llama_responder.py]"]
end

node_user(("Web user"))

node_user -.->|"manages parts"| node_parts
node_user -.->|"reviews stock"| node_inventory
node_user -.->|"records movements"| node_transactions
node_user -.->|"reviews requests"| node_approvals
node_user -.->|"views metrics"| node_dashboard
node_parts -->|"reads and writes"| node_db
node_inventory -->|"reads and writes"| node_db
node_transactions -->|"reads and writes"| node_db
node_transactions -->|"uses RFID service"| node_rfidservice
node_transactions -->|"sends notifications"| node_notifications
node_transactions -->|"uses transaction records"| node_transactionmodel
node_approvals -->|"reads and writes"| node_db
node_approvals -->|"sends notifications"| node_notifications
node_rfidweb -->|"uses governance"| node_rfidgovernance
node_rfidweb -->|"reads and writes"| node_db
node_dashboard -.->|"retrieves dashboard data"| node_db
node_administration -->|"reads and writes"| node_db
node_access -->|"checks session permissions"| node_user
node_risk -->|"queries inventory"| node_db
node_risk -->|"evaluates stock"| node_stockmodel
node_rfidgovernance -->|"reads and writes"| node_db
node_rfidgovernance -->|"sends notifications"| node_notifications
node_hub -->|"loads user locations"| node_db
node_assistantui -.->|"sends assistant requests"| node_aiapp
node_aiapp -->|"checks input"| node_guardrail
node_aiapp -->|"selects function"| node_selector
node_aiapp -->|"executes function"| node_executor
node_aiapp -->|"generates response"| node_responder
node_executor -.->|"resolves tools"| node_registry

click node_parts "https://github.com/marcusteoqiyang/cte-ims/tree/main/Controllers/Part"
click node_inventory "https://github.com/marcusteoqiyang/cte-ims/tree/main/Controllers/Inventory"
click node_transactions "https://github.com/marcusteoqiyang/cte-ims/tree/main/Controllers/Transaction"
click node_approvals "https://github.com/marcusteoqiyang/cte-ims/blob/main/Controllers/ApprovalController.cs"
click node_rfidweb "https://github.com/marcusteoqiyang/cte-ims/blob/main/Controllers/RFIDController.cs"
click node_dashboard "https://github.com/marcusteoqiyang/cte-ims/blob/main/Controllers/Dashboard/DashboardController.cs"
click node_administration "https://github.com/marcusteoqiyang/cte-ims/tree/main/Controllers/Administration"
click node_access "https://github.com/marcusteoqiyang/cte-ims/blob/main/Controllers/Administration/PermissionBaseController.cs"
click node_partmodel "https://github.com/marcusteoqiyang/cte-ims/blob/main/Models/Part.cs"
click node_stockmodel "https://github.com/marcusteoqiyang/cte-ims/blob/main/Models/InventoryStock.cs"
click node_transactionmodel "https://github.com/marcusteoqiyang/cte-ims/blob/main/Models/InventoryTransaction.cs"
click node_locationmodel "https://github.com/marcusteoqiyang/cte-ims/blob/main/Models/OperationalLocation.cs"
click node_risk "https://github.com/marcusteoqiyang/cte-ims/blob/main/Services/InventoryRiskService.cs"
click node_rfidservice "https://github.com/marcusteoqiyang/cte-ims/blob/main/Services/RFIDService.cs"
click node_rfidgovernance "https://github.com/marcusteoqiyang/cte-ims/blob/main/Services/RFIDGovernanceService.cs"
click node_notifications "https://github.com/marcusteoqiyang/cte-ims/blob/main/Services/NotificationService.cs"
click node_db "https://github.com/marcusteoqiyang/cte-ims/blob/main/Data/AppDbContext.cs"
click node_hub "https://github.com/marcusteoqiyang/cte-ims/blob/main/Hubs/NotificationHub.cs"
click node_assistantui "https://github.com/marcusteoqiyang/cte-ims/blob/main/wwwroot/js/chatbot.js"
click node_aiapp "https://github.com/marcusteoqiyang/cte-ims/blob/main/AI/app.py"
click node_guardrail "https://github.com/marcusteoqiyang/cte-ims/blob/main/AI/agents/guardrail.py"
click node_selector "https://github.com/marcusteoqiyang/cte-ims/blob/main/AI/agents/function_selector.py"
click node_executor "https://github.com/marcusteoqiyang/cte-ims/blob/main/AI/agents/function_executor.py"
click node_registry "https://github.com/marcusteoqiyang/cte-ims/blob/main/AI/tools/function_registry.py"
click node_responder "https://github.com/marcusteoqiyang/cte-ims/blob/main/AI/llm/llama_responder.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_parts,node_inventory,node_transactions,node_approvals,node_rfidweb,node_dashboard,node_administration,node_access,node_assistantui,node_user toneBlue
class node_partmodel,node_stockmodel,node_transactionmodel,node_locationmodel toneAmber
class node_risk,node_rfidservice,node_rfidgovernance,node_notifications toneMint
class node_db,node_hub toneRose
class node_aiapp,node_guardrail,node_selector,node_executor,node_registry,node_responder toneIndigo
```

## Components

### Web workflows

- [Parts and projects](https://github.com/marcusteoqiyang/cte-ims/tree/main/Controllers/Part): `Controllers/Part`
- [Inventory management](https://github.com/marcusteoqiyang/cte-ims/tree/main/Controllers/Inventory): `Controllers/Inventory`
- [Stock transactions](https://github.com/marcusteoqiyang/cte-ims/tree/main/Controllers/Transaction): `Controllers/Transaction`
- [Transaction approvals](https://github.com/marcusteoqiyang/cte-ims/blob/main/Controllers/ApprovalController.cs): `Controllers/ApprovalController.cs`
- [RFID workflows](https://github.com/marcusteoqiyang/cte-ims/blob/main/Controllers/RFIDController.cs): `Controllers/RFIDController.cs`
- [Dashboard](https://github.com/marcusteoqiyang/cte-ims/blob/main/Controllers/Dashboard/DashboardController.cs): `Controllers/Dashboard/DashboardController.cs`
- [Administration](https://github.com/marcusteoqiyang/cte-ims/tree/main/Controllers/Administration): `Controllers/Administration`
- [Permission checks](https://github.com/marcusteoqiyang/cte-ims/blob/main/Controllers/Administration/PermissionBaseController.cs): `Controllers/Administration/PermissionBaseController.cs`
- [Chatbot interface](https://github.com/marcusteoqiyang/cte-ims/blob/main/wwwroot/js/chatbot.js): `wwwroot/js/chatbot.js`

### Inventory domain

- [Parts and projects](https://github.com/marcusteoqiyang/cte-ims/blob/main/Models/Part.cs): `Models/Part.cs`
- [Stock records](https://github.com/marcusteoqiyang/cte-ims/blob/main/Models/InventoryStock.cs): `Models/InventoryStock.cs`
- [Transaction records](https://github.com/marcusteoqiyang/cte-ims/blob/main/Models/InventoryTransaction.cs): `Models/InventoryTransaction.cs`
- [Operational locations](https://github.com/marcusteoqiyang/cte-ims/blob/main/Models/OperationalLocation.cs): `Models/OperationalLocation.cs`

### Application services

- [Inventory risk](https://github.com/marcusteoqiyang/cte-ims/blob/main/Services/InventoryRiskService.cs): `Services/InventoryRiskService.cs`
- [RFID services](https://github.com/marcusteoqiyang/cte-ims/blob/main/Services/RFIDService.cs): `Services/RFIDService.cs`
- [RFID governance](https://github.com/marcusteoqiyang/cte-ims/blob/main/Services/RFIDGovernanceService.cs): `Services/RFIDGovernanceService.cs`
- [Notifications](https://github.com/marcusteoqiyang/cte-ims/blob/main/Services/NotificationService.cs): `Services/NotificationService.cs`

### Persistence and events

- [Application database](https://github.com/marcusteoqiyang/cte-ims/blob/main/Data/AppDbContext.cs): `Data/AppDbContext.cs`
- [Notification hub](https://github.com/marcusteoqiyang/cte-ims/blob/main/Hubs/NotificationHub.cs): `Hubs/NotificationHub.cs`

### AI assistant

- [AI request app](https://github.com/marcusteoqiyang/cte-ims/blob/main/AI/app.py): `AI/app.py`
- [Input guardrail](https://github.com/marcusteoqiyang/cte-ims/blob/main/AI/agents/guardrail.py): `AI/agents/guardrail.py`
- [Function selector](https://github.com/marcusteoqiyang/cte-ims/blob/main/AI/agents/function_selector.py): `AI/agents/function_selector.py`
- [Function executor](https://github.com/marcusteoqiyang/cte-ims/blob/main/AI/agents/function_executor.py): `AI/agents/function_executor.py`
- [Tool registry](https://github.com/marcusteoqiyang/cte-ims/blob/main/AI/tools/function_registry.py): `AI/tools/function_registry.py`
- [LLM responder](https://github.com/marcusteoqiyang/cte-ims/blob/main/AI/llm/llama_responder.py): `AI/llm/llama_responder.py`

### Other components

- **Web user**

## Connections

- Web user → Parts and projects: manages parts
- Web user → Inventory management: reviews stock
- Web user → Stock transactions: records movements
- Web user → Transaction approvals: reviews requests
- Web user → Dashboard: views metrics
- Parts and projects → Application database: reads and writes (evidence: `Controllers/Part/PartController.cs`)
- Inventory management → Application database: reads and writes (evidence: `Controllers/Inventory/InventoryController.cs`)
- Stock transactions → Application database: reads and writes (evidence: `Controllers/Transaction/TransactionController.cs`)
- Stock transactions → RFID services: uses RFID service (evidence: `Controllers/Transaction/TransactionController.cs`)
- Stock transactions → Notifications: sends notifications (evidence: `Controllers/Transaction/TransactionController.cs`)
- Stock transactions → Transaction records: uses transaction records (evidence: `Controllers/Transaction/TransactionController.cs`)
- Transaction approvals → Application database: reads and writes (evidence: `Controllers/ApprovalController.cs`)
- Transaction approvals → Notifications: sends notifications (evidence: `Controllers/ApprovalController.cs`)
- RFID workflows → RFID governance: uses governance (evidence: `Controllers/RFIDController.cs`)
- RFID workflows → Application database: reads and writes (evidence: `Controllers/RFIDController.cs`)
- Dashboard → Application database: retrieves dashboard data
- Administration → Application database: reads and writes (evidence: `Controllers/Administration/RoleController.cs`)
- Permission checks → Web user: checks session permissions (evidence: `Controllers/Administration/PermissionBaseController.cs`)
- Inventory risk → Application database: queries inventory (evidence: `Services/InventoryRiskService.cs`)
- Inventory risk → Stock records: evaluates stock (evidence: `Services/InventoryRiskService.cs`)
- RFID governance → Application database: reads and writes (evidence: `Services/RFIDGovernanceService.cs`)
- RFID governance → Notifications: sends notifications (evidence: `Services/RFIDGovernanceService.cs`)
- Notification hub → Application database: loads user locations (evidence: `Hubs/NotificationHub.cs`)
- Chatbot interface → AI request app: sends assistant requests
- AI request app → Input guardrail: checks input (evidence: `AI/app.py`)
- AI request app → Function selector: selects function (evidence: `AI/app.py`)
- AI request app → Function executor: executes function (evidence: `AI/app.py`)
- AI request app → LLM responder: generates response (evidence: `AI/app.py`)
- Function executor → Tool registry: resolves tools
