How praveen0e/packsure-ai works
PackSure AI is a role-based Legal Metrology inspection and decision-support application. Inspectors submit product images through the React app; backend inspection analysis checks image quality, extracts text and declaration fields, evaluates applicable rules, and stores findings for officer review and PDF reporting. The graph includes documented administration, assignments, targets, audit, notification, and AI-assistance capabilities alongside the primary workflow. Several route implementations are unsampled, so those links rely only on README documentation; no unverified service calls are asserted.
Main entry points: router.py REST API routes · analysis_service.py Analysis orchestrator · App.tsx Role-based workspace · api.ts API client
Components 29
Web application
- Role-based workspace
frontend/src/App.tsx - Image capture
frontend/src/pages/ScanPage.tsx - Image manager
frontend/src/components/ImageManager.tsx - Inspection review
frontend/src/pages/InspectionDetailPage.tsx - API client
frontend/src/services/api.ts
API and identity
- REST API routes
backend/app/api/router.py - Authentication
backend/app/api/routes/auth.py - Inspection endpoints
backend/app/api/routes/inspections.py - Product endpoints
backend/app/api/routes/products.py - Rule endpoints
backend/app/api/routes/rules.py
Inspection analysis
- Analysis orchestrator
backend/app/services/analysis_service.py - Image quality processing
backend/app/ocr/image_processor.py - Text recognition
backend/app/ocr/ocr_engine.py - Declaration extraction
backend/app/ocr/universal_extractor.py
Compliance decisions
- Rule evaluation
backend/app/rules/rule_engine.py - Rule records
backend/app/models/rule.py - Inspection and evidence records
backend/app/models/inspection.py - PostgreSQL access
backend/app/database/__init__.py
Review and operations
- PDF report generation
backend/app/reports/report_generator.py - Report endpoints
backend/app/api/routes/reports.py - Admin and user management
backend/app/api/routes/admin.py - Assignments and targets
backend/app/api/routes/assignments.py - Officer targets
backend/app/api/routes/targets.py - Audit trail
backend/app/api/routes/audit.py - Notifications
backend/app/api/routes/notifications.py - AI assistance
backend/app/api/routes/ai.py
Other components
- Inspector
- Enforcement officer
- Groq AI service
Connections 33
- Inspector → Role-based workspace: uses
README.md - Enforcement officer → Role-based workspace: reviews
README.md - Role-based workspace → Image capture: routes to
frontend/src/App.tsx - Role-based workspace → Inspection review: routes to
frontend/src/App.tsx - Image capture → Image manager: renders
frontend/src/pages/ScanPage.tsx - Image capture → API client: submits via
frontend/src/services/api.ts - Image manager → API client: uploads via
frontend/src/components/ImageManager.tsx - Inspection review → API client: fetches via
frontend/src/pages/InspectionDetailPage.tsx - API client → REST API routes: calls REST
README.md - REST API routes → Authentication: registers
backend/app/api/router.py - REST API routes → Inspection endpoints: registers
backend/app/api/router.py - REST API routes → Product endpoints: registers
backend/app/api/router.py - REST API routes → Rule endpoints: registers
backend/app/api/router.py - REST API routes → Report endpoints: registers
backend/app/api/router.py - REST API routes → Admin and user management: registers
backend/app/api/router.py - REST API routes → Assignments and targets: registers
backend/app/api/router.py - REST API routes → Officer targets: registers
backend/app/api/router.py - REST API routes → Audit trail: registers
backend/app/api/router.py - REST API routes → Notifications: registers
backend/app/api/router.py - REST API routes → AI assistance: registers
backend/app/api/router.py - Inspection endpoints → Analysis orchestrator: starts analysis
README.md - Analysis orchestrator → Image quality processing: checks quality
backend/app/services/analysis_service.py - Analysis orchestrator → Text recognition: recognizes text
backend/app/services/analysis_service.py - Analysis orchestrator → Declaration extraction: extracts fields
backend/app/services/analysis_service.py - Analysis orchestrator → Rule evaluation: evaluates findings
backend/app/services/analysis_service.py - Rule evaluation → Rule records: loads rules
backend/app/rules/rule_engine.py - Analysis orchestrator → Inspection and evidence records: persists results
backend/app/services/analysis_service.py - Rule evaluation → Inspection and evidence records: records findings
README.md - Inspection and evidence records → PostgreSQL access: maps to
backend/app/models/inspection.py - Rule records → PostgreSQL access: maps to
backend/app/models/rule.py - Report endpoints → PDF report generation: generates PDF
README.md - Report endpoints → Inspection and evidence records: reads inspection
README.md - AI assistance → Groq AI service: optional integration