How neeraj-kb/h2s_app works
Setu is a local-first PWA for reading passive H₂S dosimeter badges. A worker or supervisor enters shift details, captures a badge with the phone camera, and confirms or adjusts three sampled regions: white reference, exposure strip, and expiry patch. The main application coordinates color correction, dose-range estimation, expiry verification, result display, and optional saving; saved readings support history and CSV export. The README also describes lab experiment logging and an admin telemetry portal. The sampled source confirms the main orchestration and storage paths; those unsampled views are represented only at their documented enclosing modules.
Main entry points: main.js App controller · db.js Local records · csvExport.js CSV export · views.js Application views
Components 16
Badge capture
- Camera capture
src/capture/camera.js - Point detection
src/capture/autoDetect.js - Tap sampling
src/capture/tapCalibration.js
Reading analysis
- White correction
src/colorimetry/colorCorrection.js - Dose range
src/colorimetry/doseEstimate.js - Expiry check
src/colorimetry/expiryCheck.js
Records and reporting
- Local records
src/storage/db.js - CSV export
src/storage/csvExport.js - Experiment chart
src/ui/components/experimentsChart.js
Application and offline
- App controller
src/main.js - Application views
src/ui/views.js - Offline caching
public/sw.js
Other components
- Worker / supervisor
- IndexedDB
- Browser download
- Browser runtime
Connections 16
- Worker / supervisor → App controller: enters and requests
- App controller → Camera capture: starts or captures
- App controller → Camera capture: stops stream
- App controller → Point detection: detects points
- App controller → Tap sampling: maps taps and samples
- App controller → White correction: corrects colors
- App controller → Dose range: estimates dose range
- App controller → Expiry check: checks validity
- App controller → Application views: updates and displays
- Application views → Experiment chart: draws chart
- App controller → Local records: reads and writes records
- Local records → IndexedDB: reads and writes
- App controller → CSV export: exports readings
- CSV export → Browser download: triggers download
- App controller → Offline caching: registers
- Offline caching → Browser runtime: caches requests