# radmm/localjsr architecture

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

- Interactive diagram: https://gitdiagram.com/radmm/localjsr
- Repository: https://github.com/radmm/localjsr

## Overview

H2S Badge Reader is a local browser app for estimating hydrogen-sulfide badge exposure from photos. Its main workflow captures a badge, samples and corrects its colors against printed references, rejects poor-quality readings, estimates dose, and saves a record for display. The README documents these stages; the excerpts show image processing, analysis, and local record storage, but omit most event-handler wiring. The separate Swing example in Main.java does not appear to belong to this product.

Main entry points: [`app.js`](https://github.com/radmm/localjsr/blob/main/app.js) (Local records), [`index.html`](https://github.com/radmm/localjsr/blob/main/index.html) (Badge interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and sampling"]
  node_interface["Badge interface<br/>[index.html]"]
  node_capture_flow["Capture flow<br/>[app.js]"]
end

subgraph group_analysis["Color analysis"]
  node_frame_sampling["Frame sampling<br/>[app.js]"]
  node_color_correction["Reference correction<br/>[app.js]"]
  node_quality_gate{{"Quality gate<br/>[app.js]"}}
  node_dose_estimation["Dose estimation<br/>[app.js]"]
end

subgraph group_records["Records and review"]
  node_record_store[("Local records<br/>[app.js]")]
  node_results["Results display<br/>[app.js]"]
  node_comparison["Exposure comparison<br/>[app.js]"]
end

node_operator(("Operator"))
node_camera["Device camera"]

node_operator -->|"uses"| node_interface
node_interface -.->|"starts capture"| node_capture_flow
node_camera -.->|"provides frames"| node_capture_flow
node_capture_flow -->|"samples frames"| node_frame_sampling
node_frame_sampling -->|"provides samples"| node_color_correction
node_color_correction -->|"checks residual"| node_quality_gate
node_quality_gate -->|"accepts reading"| node_dose_estimation
node_dose_estimation -->|"saves record"| node_record_store
node_record_store -.->|"displays record"| node_results
node_record_store -.->|"compares records"| node_comparison

click node_interface "https://github.com/radmm/localjsr/blob/main/index.html"
click node_capture_flow "https://github.com/radmm/localjsr/blob/main/app.js"
click node_frame_sampling "https://github.com/radmm/localjsr/blob/main/app.js"
click node_color_correction "https://github.com/radmm/localjsr/blob/main/app.js"
click node_quality_gate "https://github.com/radmm/localjsr/blob/main/app.js"
click node_dose_estimation "https://github.com/radmm/localjsr/blob/main/app.js"
click node_record_store "https://github.com/radmm/localjsr/blob/main/app.js"
click node_results "https://github.com/radmm/localjsr/blob/main/app.js"
click node_comparison "https://github.com/radmm/localjsr/blob/main/app.js"

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_interface,node_capture_flow toneBlue
class node_frame_sampling,node_color_correction,node_quality_gate,node_dose_estimation toneAmber
class node_record_store,node_results,node_comparison toneMint
class node_operator,node_camera toneIndigo
```

## Components

### Capture and sampling

- [Badge interface](https://github.com/radmm/localjsr/blob/main/index.html): `index.html`
- [Capture flow](https://github.com/radmm/localjsr/blob/main/app.js): `app.js`

### Color analysis

- [Frame sampling](https://github.com/radmm/localjsr/blob/main/app.js): `app.js`
- [Reference correction](https://github.com/radmm/localjsr/blob/main/app.js): `app.js`
- [Quality gate](https://github.com/radmm/localjsr/blob/main/app.js): `app.js`
- [Dose estimation](https://github.com/radmm/localjsr/blob/main/app.js): `app.js`

### Records and review

- [Local records](https://github.com/radmm/localjsr/blob/main/app.js): `app.js`
- [Results display](https://github.com/radmm/localjsr/blob/main/app.js): `app.js`
- [Exposure comparison](https://github.com/radmm/localjsr/blob/main/app.js): `app.js`

### Other components

- **Operator**
- **Device camera**

## Connections

- Operator → Badge interface: uses (evidence: `README.md`)
- Badge interface → Capture flow: starts capture
- Device camera → Capture flow: provides frames
- Capture flow → Frame sampling: samples frames (evidence: `README.md`)
- Frame sampling → Reference correction: provides samples (evidence: `README.md`)
- Reference correction → Quality gate: checks residual (evidence: `README.md`)
- Quality gate → Dose estimation: accepts reading (evidence: `README.md`)
- Dose estimation → Local records: saves record (evidence: `README.md`)
- Local records → Results display: displays record (evidence: `app.js`)
- Local records → Exposure comparison: compares records (evidence: `app.js`)
