How arsalanqasim/cod-guard works
COD-Guard is a local COD-order risk and verification demo, with an optional authenticated shadow-intake API. The main user workflow is to review an order queue and risk assessment, verify a customer reply (including Urdu voice transcription), record the delivery outcome, and inspect or retrain from marked outcomes. Separate branches cover storefront/social intake, WhatsApp messaging, public benchmark and savings metrics, and consent-scoped reputation counts. The dashboard and API share transactional SQLite state. The README documents capabilities beyond the sampled excerpts; their internal wiring is shown only where the README or source index supports it.
Main entry points: dashboard.py Demo dashboard · main.py HTTP API · service.py Order queue · risk_engine.py Risk policy
Components 24
Operator experience
- Demo dashboard
frontend/dashboard.py - HTTP API
backend/app/main.py - Order queue
backend/app/service.py - WhatsApp routes
backend/app/whatsapp_routes.py - WhatsApp Cloud
backend/app/whatsapp_cloud.py - Network routes
backend/app/network_routes.py
Risk and verification
- Risk policy
backend/app/risk_engine.py - Reply verification
backend/app/verification.py - Urdu voice transcription
backend/app/verification.py
Order intake
- Order intake
backend/app/order_intake.py - Storefront reconciliation
backend/app/connector_orders.py - WooCommerce connector
backend/app/woocommerce.py - Shopify intake
backend/app/shopify_routes.py - Daraz connector
backend/app/daraz.py - Social intake
backend/app/social_routes.py
Learning and metrics
- Courier outcomes
backend/app/courier_outcomes.py - Model training
backend/app/train_model.py - Evaluation
backend/app/round2_evaluation.py - Public benchmark
backend/app/public_benchmark.py - Savings report
backend/app/savings_report.py
State and network
- Transactional state
backend/app/storage.py - SQLite records
backend/app/records.py - Reputation network
backend/app/reputation_network.py
Other components
- Operator
Connections 28
- Operator → Demo dashboard: uses
- Operator → HTTP API: uses
- Demo dashboard → Order queue: loads queue
frontend/dashboard.py - Order queue → Risk policy: assesses orders
backend/app/service.py - Order queue → Reply verification: applies replies
backend/app/service.py - Demo dashboard → Urdu voice transcription: transcribes notes
frontend/dashboard.py - Demo dashboard → Reply verification: applies transcript
frontend/dashboard.py - HTTP API → Order intake: routes intake
backend/app/main.py - Order intake → Risk policy: assesses orders
backend/app/order_intake.py - HTTP API → WooCommerce connector: registers routes
backend/app/main.py - WooCommerce connector → Storefront reconciliation: normalizes orders
backend/app/woocommerce.py - HTTP API → Shopify intake: registers routes
backend/app/main.py - Shopify intake → Storefront reconciliation: reconciles snapshots
backend/app/shopify_routes.py - HTTP API → Social intake: registers routes
backend/app/main.py - HTTP API → WhatsApp routes: registers routes
backend/app/main.py - WhatsApp routes → WhatsApp Cloud: sends verification
backend/app/whatsapp_routes.py - Demo dashboard → Courier outcomes: marks outcomes
- Courier outcomes → Reputation network: updates contributions
backend/app/courier_outcomes.py - Demo dashboard → Model training: requests retraining
- Model training → Risk policy: evaluates policy
backend/app/train_model.py - Demo dashboard → Public benchmark: shows metrics
frontend/dashboard.py - Demo dashboard → Savings report: shows savings
frontend/dashboard.py - Order queue → Transactional state: reads state
backend/app/service.py - Transactional state → SQLite records: persists records
backend/app/storage.py - HTTP API → Network routes: registers routes
backend/app/main.py - Network routes → Reputation network: queries counts
backend/app/network_routes.py - HTTP API → Daraz connector: optional connector
- Demo dashboard → Evaluation: shows evaluation