Skip to content
codexanjanPublic

About

🏷️ LabelProof - Intelligent packaged-food label analysis dashboard with browser OCR, nutritional verification & consumer compliance.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

12 Commits

Folders and files

Repository files navigation

LabelProof β€” Evidence, not assumptions

SIH26034 concept Β· Packaged-food label review workspace Β· Version 3.4

Scan a packaged product, follow its image evidence, and understand what was observed, what is unreadable, and what still needs a photograph. LabelProof turns label review into a transparent, traceable workflow.

Open dashboard Β· Public landing page Β· Sample report Β· Implementation report

LabelProof dashboard with product images, observation counts, review queue and activity

Implemented app upgrades in v3.4

The specifications now drive working application features. The document-download screen has been removed from the dashboard; its old URL opens Processing & batches.

  • Durable cloud OCR: private photo uploads, database-backed jobs, server Tesseract processing, one-minute recovery scheduler, five-minute leases, at most three attempts and idempotent report creation. Close the browser after queuing a job; download the completed report to review its evidence. Server image decoding validates file type, dimensions and SHA-256; EXIF rotation is handled without changing the original upload.
  • Separate account caches: login, logout and reload select the correct browser database. Photo drafts and settings do not mix with the anonymous workspace or another account. This is application separation, not encryption against someone who controls the browser profile.
  • Strict cloud publication: the server validates record IDs, image/report references, private paths, evidence regions, readable coverage for absence findings and immutable assessment versions. Imported reports retain their original server representation during another publication.
  • Team review controls: approvals check the server role and expected cloud version; assignments must name a current reviewer/admin. Decisions retain the assessment hash and snapshot version.
  • Cloud restore points: each publication preserves its previous snapshot, up to ten recent versions. Administrators can preview and restore a point; restoration creates a new version and an audit entry.
  • Opt-in local retention: expire old local products, images, reports and associated events on workspace opening, with a recorded deletion event. Automatic deletion is off by default; cloud copies are separate.
  • Server audit and processing status: inspect team audit entries and cloud job attempts/errors from the dashboard. Cloud job polling updates only the history panel and preserves in-progress form entry.

Cloud processing with completed and recovered server jobs

Implementation and verification Β· Cloud processing Β· Team and restore controls

Run npm run test:full after npm ci; it starts and stops its own isolated test server. Chrome and first-use OCR network access are required. npm run test:deployment checks the live release. Normal-account cloud tests require operator-provisioned disposable example.test accounts, never customer credentials. Public demo credentials are below.

The five reference specifications and master/MVP prompt remain in docs/specifications. They describe the v3.3 baseline and target requirements; use the v3.4 implementation report for current status.

Demo login

Open Account & privacy, then choose Sign in to demo, or use:

  • Email: demo@labelproof.example
  • Password: LabelProofDemo!2026

These credentials are intentionally public. The real cloud account can read only the LabelProof Demo organization, containing three synthetic products. Team edits, cloud uploads, report changes, password/email changes, identity linking and MFA enrollment are blocked on the server. Local experiments are available on your device; use your own account for real product photos. Demo sign-out ends only the current browser session.

To restore the samples from cloud: Team & cloud β†’ Load my organizations β†’ Select LabelProof Demo β†’ Download cloud workspace.

Email provider chosen: Resend. The owner currently has no sender domain, so public signup and password-recovery email delivery remain pending domain verification, provider credentials and Supabase dashboard settings. Email confirmation stays enabled. Reviewed operative legal packs, registry verification and real-world OCR benchmarking remain production gates. Cloud OCR is implemented in v3.4.

v3 additions

Complete release and readiness report.

Added persistent capture drafts, resumable browser batches, barcode reading, quality hints, reviewer assignments/comments/preliminary approvals, comparisons, rule-review drafts, an English searchable PDF layer, opt-in local retention, offline app shell and six new workspace pages. Account/team/private-storage integration and server-enforced organization schema are included; the approved LabelProof cloud project is active in Mumbai, with private images, password login for confirmed accounts, team roles and version-checked workspace sync. Public signup/recovery delivery and redirects await email-provider setup and a Supabase dashboard session. This historical v3.0 summary predates the v3.4 cloud worker and restore implementation. Legal validation and registry integration remain pending. This release is not certified production-ready.

Interaction fixes in v2.1

