1. Current Gap
Laptops issued but not configured. No VAN ID assigned. No beneficiary data available locally. Field tracking cannot begin.
2. What We Need
Each laptop configured with its correct VAN ID, then synced with the central DB so local records are ready for offline field use.
End-to-End Flow:
| Define Van Structure -> Create VANs in central DB, Map Tab logins with VAN -> Allocate Beneficiaries to Vans -> Central DB (all ben) -> Down-sync (filter by vanid) -> Laptop Local DB (van-specific records) -> Field worker tracks beneficiaries |
|---|
3. Planning Steps:
Phase 1 - Define VAN Structure
Phase 2 - Central DB Setup
Phase 3 - Beneficiary Allocation
Phase 4 - Laptop Configuration & Down-sync
4. Tables Involved in VAN Setup and Sync
| Table | Purpose |
|---|---|
| m_van | VAN master records |
| m_uservanmapping | Maps user login to VAN |
| m_parkingplace | Area / Parking Place |
| m_servicepoint | Service Points |
| m_synctabledetail | Sync table configuration |
| m_providerservicemapping | State _ Service mapping |
| m_vanserialpointmap | VAN to village mapping |
| m_userparkingplacemap | User to Area mapping |
5. TB Clinical Tables - Verify Sync Columns (VanId, VanSerialNo, ParkingPlaceID, Processed, SyncedBy, SyncedDate, SyncFailureReason, LastModDate, LastModBy)
6. New columns to track per-record down-sync delivery
Central DB (Add to each table which involved in downsync):
| Column | Type | Default | Purpose |
|---|---|---|---|
| DownSynced | char(1) | 'N' | 'N' : Never Sent 'P' : Processed (downsynced) 'F' : Failed 'U' : Update Pending re-sync |
| DownSyncDate | datetime | Null | When last successfully delivered to local |
| DownSyncFailureReason | varchar(255) | Null | Failure detail if 'F' |
Local DB:
| Column | Type | Default | Purpose |
|---|---|---|---|
| LastDownSyncDate | datetime | Null | When this specific record was last received from central - the reference point for conflict / update detection |
Note: Processed = 'F' + SyncFailureReason : Carries all required information
Any edits on the record resets Processed back to 'N' - same as a new record.
LastDownSyncDate provides the conflict detection reference during up-sync.
7. Down-Sync Order - FK Dependency Chain
Records must arrive on the laptop in this order:
Master / Reference Data
Beneficiary Root Tables
Then all transactional / clinical tables
Note: The down-sync query for each transactional table is simply SELECT * FROM {table} WHERE VanID = {vanID}
Conflict Handling Desing:
Master Table Conflicts:
Master / reference tables are central-authoritative. Local never edits them, so no conflict handling is required for those tables.
Overview:
After initial down-sync, two types of edits can happen simultaneously:
Any record edited in the central after down-synced is automatically flagged for re-down-sync.
Any local edit always resets Processed back to 'N'. 'N' covers both new records and records edited after a previous sync.
Key Actions on Each Event:
| Event | Columns Changed |
|---|---|
| New record created in central | Central: DownSynced='N' |
| Record edited in central (was 'P') | Central: DownSynced='U', LastModDate=Now() |
| Down-Sync success | Central: DownSynced='P', DownSyncDate=Now() Local: LastDownSyncDate=Now() |
| Edits record in local | Local: Processed='N', LastModDate=Now() |
| Up-Sync Success | Local: Processed='P', SyncedDate=Now() Central: LastModDate, DownSynced='N' |
| Down-Sync Conflicts | Local: Processed='F', SyncFailureReason='CONFLICT_DOWNSYNC' Central: |