# devops941/process-guard architecture

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

- Interactive diagram: https://gitdiagram.com/devops941/process-guard
- Repository: https://github.com/devops941/process-guard

## Overview

ProcessGuard AI is an industrial multivariate anomaly-detection and operator-review dashboard. Operators select a plant, inspect telemetry, establish or configure baselines, run detection, review alerts and signal contributions, then evaluate results and export reports. The documented product also includes uploads, audit, administration, drift monitoring and synthetic demo telemetry. The excerpts show the run router invoking analytics and the app registering routers; several other branches are documented in the README but their runtime wiring was not sampled.

Main entry points: [`backend/app/api/v1/routers/runs.py`](https://github.com/devops941/process-guard/blob/main/backend/app/api/v1/routers/runs.py) (Detection orchestration), [`frontend/src/App.tsx`](https://github.com/devops941/process-guard/blob/main/frontend/src/App.tsx) (Workspace shell), [`backend/app/main.py`](https://github.com/devops941/process-guard/blob/main/backend/app/main.py) (FastAPI application), [`frontend/src/lib/api.ts`](https://github.com/devops941/process-guard/blob/main/frontend/src/lib/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Operator workspace"]
  node_workspace["Workspace shell<br/>[App.tsx]"]
  node_auth_ui["Sign-in state<br/>[authContext.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_telemetry_ui["Signals and uploads<br/>[SignalsPanel.tsx]"]
  node_baseline_ui["Baseline models<br/>[BaselinePanel.tsx]"]
  node_detection_ui["Detection view<br/>[DetectPanel.tsx]"]
  node_investigation_ui["Alert investigation"]
  node_signalwall["Signal wall<br/>[SignalWall.tsx]"]
  node_reports_ui["Reports and evaluation<br/>[ReportPanel.tsx]"]
end

subgraph group_api["API and access"]
  node_backend_app["FastAPI application<br/>[main.py]"]
  node_auth_router["Authentication routes<br/>[auth.py]"]
  node_telemetry_routes["Telemetry and uploads"]
  node_model_routes["Models and runs"]
  node_alert_routes["Alerts and events"]
  node_report_routes["Evaluation and reports"]
  node_admin_routes["Plants and audit"]
  node_security["Token security<br/>[security.py]"]
  node_runs["Detection orchestration<br/>[runs.py]"]
end

subgraph group_analytics["Analytics"]
  node_preprocess["Preprocessing<br/>[preprocess.py]"]
  node_detectors["Multivariate detectors<br/>[pca_monitor.py]"]
  node_ensemble["Score ensemble<br/>[ensemble.py]"]
  node_thresholds["Alert thresholds<br/>[thresholds.py]"]
  node_contributions["Signal contributions<br/>[contributions.py]"]
  node_correlation["Correlation shifts<br/>[corrshift.py]"]
  node_evaluation["Evaluation metrics<br/>[evaluate.py]"]
  node_drift["Model drift<br/>[drift.py]"]
  node_univariate["Univariate monitors<br/>[univariate.py]"]
  node_synthetic["Synthetic telemetry<br/>[synth.py]"]
end

subgraph group_storage["Persistence"]
  node_repository["Data repositories<br/>[db_repo.py]"]
  node_database[("MongoDB storage<br/>[database.py]")]
end

node_operator(("Operator"))

node_operator -->|"uses"| node_workspace
node_workspace -->|"provides auth"| node_auth_ui
node_workspace -->|"renders"| node_telemetry_ui
node_workspace -->|"renders"| node_baseline_ui
node_workspace -->|"renders"| node_detection_ui
node_workspace -->|"renders"| node_investigation_ui
node_workspace -->|"renders"| node_reports_ui
node_auth_ui -->|"requests identity"| node_api_client
node_telemetry_ui -->|"requests telemetry"| node_api_client
node_baseline_ui -->|"requests models"| node_api_client
node_investigation_ui -->|"reviews alerts"| node_api_client
node_reports_ui -->|"requests reports"| node_api_client
node_baseline_ui -->|"renders"| node_signalwall
node_investigation_ui -->|"renders"| node_signalwall
node_api_client -.->|"calls API"| node_backend_app
node_backend_app -->|"registers"| node_auth_router
node_backend_app -->|"registers"| node_telemetry_routes
node_backend_app -->|"registers"| node_model_routes
node_backend_app -->|"registers"| node_alert_routes
node_backend_app -->|"registers"| node_report_routes
node_backend_app -->|"registers"| node_admin_routes
node_auth_router -->|"validates tokens"| node_security
node_auth_router -->|"reads users"| node_repository
node_model_routes -.->|"dispatches runs"| node_runs
node_runs -->|"loads and saves"| node_repository
node_runs -->|"preprocesses"| node_preprocess
node_runs -->|"scores with"| node_detectors
node_runs -->|"fuses scores"| node_ensemble
node_runs -->|"applies thresholds"| node_thresholds
node_runs -->|"computes shares"| node_contributions
node_runs -->|"computes shifts"| node_correlation
node_report_routes -.->|"evaluates runs"| node_evaluation
node_report_routes -.->|"monitors drift"| node_drift
node_runs -.->|"compares monitors"| node_univariate
node_synthetic -.->|"supplies demo data"| node_preprocess
node_repository -->|"reads and writes"| node_database

click node_workspace "https://github.com/devops941/process-guard/blob/main/frontend/src/App.tsx"
click node_auth_ui "https://github.com/devops941/process-guard/blob/main/frontend/src/lib/authContext.tsx"
click node_api_client "https://github.com/devops941/process-guard/blob/main/frontend/src/lib/api.ts"
click node_telemetry_ui "https://github.com/devops941/process-guard/blob/main/frontend/src/features/signals/SignalsPanel.tsx"
click node_baseline_ui "https://github.com/devops941/process-guard/blob/main/frontend/src/features/baseline/BaselinePanel.tsx"
click node_detection_ui "https://github.com/devops941/process-guard/blob/main/frontend/src/features/detect/DetectPanel.tsx"
click node_investigation_ui "https://github.com/devops941/process-guard/blob/main/frontend/src/features/investigate/InvestigatePanel.tsx"
click node_signalwall "https://github.com/devops941/process-guard/blob/main/frontend/src/components/signalwall/SignalWall.tsx"
click node_reports_ui "https://github.com/devops941/process-guard/blob/main/frontend/src/features/report/ReportPanel.tsx"
click node_backend_app "https://github.com/devops941/process-guard/blob/main/backend/app/main.py"
click node_auth_router "https://github.com/devops941/process-guard/blob/main/backend/app/api/v1/routers/auth.py"
click node_telemetry_routes "https://github.com/devops941/process-guard/tree/main/backend/app/api/v1/routers"
click node_model_routes "https://github.com/devops941/process-guard/tree/main/backend/app/api/v1/routers"
click node_alert_routes "https://github.com/devops941/process-guard/tree/main/backend/app/api/v1/routers"
click node_report_routes "https://github.com/devops941/process-guard/tree/main/backend/app/api/v1/routers"
click node_admin_routes "https://github.com/devops941/process-guard/tree/main/backend/app/api/v1/routers"
click node_security "https://github.com/devops941/process-guard/blob/main/backend/app/core/security.py"
click node_runs "https://github.com/devops941/process-guard/blob/main/backend/app/api/v1/routers/runs.py"
click node_preprocess "https://github.com/devops941/process-guard/blob/main/backend/app/analytics/preprocess.py"
click node_detectors "https://github.com/devops941/process-guard/blob/main/backend/app/analytics/pca_monitor.py"
click node_ensemble "https://github.com/devops941/process-guard/blob/main/backend/app/analytics/ensemble.py"
click node_thresholds "https://github.com/devops941/process-guard/blob/main/backend/app/analytics/thresholds.py"
click node_contributions "https://github.com/devops941/process-guard/blob/main/backend/app/analytics/contributions.py"
click node_correlation "https://github.com/devops941/process-guard/blob/main/backend/app/analytics/corrshift.py"
click node_evaluation "https://github.com/devops941/process-guard/blob/main/backend/app/analytics/evaluate.py"
click node_drift "https://github.com/devops941/process-guard/blob/main/backend/app/analytics/drift.py"
click node_univariate "https://github.com/devops941/process-guard/blob/main/backend/app/analytics/univariate.py"
click node_synthetic "https://github.com/devops941/process-guard/blob/main/backend/app/analytics/synth.py"
click node_repository "https://github.com/devops941/process-guard/blob/main/backend/app/repositories/db_repo.py"
click node_database "https://github.com/devops941/process-guard/blob/main/backend/app/core/database.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_workspace,node_auth_ui,node_api_client,node_telemetry_ui,node_baseline_ui,node_detection_ui,node_investigation_ui,node_signalwall,node_reports_ui toneBlue
class node_backend_app,node_auth_router,node_telemetry_routes,node_model_routes,node_alert_routes,node_report_routes,node_admin_routes,node_security,node_runs toneAmber
class node_preprocess,node_detectors,node_ensemble,node_thresholds,node_contributions,node_correlation,node_evaluation,node_drift,node_univariate,node_synthetic toneMint
class node_repository,node_database toneRose
class node_operator toneIndigo
```

## Components

### Operator workspace

- [Workspace shell](https://github.com/devops941/process-guard/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Sign-in state](https://github.com/devops941/process-guard/blob/main/frontend/src/lib/authContext.tsx): `frontend/src/lib/authContext.tsx`
- [API client](https://github.com/devops941/process-guard/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Signals and uploads](https://github.com/devops941/process-guard/blob/main/frontend/src/features/signals/SignalsPanel.tsx): `frontend/src/features/signals/SignalsPanel.tsx`
- [Baseline models](https://github.com/devops941/process-guard/blob/main/frontend/src/features/baseline/BaselinePanel.tsx): `frontend/src/features/baseline/BaselinePanel.tsx`
- [Detection view](https://github.com/devops941/process-guard/blob/main/frontend/src/features/detect/DetectPanel.tsx): `frontend/src/features/detect/DetectPanel.tsx`
- [Alert investigation](https://github.com/devops941/process-guard/blob/main/frontend/src/features/investigate/InvestigatePanel.tsx): `frontend/src/features/investigate/InvestigatePanel.tsx`
- [Signal wall](https://github.com/devops941/process-guard/blob/main/frontend/src/components/signalwall/SignalWall.tsx): `frontend/src/components/signalwall/SignalWall.tsx`
- [Reports and evaluation](https://github.com/devops941/process-guard/blob/main/frontend/src/features/report/ReportPanel.tsx): `frontend/src/features/report/ReportPanel.tsx`

### API and access

- [FastAPI application](https://github.com/devops941/process-guard/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/devops941/process-guard/blob/main/backend/app/api/v1/routers/auth.py): `backend/app/api/v1/routers/auth.py`
- [Telemetry and uploads](https://github.com/devops941/process-guard/tree/main/backend/app/api/v1/routers): `backend/app/api/v1/routers`
- [Models and runs](https://github.com/devops941/process-guard/tree/main/backend/app/api/v1/routers): `backend/app/api/v1/routers`
- [Alerts and events](https://github.com/devops941/process-guard/tree/main/backend/app/api/v1/routers): `backend/app/api/v1/routers`
- [Evaluation and reports](https://github.com/devops941/process-guard/tree/main/backend/app/api/v1/routers): `backend/app/api/v1/routers`
- [Plants and audit](https://github.com/devops941/process-guard/tree/main/backend/app/api/v1/routers): `backend/app/api/v1/routers`
- [Token security](https://github.com/devops941/process-guard/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [Detection orchestration](https://github.com/devops941/process-guard/blob/main/backend/app/api/v1/routers/runs.py): `backend/app/api/v1/routers/runs.py`

### Analytics

- [Preprocessing](https://github.com/devops941/process-guard/blob/main/backend/app/analytics/preprocess.py): `backend/app/analytics/preprocess.py`
- [Multivariate detectors](https://github.com/devops941/process-guard/blob/main/backend/app/analytics/pca_monitor.py): `backend/app/analytics/pca_monitor.py`
- [Score ensemble](https://github.com/devops941/process-guard/blob/main/backend/app/analytics/ensemble.py): `backend/app/analytics/ensemble.py`
- [Alert thresholds](https://github.com/devops941/process-guard/blob/main/backend/app/analytics/thresholds.py): `backend/app/analytics/thresholds.py`
- [Signal contributions](https://github.com/devops941/process-guard/blob/main/backend/app/analytics/contributions.py): `backend/app/analytics/contributions.py`
- [Correlation shifts](https://github.com/devops941/process-guard/blob/main/backend/app/analytics/corrshift.py): `backend/app/analytics/corrshift.py`
- [Evaluation metrics](https://github.com/devops941/process-guard/blob/main/backend/app/analytics/evaluate.py): `backend/app/analytics/evaluate.py`
- [Model drift](https://github.com/devops941/process-guard/blob/main/backend/app/analytics/drift.py): `backend/app/analytics/drift.py`
- [Univariate monitors](https://github.com/devops941/process-guard/blob/main/backend/app/analytics/univariate.py): `backend/app/analytics/univariate.py`
- [Synthetic telemetry](https://github.com/devops941/process-guard/blob/main/backend/app/analytics/synth.py): `backend/app/analytics/synth.py`

### Persistence

- [Data repositories](https://github.com/devops941/process-guard/blob/main/backend/app/repositories/db_repo.py): `backend/app/repositories/db_repo.py`
- [MongoDB storage](https://github.com/devops941/process-guard/blob/main/backend/app/core/database.py): `backend/app/core/database.py`

### Other components

- **Operator**

## Connections

- Operator → Workspace shell: uses (evidence: `README.md`)
- Workspace shell → Sign-in state: provides auth (evidence: `frontend/src/App.tsx`)
- Workspace shell → Signals and uploads: renders (evidence: `frontend/src/App.tsx`)
- Workspace shell → Baseline models: renders (evidence: `frontend/src/App.tsx`)
- Workspace shell → Detection view: renders (evidence: `frontend/src/App.tsx`)
- Workspace shell → Alert investigation: renders (evidence: `frontend/src/App.tsx`)
- Workspace shell → Reports and evaluation: renders (evidence: `frontend/src/App.tsx`)
- Sign-in state → API client: requests identity (evidence: `frontend/src/lib/authContext.tsx`)
- Signals and uploads → API client: requests telemetry (evidence: `frontend/src/features/signals/SignalsPanel.tsx`)
- Baseline models → API client: requests models (evidence: `frontend/src/features/baseline/BaselinePanel.tsx`)
- Alert investigation → API client: reviews alerts (evidence: `frontend/src/features/investigate/InvestigatePanel.tsx`)
- Reports and evaluation → API client: requests reports (evidence: `frontend/src/features/report/ReportPanel.tsx`)
- Baseline models → Signal wall: renders (evidence: `frontend/src/features/baseline/BaselinePanel.tsx`)
- Alert investigation → Signal wall: renders (evidence: `frontend/src/features/investigate/InvestigatePanel.tsx`)
- API client → FastAPI application: calls API
- FastAPI application → Authentication routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Telemetry and uploads: registers (evidence: `backend/app/main.py`)
- FastAPI application → Models and runs: registers (evidence: `backend/app/main.py`)
- FastAPI application → Alerts and events: registers (evidence: `backend/app/main.py`)
- FastAPI application → Evaluation and reports: registers (evidence: `backend/app/main.py`)
- FastAPI application → Plants and audit: registers (evidence: `backend/app/main.py`)
- Authentication routes → Token security: validates tokens (evidence: `backend/app/api/v1/routers/auth.py`)
- Authentication routes → Data repositories: reads users (evidence: `backend/app/api/v1/routers/auth.py`)
- Models and runs → Detection orchestration: dispatches runs
- Detection orchestration → Data repositories: loads and saves (evidence: `backend/app/api/v1/routers/runs.py`)
- Detection orchestration → Preprocessing: preprocesses (evidence: `backend/app/api/v1/routers/runs.py`)
- Detection orchestration → Multivariate detectors: scores with (evidence: `backend/app/api/v1/routers/runs.py`)
- Detection orchestration → Score ensemble: fuses scores (evidence: `backend/app/api/v1/routers/runs.py`)
- Detection orchestration → Alert thresholds: applies thresholds (evidence: `backend/app/api/v1/routers/runs.py`)
- Detection orchestration → Signal contributions: computes shares (evidence: `backend/app/api/v1/routers/runs.py`)
- Detection orchestration → Correlation shifts: computes shifts (evidence: `backend/app/api/v1/routers/runs.py`)
- Evaluation and reports → Evaluation metrics: evaluates runs
- Evaluation and reports → Model drift: monitors drift
- Detection orchestration → Univariate monitors: compares monitors
- Synthetic telemetry → Preprocessing: supplies demo data
- Data repositories → MongoDB storage: reads and writes (evidence: `backend/app/repositories/db_repo.py`)