See the button and recovery audit for checks and limits.

  • Download complete PDFs with all findings, notes, sources, comparison values, photos and highlights. Text pages preserve browser script shaping as images; CSV/JSON are searchable.
  • Rescan from the selected queue declaration; preserve conflicting evidence and comparison buttons through backup import.
  • Close mobile navigation via its button, backdrop, Escape or a destination link.
  • Cancel OCR and retain photos for retry. Recognition failures are caught; worker operations time out after 90 seconds.
  • Reject invalid backups and reset the chooser. Cancel capture discards its draft; normal in-app navigation retains entered details.
  • Guard repeated saves and provide recovery links for unavailable report versions.

Dashboard release features

The original single-screen prototype has become a separate dashboard with nine workspace pages, real browser OCR, persistent images, assessment history, import/export and review tools. The public landing page remains separate at /; the workspace opens at /dashboard.

  • Added Overview, My scans, Review queue, Evidence library, Reports, Analytics, Rule library, Activity log and Settings.
  • Loaded three explicitly labelled synthetic product scenarios, with original illustrative packaging and matching label panels.
  • Replaced summary-only local storage with an IndexedDB database that retains original image blobs, extraction text, evidence coordinates and reports after reload.
  • Added immutable assessment versions, product snapshots, image snapshots and correction rationale.
  • Added conflicting-value detection across photographs, targeted rescanning and manual applicability review.
  • Added full workspace backups with embedded uploaded images, report JSON, CSV and downloadable PDF with a complete evidence appendix.
  • Added backup validation, source-image validation, SHA-256 hashing, CSV formula escaping and individual/local-workspace deletion.
  • Added English and English/Hindi OCR settings, workspace preferences, source-review drafts and an activity timeline.
  • Added two Vercel serverless metadata endpoints, automated checks, a CI workflow template, screenshots and system documentation.

Honest scope

This is a working label-observation prototype, not a legal compliance certification service.

OCR detects declaration text. It does not automatically validate every clause, category exception, effective date, physical font size, nutrition value or licence authenticity. Source references are official entry points, not a published legal rule pack. Applicability starts as unknown; reviewers can record their assessment with a rationale.

The deployment supports local IndexedDB plus an active Supabase PostgreSQL database, confirmed-account authentication, private evidence storage and server-enforced organization roles. Cloud upload/download are explicit actions on Team & cloud. Public account email delivery and recovery redirects still need configuration. Government registry verification, validated legal rules, public email activation, cloud account/data deletion, independent disaster recovery and external incident alerts remain release gates. See cloud activation and verification.

Features and routes

Feature Route What works
Public landing / Feature overview, product imagery, dashboard and sample-report links
Dedicated dashboard /dashboard Counts derived from saved data, product previews, review priorities and activity
Product library /dashboard/scans Search by name/brand/category, sample/upload/review filters, report navigation
Guided capture /dashboard/new Drag/drop, upload, mobile camera input, seven surface labels, readability classification
Evidence report /dashboard/scans/:id Image highlights, observation details, sources, applicability, corrections, OCR provenance
Review queue /dashboard/review Separate filters for uncaptured, unreadable, review, conflict and potential-issue states
Evidence gallery /dashboard/evidence Saved image previews, surface filter, image inspection and OCR text
Report archive /dashboard/reports Reopen any assessment version, including read-only earlier versions
Analytics /dashboard/analytics Observation distribution, capture coverage and open checks; no invented compliance score
Rule library /dashboard/rules Official references, detector inventory and persistent draft review notes
Activity timeline /dashboard/activity Scans, corrections, exports, imports, preferences and draft changes
Account /dashboard/account Confirmed-account login/logout, password update, signup/recovery controls with email-setup status
Team & cloud /dashboard/team Organization creation/selection, server roles, private images, strict snapshot validation, restore previews and server audit
Processing /dashboard/processing Durable server OCR with scheduler recovery, original private images, plus local browser batches
Review workflow /dashboard/approvals Local decisions; cloud role/version checks, valid team assignments and hash-bound review records
Comparison /dashboard/compare Side-by-side assessment findings
Readiness /dashboard/operations Health checks, review drafts and evaluation exports
Settings /dashboard/settings Workspace/reviewer names, OCR language, uncertainty threshold, backup/import and deletion

All pages are usable on desktop and mobile. The mobile navigation opens from the menu button. File-backup imports get new identifiers. Cloud downloads retain a per-account, per-organization ID mapping, so repeated downloads update matching cloud records without duplicates. Unrelated local records remain available; export unsynced work before downloading.

