# ritz2607/sih-26035 architecture

> Architecture diagram of the GitHub repository ritz2607/sih-26035, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ritz2607/sih-26035
- Repository: https://github.com/ritz2607/sih-26035

## Overview

Metrolab is a browser-based NAWI verification workbench with a Python HTTP/SQLite bridge. The inspector profiles an instrument and its test conditions, enters load-test readings, reviews OIML computations and certificate output, then can save an audit record or request a PDF. The graph reflects documented capabilities such as eccentricity, repeatability, uncertainty, and history; the excerpts do not establish every internal backend calculation or UI callback, so uncertain wiring is omitted.

Main entry points: [`frontend/src/App.tsx`](https://github.com/ritz2607/sih-26035/blob/main/frontend/src/App.tsx) (Workflow app), [`server.py`](https://github.com/ritz2607/sih-26035/blob/main/server.py) (HTTP API server), [`frontend/src/components/InstrumentIntakeForm.tsx`](https://github.com/ritz2607/sih-26035/blob/main/frontend/src/components/InstrumentIntakeForm.tsx) (Instrument intake), [`frontend/src/utils/apiClient.ts`](https://github.com/ritz2607/sih-26035/blob/main/frontend/src/utils/apiClient.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Verification workflow"]
  node_app["Workflow app<br/>[App.tsx]"]
  node_intake["Instrument intake"]
  node_ledger["Test ledger"]
  node_profiles["Preset profiles<br/>[mockData.ts]"]
  node_types["Metrology data types<br/>[metrology.ts]"]
end

subgraph group_compute["Metrology computation"]
  node_engine["OIML engine<br/>[oimlEngine.ts]"]
end

subgraph group_reports["Reports and audit"]
  node_preview["Computation preview"]
  node_certificate["Official certificate"]
  node_history["Audit history"]
  node_pdf["Generated PDF<br/>[server.py]"]
end

subgraph group_backend["Backend services"]
  node_api["API client<br/>[apiClient.ts]"]
  node_server["HTTP API server<br/>[server.py]"]
  node_prototype["Audit and report logic"]
  node_db[("SQLite audit database<br/>[nawi_audit.db]")]
end

node_inspector(("Inspector"))

node_inspector -->|"profiles instrument"| node_intake
node_app -->|"renders intake"| node_intake
node_app -->|"renders ledger"| node_ledger
node_intake -->|"updates profile"| node_app
node_ledger -->|"updates readings"| node_app
node_app -->|"loads presets"| node_profiles
node_app -->|"computes results"| node_engine
node_app -->|"provides results"| node_preview
node_preview -->|"renders certificate"| node_certificate
node_app -->|"requests backend"| node_api
node_history -->|"requests history"| node_api
node_api -->|"sends API requests"| node_server
node_server -->|"invokes audit logic"| node_prototype
node_prototype -->|"reads and writes"| node_db
node_server -->|"generates PDF"| node_pdf
node_app -->|"opens generated PDF"| node_pdf

click node_app "https://github.com/ritz2607/sih-26035/blob/main/frontend/src/App.tsx"
click node_intake "https://github.com/ritz2607/sih-26035/blob/main/frontend/src/components/InstrumentIntakeForm.tsx"
click node_ledger "https://github.com/ritz2607/sih-26035/blob/main/frontend/src/components/DataEntryDashboard.tsx"
click node_profiles "https://github.com/ritz2607/sih-26035/blob/main/frontend/src/data/mockData.ts"
click node_types "https://github.com/ritz2607/sih-26035/blob/main/frontend/src/types/metrology.ts"
click node_engine "https://github.com/ritz2607/sih-26035/blob/main/frontend/src/utils/oimlEngine.ts"
click node_preview "https://github.com/ritz2607/sih-26035/blob/main/frontend/src/components/ComputationPreview.tsx"
click node_certificate "https://github.com/ritz2607/sih-26035/blob/main/frontend/src/components/OfficialReportDocument.tsx"
click node_history "https://github.com/ritz2607/sih-26035/blob/main/frontend/src/components/AuditHistoryModal.tsx"
click node_api "https://github.com/ritz2607/sih-26035/blob/main/frontend/src/utils/apiClient.ts"
click node_server "https://github.com/ritz2607/sih-26035/blob/main/server.py"
click node_prototype "https://github.com/ritz2607/sih-26035/blob/main/prototype_sih26035.py"
click node_db "https://github.com/ritz2607/sih-26035/blob/main/nawi_audit.db"
click node_pdf "https://github.com/ritz2607/sih-26035/blob/main/server.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_intake,node_ledger,node_profiles,node_types toneBlue
class node_engine toneAmber
class node_preview,node_certificate,node_history,node_pdf toneMint
class node_api,node_server,node_prototype,node_db toneRose
class node_inspector toneIndigo
```

## Components

### Verification workflow

- [Workflow app](https://github.com/ritz2607/sih-26035/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Instrument intake](https://github.com/ritz2607/sih-26035/blob/main/frontend/src/components/InstrumentIntakeForm.tsx): `frontend/src/components/InstrumentIntakeForm.tsx`
- [Test ledger](https://github.com/ritz2607/sih-26035/blob/main/frontend/src/components/DataEntryDashboard.tsx): `frontend/src/components/DataEntryDashboard.tsx`
- [Preset profiles](https://github.com/ritz2607/sih-26035/blob/main/frontend/src/data/mockData.ts): `frontend/src/data/mockData.ts`
- [Metrology data types](https://github.com/ritz2607/sih-26035/blob/main/frontend/src/types/metrology.ts): `frontend/src/types/metrology.ts`

### Metrology computation

- [OIML engine](https://github.com/ritz2607/sih-26035/blob/main/frontend/src/utils/oimlEngine.ts): `frontend/src/utils/oimlEngine.ts`

### Reports and audit

- [Computation preview](https://github.com/ritz2607/sih-26035/blob/main/frontend/src/components/ComputationPreview.tsx): `frontend/src/components/ComputationPreview.tsx`
- [Official certificate](https://github.com/ritz2607/sih-26035/blob/main/frontend/src/components/OfficialReportDocument.tsx): `frontend/src/components/OfficialReportDocument.tsx`
- [Audit history](https://github.com/ritz2607/sih-26035/blob/main/frontend/src/components/AuditHistoryModal.tsx): `frontend/src/components/AuditHistoryModal.tsx`
- [Generated PDF](https://github.com/ritz2607/sih-26035/blob/main/server.py): `server.py`

### Backend services

- [API client](https://github.com/ritz2607/sih-26035/blob/main/frontend/src/utils/apiClient.ts): `frontend/src/utils/apiClient.ts`
- [HTTP API server](https://github.com/ritz2607/sih-26035/blob/main/server.py): `server.py`
- [Audit and report logic](https://github.com/ritz2607/sih-26035/blob/main/prototype_sih26035.py): `prototype_sih26035.py`
- [SQLite audit database](https://github.com/ritz2607/sih-26035/blob/main/nawi_audit.db): `nawi_audit.db`

### Other components

- **Inspector**

## Connections

- Inspector → Instrument intake: profiles instrument
- Workflow app → Instrument intake: renders intake
- Workflow app → Test ledger: renders ledger
- Instrument intake → Workflow app: updates profile
- Test ledger → Workflow app: updates readings
- Workflow app → Preset profiles: loads presets
- Workflow app → OIML engine: computes results
- Workflow app → Computation preview: provides results
- Computation preview → Official certificate: renders certificate
- Workflow app → API client: requests backend
- Audit history → API client: requests history
- API client → HTTP API server: sends API requests
- HTTP API server → Audit and report logic: invokes audit logic
- Audit and report logic → SQLite audit database: reads and writes
- HTTP API server → Generated PDF: generates PDF
- Workflow app → Generated PDF: opens generated PDF
