How labcoder-ctrl/parakh works
PARAKH checks packaged-product labels against India’s Legal Metrology rules. An officer supplies package facts and a label photo with a known-size reference; the pipeline rectifies the image and estimates scale/panel area, reads and measures text, identifies declarations, applies rules, then produces a report. The law layer supplies panel-area calculations, gazette thresholds, and uncertainty-aware verdict logic. README documents a phone app, API, scan store, and supervisor dashboard, but their implementations are not present in the sampled source; links for these documented capabilities are therefore limited.
Main entry points: run.py Pipeline Runner · api Scan API · stage.py Rule Checks · registry.py Law Registry
Components 17
Officer Workflow
- Phone Capture
capture - Scan API
api - Officer Report
report/stage.py - Supervisor Dashboard
dashboard
Label Analysis
- Pipeline Runner
pipeline/run.py - Image Rectification
rectify/stage.py - Text OCR
ocr/stage.py - Declaration Extraction
extract/stage.py - Rule Checks
rules/stage.py
Legal Metrology
- Panel Area
lmpc/panel_area.py - Table-I Thresholds
lmpc/table_i.py - Verdict Logic
lmpc/decision.py - Law Registry
lmpc/registry.py - Rule Provisions
lmpc/provisions.yaml
Scan Data
- ScanRecord Contract
contracts/scanrecord.py - Scan Store
store
Other components
- Officer
Connections 19
- Officer → Phone Capture: enters scan
- Phone Capture → Scan API: submits capture
- Scan API → Pipeline Runner: starts analysis
- Pipeline Runner → Image Rectification: calls first
- Pipeline Runner → Text OCR: calls next
- Pipeline Runner → Declaration Extraction: calls next
- Pipeline Runner → Rule Checks: calls next
- Pipeline Runner → Officer Report: calls last
- Image Rectification → Panel Area: calculates panel
- Rule Checks → Verdict Logic: decides verdict
- Rule Checks → Table-I Thresholds: looks up threshold
- Rule Checks → Law Registry: gets version
- Table-I Thresholds → Law Registry: loads table
- Law Registry → Rule Provisions: reads rules
- Scan API → Scan Store: stores scans
- Supervisor Dashboard → Scan API: views scans
- Scan API → ScanRecord Contract: uses record
- Pipeline Runner → ScanRecord Contract: validates record
- Officer → Supervisor Dashboard: reviews results