The evidence model

Observation Meaning Next step
Observed Text was detected or manually confirmed with a source image Review the complete declaration and applicable requirement
Unreadable The text/image cannot be read reliably Retake the relevant area
Not photographed No relevant surface image is available Add a photograph; suggested surfaces are capture hints
Needs review OCR did not establish the declaration from captured evidence Inspect the images before deciding whether to rescan
Conflicting Different images produced different values Compare all retained observations
Potential issue A reviewer recorded an absence with applicability, readable-coverage confirmation and a rationale Review the legal requirement before a final conclusion
Not applicable A reviewer recorded non-applicability with a rationale Verify the exception against the operative source

OCR non-detection never automatically becomes a missing declaration. The quantity detector also avoids treating a serving size as net quantity.

Every manual change creates a new assessment. Earlier findings remain intact. A changed observed value clears its previous highlight unless a new valid region is provided; the application does not invent a box for unobserved information.

Declaration inventory

The current observation pack has 12 detectors:

  1. Net quantity.
  2. Retail price / MRP.
  3. Relevant manufacturer declaration.
  4. FSSAI declaration text.
  5. Batch / lot number.
  6. Date marking.
  7. Ingredients.
  8. Consumer-care text.
  9. Nutrition declaration.
  10. Allergen declaration.
  11. Origin declaration.
  12. Storage instructions.

These are candidate declarations, not a universal checklist of legally mandatory fields. Category applicability and exceptions need review. Symbols and logos are not automatically interpreted by this text OCR implementation.

Screenshots and images

Evidence-linked report

Report showing label findings beside a highlighted original image

Guided capture

Capture screen with packaging image, surface controls and coverage checklist

Review queue

Review queue separating unreadable, unphotographed and potential-issue findings

Evidence library

Saved label image gallery

Analytics

Workspace analytics with observation distribution and capture coverage

More screens

Public landing page

Versioned report archive

Official source references and declaration detector inventory

Workspace preferences and backup controls

Mobile dashboard

Included product assets

Honestly Good Oats Mountain Morning Tea Sunny Crunch Mix
Synthetic oat pack Synthetic tea pack Synthetic snack pack
Unphotographed batch area and unreadable date Illustrative complete observation/review scenario Illustrative reviewed price absence

All product names, packaging, label values, contact details and licence numbers are synthetic. They are not collected real-brand labels and do not establish a real compliance violation. Asset generation is reproducible with npm run assets. Screenshots contain only synthetic demonstration data.

A generated, illustrative PDF is included at docs/sample-report.pdf.

Quick start

Requirements: Node.js 22+ recommended; development and checks were performed with Node.js 24 and Chrome.

git clone https://github.com/codexanjan/labelpoof.git
cd labelpoof
npm ci
npm run dev

Open the local URL shown by Vite, normally http://localhost:5173. Three samples load once when a browser workspace is first initialized.

npm test
npm run build
npm run preview

No OCR key or application secret is needed. English/Hindi language data and the OCR worker download on first use, so that first OCR run requires network access. Google Fonts is an external presentation dependency; fallback fonts are available. Images are not sent to an OCR API.

To inspect Vercel functions locally, use vercel dev; ordinary Vite development serves the frontend only.

How to use

  1. Open the dashboard and inspect the three sample scenarios.
  2. Choose New product scan, enter product details and add packaging photographs.
  3. Select the surface for each image. Photograph curved/wraparound labels in several overlapping views if needed.
  4. Run Review label. OCR extracts text and image coordinates.
  5. Select a finding to inspect its evidence and official source reference.
  6. Use Review / correct to record exact text, applicability and a rationale. Optional image-box coordinates must stay inside the image.
  7. Use Add a photo & reassess for uncertain findings. Conflicting readings stay visible.
  8. Reopen earlier versions from the report selector or report archive.
  9. Export report JSON, CSV or choose Save PDF, download the complete report with its image appendix.
  10. Export a full workspace backup from Settings before clearing site data or moving devices.

System architecture

flowchart LR
    A[Landing page] --> B[Dashboard and guided capture]
    B --> C[File validation and SHA-256]
    C --> D[Browser OCR: Tesseract]
    D --> E[Declaration extraction and conflict detection]
    E --> F[Evidence-aware observations]
    F --> G[IndexedDB workspace]
    G --> H[Evidence report and review queue]
    H --> I[Human correction or rescan]
    I --> G
    G --> J[JSON backup / CSV / downloadable PDF]
    K[Vercel metadata APIs] --> L[Health and official-source manifest]
