# prakasamtk/quality-inspection-system---qis architecture

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

- Interactive diagram: https://gitdiagram.com/prakasamtk/quality-inspection-system---qis
- Repository: https://github.com/prakasamtk/quality-inspection-system---qis

## Overview

QIS predicts in-process manufacturing defects, explains risk, and surfaces recommended corrective action to quality engineers and operators. The main workflow runs from the live-floor UI through the prediction API, inference and asset resolution, then inspection/alert handling and live dashboard updates. Separate branches cover machine/product management, analytics, model insights, and offline dataset preparation and training. The graph combines sampled calls and imports with README-documented capabilities; unsampled service and endpoint internals are represented only at their documented subsystem level.

Main entry points: [`frontend/src/App.tsx`](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/App.tsx) (Dashboard app), [`backend/app/services/inference_service.py`](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/services/inference_service.py) (Inference and explanation), [`backend/app/api/v1/endpoints/predict.py`](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/api/v1/endpoints/predict.py) (Prediction endpoint), [`frontend/src/api/endpoints.ts`](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/api/endpoints.ts) (Typed API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Operator interface"]
  node_app["Dashboard app<br/>[App.tsx]"]
  node_floor["Live floor<br/>[LiveFloor.tsx]"]
  node_inspection_ui["Inspections view<br/>[Inspections.tsx]"]
  node_machine_ui["Machines view<br/>[Machines.tsx]"]
  node_analytics_ui["Analytics view<br/>[Analytics.tsx]"]
  node_model_ui["Model insights<br/>[ModelInsights.tsx]"]
  node_api_client["Typed API client<br/>[endpoints.ts]"]
  node_live_feed["Live feed hooks<br/>[useLiveFeed.ts]"]
  node_ws_hook["WebSocket hook<br/>[useWebSocket.ts]"]
end

subgraph group_api["API and realtime"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_router["V1 API router<br/>[router.py]"]
  node_predict_api["Prediction endpoint<br/>[predict.py]"]
  node_other_api["Domain API endpoints"]
  node_ws_channels["WebSocket channels"]
end

subgraph group_domain["Quality services"]
  node_inference["Inference and explanation"]
  node_registry["Asset registry"]
  node_inspection["Inspection service"]
  node_alerts["Alert rules<br/>[alert_service.py]"]
  node_analytics["Analytics services"]
  node_simulator["Production simulator"]
  node_store[("SQLite domain records")]
end

subgraph group_ml["Data and modeling"]
  node_feature_pipeline["Feature pipeline<br/>[features.py]"]
  node_training["Model training<br/>[train.py]"]
  node_synthetic_data["Synthetic data"]
  node_ai4i_loader["AI4I loader<br/>[ai4i.py]"]
end

node_operator(("Operator / engineer"))

node_operator -->|"uses"| node_app
node_app -->|"routes to"| node_floor
node_app -->|"routes to"| node_inspection_ui
node_app -->|"routes to"| node_machine_ui
node_app -->|"routes to"| node_analytics_ui
node_app -->|"routes to"| node_model_ui
node_app -->|"subscribes via"| node_live_feed
node_app -->|"fetches KPIs via"| node_api_client
node_live_feed -->|"uses"| node_ws_hook
node_floor -.->|"loads data via"| node_api_client
node_inspection_ui -->|"fetches via"| node_api_client
node_model_ui -->|"fetches via"| node_api_client
node_api_client -->|"calls REST API"| node_api_app
node_ws_hook -->|"connects to"| node_ws_channels
node_api_app -->|"mounts"| node_router
node_api_app -->|"mounts"| node_ws_channels
node_router -->|"registers"| node_predict_api
node_router -->|"registers"| node_other_api
node_predict_api -->|"scores parts"| node_inference
node_predict_api -->|"records inspection"| node_inspection
node_predict_api -->|"evaluates alerts"| node_alerts
node_predict_api -->|"publishes updates"| node_ws_channels
node_inference -->|"resolves assets"| node_registry
node_inference -->|"reuses features"| node_feature_pipeline
node_inspection -->|"requests scoring"| node_inference
node_alerts -->|"reads and writes"| node_store
node_registry -->|"loads asset records"| node_store
node_inspection -.->|"persists inspections"| node_store
node_other_api -.->|"serves analytics"| node_analytics
node_simulator -.->|"generates scored flow"| node_inference
node_simulator -.->|"feeds live updates"| node_ws_channels
node_synthetic_data -->|"provides data for"| node_feature_pipeline
node_ai4i_loader -.->|"canonicalizes inputs for"| node_feature_pipeline
node_training -->|"uses features"| node_feature_pipeline
node_training -.->|"produces model artifacts"| node_inference

click node_app "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/App.tsx"
click node_floor "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/pages/LiveFloor.tsx"
click node_inspection_ui "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/pages/Inspections.tsx"
click node_machine_ui "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/pages/Machines.tsx"
click node_analytics_ui "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/pages/Analytics.tsx"
click node_model_ui "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/pages/ModelInsights.tsx"
click node_api_client "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/api/endpoints.ts"
click node_live_feed "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/hooks/useLiveFeed.ts"
click node_ws_hook "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/hooks/useWebSocket.ts"
click node_api_app "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/main.py"
click node_router "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/api/v1/router.py"
click node_predict_api "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/api/v1/endpoints/predict.py"
click node_other_api "https://github.com/prakasamtk/quality-inspection-system---qis/tree/main/backend/app/api/v1/endpoints"
click node_ws_channels "https://github.com/prakasamtk/quality-inspection-system---qis/tree/main/backend/app/ws"
click node_inference "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/services/inference_service.py"
click node_registry "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/services/registry_service.py"
click node_inspection "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/services/inspection_service.py"
click node_alerts "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/services/alert_service.py"
click node_analytics "https://github.com/prakasamtk/quality-inspection-system---qis/tree/main/backend/app/services"
click node_simulator "https://github.com/prakasamtk/quality-inspection-system---qis/tree/main/backend/app/simulator"
click node_store "https://github.com/prakasamtk/quality-inspection-system---qis/tree/main/backend/app/models"
click node_feature_pipeline "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/ml/features.py"
click node_training "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/ml/train.py"
click node_synthetic_data "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/ml/generate_dataset.py"
click node_ai4i_loader "https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/ml/loaders/ai4i.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_app,node_floor,node_inspection_ui,node_machine_ui,node_analytics_ui,node_model_ui,node_api_client,node_live_feed,node_ws_hook toneBlue
class node_api_app,node_router,node_predict_api,node_other_api,node_ws_channels toneAmber
class node_inference,node_registry,node_inspection,node_alerts,node_analytics,node_simulator,node_store toneMint
class node_feature_pipeline,node_training,node_synthetic_data,node_ai4i_loader toneRose
class node_operator toneIndigo
```

## Components

### Operator interface

- [Dashboard app](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Live floor](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/pages/LiveFloor.tsx): `frontend/src/pages/LiveFloor.tsx`
- [Inspections view](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/pages/Inspections.tsx): `frontend/src/pages/Inspections.tsx`
- [Machines view](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/pages/Machines.tsx): `frontend/src/pages/Machines.tsx`
- [Analytics view](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/pages/Analytics.tsx): `frontend/src/pages/Analytics.tsx`
- [Model insights](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/pages/ModelInsights.tsx): `frontend/src/pages/ModelInsights.tsx`
- [Typed API client](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/api/endpoints.ts): `frontend/src/api/endpoints.ts`
- [Live feed hooks](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/hooks/useLiveFeed.ts): `frontend/src/hooks/useLiveFeed.ts`
- [WebSocket hook](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/frontend/src/hooks/useWebSocket.ts): `frontend/src/hooks/useWebSocket.ts`

### API and realtime

- [FastAPI app](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/main.py): `backend/app/main.py`
- [V1 API router](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`
- [Prediction endpoint](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/api/v1/endpoints/predict.py): `backend/app/api/v1/endpoints/predict.py`
- [Domain API endpoints](https://github.com/prakasamtk/quality-inspection-system---qis/tree/main/backend/app/api/v1/endpoints): `backend/app/api/v1/endpoints`
- [WebSocket channels](https://github.com/prakasamtk/quality-inspection-system---qis/tree/main/backend/app/ws): `backend/app/ws`

### Quality services

- [Inference and explanation](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/services/inference_service.py): `backend/app/services/inference_service.py`
- [Asset registry](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/services/registry_service.py): `backend/app/services/registry_service.py`
- [Inspection service](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/services/inspection_service.py): `backend/app/services/inspection_service.py`
- [Alert rules](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/backend/app/services/alert_service.py): `backend/app/services/alert_service.py`
- [Analytics services](https://github.com/prakasamtk/quality-inspection-system---qis/tree/main/backend/app/services): `backend/app/services`
- [Production simulator](https://github.com/prakasamtk/quality-inspection-system---qis/tree/main/backend/app/simulator): `backend/app/simulator`
- [SQLite domain records](https://github.com/prakasamtk/quality-inspection-system---qis/tree/main/backend/app/models): `backend/app/models`

### Data and modeling

- [Feature pipeline](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/ml/features.py): `ml/features.py`
- [Model training](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/ml/train.py): `ml/train.py`
- [Synthetic data](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/ml/generate_dataset.py): `ml/generate_dataset.py`
- [AI4I loader](https://github.com/prakasamtk/quality-inspection-system---qis/blob/main/ml/loaders/ai4i.py): `ml/loaders/ai4i.py`

### Other components

- **Operator / engineer**

## Connections

- Operator / engineer → Dashboard app: uses
- Dashboard app → Live floor: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard app → Inspections view: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard app → Machines view: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard app → Analytics view: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard app → Model insights: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard app → Live feed hooks: subscribes via (evidence: `frontend/src/App.tsx`)
- Dashboard app → Typed API client: fetches KPIs via (evidence: `frontend/src/App.tsx`)
- Live feed hooks → WebSocket hook: uses (evidence: `frontend/src/hooks/useLiveFeed.ts`)
- Live floor → Typed API client: loads data via
- Inspections view → Typed API client: fetches via (evidence: `frontend/src/pages/Inspections.tsx`)
- Model insights → Typed API client: fetches via (evidence: `frontend/src/pages/ModelInsights.tsx`)
- Typed API client → FastAPI app: calls REST API
- WebSocket hook → WebSocket channels: connects to (evidence: `frontend/src/hooks/useWebSocket.ts`)
- FastAPI app → V1 API router: mounts (evidence: `backend/app/main.py`)
- FastAPI app → WebSocket channels: mounts (evidence: `backend/app/main.py`)
- V1 API router → Prediction endpoint: registers (evidence: `backend/app/api/v1/router.py`)
- V1 API router → Domain API endpoints: registers (evidence: `backend/app/api/v1/router.py`)
- Prediction endpoint → Inference and explanation: scores parts (evidence: `backend/app/api/v1/endpoints/predict.py`)
- Prediction endpoint → Inspection service: records inspection (evidence: `backend/app/api/v1/endpoints/predict.py`)
- Prediction endpoint → Alert rules: evaluates alerts (evidence: `backend/app/api/v1/endpoints/predict.py`)
- Prediction endpoint → WebSocket channels: publishes updates (evidence: `backend/app/api/v1/endpoints/predict.py`)
- Inference and explanation → Asset registry: resolves assets (evidence: `backend/app/services/inference_service.py`)
- Inference and explanation → Feature pipeline: reuses features
- Inspection service → Inference and explanation: requests scoring (evidence: `backend/app/services/inspection_service.py`)
- Alert rules → SQLite domain records: reads and writes (evidence: `backend/app/services/alert_service.py`)
- Asset registry → SQLite domain records: loads asset records (evidence: `backend/app/services/registry_service.py`)
- Inspection service → SQLite domain records: persists inspections (evidence: `backend/app/services/inspection_service.py`)
- Domain API endpoints → Analytics services: serves analytics (evidence: `backend/app/api/v1/endpoints/predict.py`)
- Production simulator → Inference and explanation: generates scored flow
- Production simulator → WebSocket channels: feeds live updates
- Synthetic data → Feature pipeline: provides data for (evidence: `ml/generate_dataset.py`)
- AI4I loader → Feature pipeline: canonicalizes inputs for
- Model training → Feature pipeline: uses features (evidence: `ml/train.py`)
- Model training → Inference and explanation: produces model artifacts
