How ujwaltikhe/udtc works
This repository implements a digital field companion for presumptive drug testing: an officer captures and analyzes a reagent-card image, confirms a result, and preserves it as signed, tamper-evident evidence for later synchronization and legal export. The Flutter app is the field-facing product; a FastAPI service supports central records, audit, staged uploads, Merkle batching, SMS anchors, and exports. The sampled files establish backend and security behavior, but not most Flutter call wiring, so uncertain screen-to-service connections are omitted.
Main entry points: main.dart Field app · field_record_repository.dart Record repository · server.py Sync API · test_analysis_screen.dart Test analysis
Components 21
Field Testing
- Field app
mobile_app/lib/main.dart - Image capture
mobile_app/lib/screens/camera_capture_screen.dart - Kit selection
mobile_app/lib/screens/kit_selection_screen.dart - Test analysis
mobile_app/lib/screens/test_analysis_screen.dart - Reaction timing
mobile_app/lib/screens/reaction_timer_screen.dart - Colorimeter engine
engine/colorimeter.py - Reference card
card_assets/generate_card.py - Record confirmation
mobile_app/lib/screens/record_confirm_screen.dart
Evidence Integrity
- Record repository
mobile_app/lib/repositories/field_record_repository.dart - Dual signer
security/crypto_signer.py - Local hash ledger
security/hash_ledger.py - Location service
mobile_app/lib/services/location_service.dart - Legal exports
security/legal_forensics.py
Sync and Review
- Staged sync
mobile_app/lib/services/staged_sync_service.dart - Sync API
backend/server.py - Server records
backend/server_vault.db - SMS anchor gateway
sync_mesh/sms_anchor.py - Android SMS bridge
mobile_app/android/app/src/main/kotlin/gov/ncb/fieldtesting/MainActivity.kt
Demonstration
- Demo console
demo_suite/app.py
Other components
- Field officer
- GSM network
Connections 19
- Field officer → Field app: uses
- Field app → Image capture: opens capture
- Field app → Kit selection: selects kit
- Field app → Test analysis: reviews analysis
- Test analysis → Colorimeter engine: analyzes image
- Colorimeter engine → Reference card: uses card layout
- Field app → Reaction timing: times reaction
- Field app → Record confirmation: confirms record
- Record confirmation → Record repository: saves record
- Record repository → Dual signer: requests signatures
- Record repository → Local hash ledger: writes record
- Record repository → Location service: uses location
- Field app → Staged sync: starts sync
- Staged sync → Sync API: uploads stages
- Sync API → Server records: stores records
- Sync API → SMS anchor gateway: records inbound SMS
- Android SMS bridge → GSM network: sends SMS
- Sync API → Legal exports: generates exports
- Field officer → Demo console: evaluates demo