Loading
Layer Implementation
Frontend JavaScript ES modules, accessible HTML, responsive CSS, Lucide icons
Build Vite 6.4.3 with a lockfile; OCR is loaded on demand
OCR Tesseract.js 6.0.1, English or English + Hindi
Observation engine Deterministic declaration detectors, uncertainty states and cross-image conflict retention
Database Account-scoped IndexedDB plus Supabase PostgreSQL jobs, snapshots, history, team roles and audit
Backend Vercel server OCR/dispatch and metadata functions; Supabase Auth, private Storage, worker gateway and protected RPCs
Reports Versioned assessment snapshots, JSON, CSV, downloadable PDF
Hosting Vercel production deployment with dashboard-route rewrites

Current database models

Store Key properties Relationships
scans UUID, name, brand, category, origin, sample flag, timestamps Latest assessment ID
images UUID, original blob/fixture, SHA-256, dimensions, surface, quality, OCR lines/text Scan ID
assessments UUID, version, product snapshot, image snapshots, findings, reviewer, pipeline/rule-pack IDs Scan ID and image IDs
events UUID, event type, actor, message, timestamp Optional scan ID
settings Workspace name, reviewer name, OCR language, heuristic threshold Singleton preferences record
drafts UUID, title, source ID, clause locator, effective-date note, rationale Draft only; never executed

Writes for a new scan/assessment/images/event use a single IndexedDB transaction. Assessment IDs cannot be overwritten through the application. Local storage is user-controlled and is not a tamper-proof audit system.

A proposed production PostgreSQL schema is included at database/production-schema.sql. It is a design artifact, not the database used by the deployed prototype. See database model documentation.

Backend endpoints

Method Endpoint Response
GET /api/health Application version, browser-storage/OCR status, explicit legal/registry integration state
GET /api/sources Official source manifest and detector metadata; legal validation marked pending
GET /api/config Public Supabase URL/publishable key and connection status
POST /api/telemetry Validated diagnostic codes only; no external alert delivery
POST /api/jobs Verified user/team dispatch of saved OCR jobs
POST /api/worker Machine-only scheduled OCR processing; rejects public callers

Images are uploaded to private Supabase Storage. The worker reads only authenticated job evidence and publishes an atomic report bundle. Details are in docs/API.md.

File structure

labelpoof/
β”œβ”€β”€ api/                      # Vercel serverless metadata endpoints
β”œβ”€β”€ database/
β”‚   └── production-schema.sql # Proposed cloud database, not deployed
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ PRD.md                # Product requirements
β”‚   β”œβ”€β”€ PSD.md                # Product/system design
β”‚   β”œβ”€β”€ TRD.md                # Technical design and boundaries
β”‚   β”œβ”€β”€ DATABASE.md           # Current and proposed database models
β”‚   β”œβ”€β”€ API.md                # Current and planned API contracts
β”‚   β”œβ”€β”€ REGULATORY_SOURCES.md  # Source policy and limitations
β”‚   β”œβ”€β”€ DATASET_CARD.md        # Synthetic asset provenance
β”‚   β”œβ”€β”€ IMPLEMENTATION_REPORT.md
β”‚   β”œβ”€β”€ DEMO.md
β”‚   β”œβ”€β”€ ci-workflow.yml       # Ready-to-install CI template
β”‚   β”œβ”€β”€ images/               # Dashboard/screenshots
β”‚   └── sample-report.pdf
β”œβ”€β”€ public/images/            # Product illustrations and label panels
β”œβ”€β”€ scripts/generate-assets.mjs
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.js               # Routing, orchestration, review and import/export actions
β”‚   β”œβ”€β”€ rules.js              # Evidence states, detectors and validation
β”‚   β”œβ”€β”€ storage.js            # IndexedDB persistence and transactions
β”‚   β”œβ”€β”€ ocr.js                # Lazy-loaded real browser OCR
β”‚   β”œβ”€β”€ exports.js            # Backup validation, image encoding and CSV safety
β”‚   β”œβ”€β”€ demo.js               # Three synthetic scenarios
β”‚   β”œβ”€β”€ ui.js                 # Shared rendering helpers and selected icons
β”‚   β”œβ”€β”€ style.css             # Landing, dashboard, mobile and print layouts
β”‚   └── views/                # Landing/capture/report/workspace pages
β”œβ”€β”€ tests/                    # Unit, API, browser and real-OCR workflows
β”œβ”€β”€ package.json
β”œβ”€β”€ package-lock.json
└── vercel.json

