How mav1730/legal-metrology-project works
This is a decision-support web app for screening e-commerce listings and packaging for potentially missing Legal Metrology declarations. Users submit a URL, text, image, or sample; the backend collects or OCRs text, extracts fields with regex and optional NER, evaluates configurable rules, persists evidence and findings, and supports review and JSON/PDF reports. The frontend also exposes rule and scan-history views, while DemoMart supplies reproducible example listings. Some subsystem links rely on README or SOURCE INDEX references because not all implementation files were excerpted.
Main entry points: pipeline.py Scan pipeline · api.py REST endpoints · App.jsx Dashboard app · client.js API client
Components 25
Web experience
- Dashboard app
frontend/src/App.jsx - Scan workspace
frontend/src/pages/ComplianceScanPage.jsx - Scan inputs
frontend/src/components/ScanPanel.jsx - Scan history
frontend/src/pages/CatalogHistoryPage.jsx - Rules view
frontend/src/pages/RulesPage.jsx - API client
frontend/src/api/client.js
API and orchestration
- REST endpoints
backend/app/routes/api.py - Flask application
backend/app/main.py - Scan pipeline
backend/app/services/pipeline.py - Demo samples
backend/app/services/samples.py
Scan analysis
- Page collection
backend/app/services/scraper.py - Image OCR
backend/app/services/ocr_service.py - Regex extraction
backend/app/field_extractor/extractors.py - NER extraction
backend/app/field_extractor/ner_extractor.py - Field merging
backend/app/field_extractor/merge.py - Field evidence model
backend/app/field_extractor/models.py - Rule evaluation
backend/app/services/rules.py - Rule definitions
frontend/src/data/rulesData.js
Records and review
- Scan database
backend/app/services/storage.py - Report generation
backend/app/services/reports.py
DemoMart
- Demo catalog
backend/app/demo_store/catalog.py - Paraphrased listings
backend/app/demo_store/regex_blind.py - Storefront rendering
backend/app/demo_store/render.py
Other components
- Reviewer
- Product website
Connections 27
- Reviewer → Dashboard app: uses
README.md - Dashboard app → Scan workspace: shows
frontend/src/App.jsx - Dashboard app → Scan history: shows
frontend/src/App.jsx - Dashboard app → Rules view: shows
frontend/src/App.jsx - Scan workspace → Scan inputs: renders
frontend/src/pages/ComplianceScanPage.jsx - Dashboard app → API client: calls
frontend/src/App.jsx - API client → REST endpoints: requests
README.md - REST endpoints → Scan pipeline: dispatches scans
backend/app/routes/api.py - Flask application → REST endpoints: registers
backend/app/main.py - Flask application → Storefront rendering: serves pages
backend/app/main.py - Storefront rendering → Demo catalog: renders products
backend/app/demo_store/render.py - Demo catalog → Paraphrased listings: includes listings
backend/app/demo_store/catalog.py - Scan pipeline → Page collection: collects page
backend/app/services/pipeline.py - Scan pipeline → Image OCR: extracts image text
backend/app/services/pipeline.py - Scan pipeline → Regex extraction: extracts fields
backend/app/services/pipeline.py - Scan pipeline → NER extraction: uses optional NER
backend/app/services/pipeline.py - Scan pipeline → Field merging: merges results
- Regex extraction → Field evidence model: returns fields
backend/app/field_extractor/extractors.py - Scan pipeline → Rule evaluation: evaluates fields
backend/app/services/pipeline.py - Scan pipeline → Scan database: saves scan
backend/app/services/pipeline.py - REST endpoints → Demo samples: lists samples
backend/app/routes/api.py - Demo samples → Demo catalog: builds samples
backend/app/services/samples.py - REST endpoints → Scan database: reads and reviews
backend/app/routes/api.py - REST endpoints → Report generation: generates reports
backend/app/routes/api.py - Scan history → API client: loads history
- Rules view → Rule definitions: displays rules
frontend/src/pages/RulesPage.jsx - Product website → Page collection: provides listing
README.md