Validation report

Validation performed for the v2 implementation:

Check Result
Observation/export and metadata handler unit checks Passed: 19 tests total
Production build Passed
Dedicated dashboard browser flow Passed: navigation, evidence, review guard, version history and reload persistence
Exports/import Passed: JSON, CSV, generated PDF and full workspace import
Mobile layout Passed at 390 Γ— 844 for all principal dashboard sections
Real OCR workflow Passed: 12/12 declarations extracted from one clean, generated test label
Rescan conflict Passed: different price values retained as conflicting observations
Image persistence Passed: original uploaded image restored after reload and backup/import
Deletion Passed: individual scan and related evidence removed through the application
Published deployment Passed: direct dashboard links, images and metadata endpoints

The clean fixture result is a functional smoke test, not a dataset-wide accuracy benchmark. No model accuracy claim is made for reflective, curved, multilingual, damaged or low-resolution real packaging. English/Hindi is selectable; the real OCR smoke test uses English.

# Requires Chrome on your machine and the app running at localhost:5173
npm run test:browser
node tests/deployment.mjs
node tests/ocr-browser.mjs

# Test the deployed dashboard instead
# PowerShell:
$env:TEST_URL = 'https://labelproof-prototype.vercel.app'
npm run test:browser

Browser checks generate documentation screenshots and a synthetic sample PDF. Test files and generated labels are included; private user images and Vercel credentials are not committed.

Privacy and operational limits

  • Scans and uploaded photos stay in the current browser's IndexedDB; there is no cross-device synchronization.
  • Backups contain image data and extracted text. Treat exported files as your own product-review records.
  • Clearing site data removes the workspace. Full backup/import supports moving it to another browser.
  • Imported products receive new IDs. Draft notes remain non-executable; imported historical events are labelled as imported.
  • File type signatures, image decoding, maximum file size, dimensions and backup references are validated.
  • OCR confidence is heuristic. Whole-image confidence is not a validated field-level readability classifier.
  • Suggested surface locations are capture guidance, not assertions that a declaration must legally appear on that surface.
  • A photographed FSSAI or BIS declaration is not an official licence-verification result.
  • PDF export generates a client-side download. Text pages are rasterized to preserve script shaping; use CSV/JSON for searchable records.
  • Local notes and audit history are not authenticated or tamper-resistant.

Production roadmap

The next implementation stage requires:

  1. Cloud authentication, organizations and reviewer authorization.
  2. Private object storage and PostgreSQL migrations.
  3. Background jobs, worker retries, processing metrics and secure APIs.
  4. Reviewed legal rule packs with authoritative clauses, effective dates, applicability predicates and exceptions.
  5. A legally reviewed publication workflow; draft notes must never become executable rules without review.
  6. Category-specific capture plans and field-level quality validation.
  7. Confirmed official registry integrations where access is actually available.
  8. Original Indian packaging photographs with usage rights and a properly annotated evaluation dataset.
  9. Security, accessibility and real-device testing beyond the current prototype checks.

See PRD, PSD, TRD and demo script for detailed system descriptions.

Deployment

The existing Vercel project is labelproof-prototype. The repository name intentionally remains the user-provided labelpoof. Source is pushed to main, and the live site is deployed directly through the Vercel CLI. Automatic GitHub deployment is not connected: Vercel's GitHub integration currently lacks access to this repository. Enable that integration in Vercel with repository access if automatic deployments are desired.

npm run build
vercel link
vercel deploy --prod

Keep .env*, .vercel/, node_modules/ and dist/ out of Git. Vercel configuration handles direct dashboard links. The repository includes a CI workflow template for install, unit/API checks and production build. To enable it, copy it to .github/workflows/ci.yml using a GitHub login with workflow permission. The current publishing login lacks that scope; automated GitHub Actions was not installed. All documented checks were run locally.

Regulatory starting points

The supplied SIH project identifier is used as project context; this repository does not independently claim an official sponsor, approval, contest submission or legal certification.

About

🏷️ LabelProof - Intelligent packaged-food label analysis dashboard with browser OCR, nutritional verification & consumer compliance.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages