Field Staff Tracking
The Field Staff Tracking module provides real-time GPS-based monitoring of field employees — from check-in to check-out. It captures location waypoints, geo-tagged photos, and integrates tightly with the attendance system to ensure accountability and approval workflows.
System Architecture
Core Components
| Component | Technology | Purpose |
|---|---|---|
| Mobile App | Flutter | GPS capture, check-in/out, photo upload |
| SiteVisitGPSAPIController | ASP.NET WebAPI | Check-in, check-out, location, image endpoints |
| AttendanceAPIController | ASP.NET WebAPI | Approval list, approval save, restriction checks |
| MobileAttendanceController | ASP.NET MVC | Web-based approval UI with map view |
| AttendancePostService | Windows Service + Quartz.NET | Background punch processing every 30 seconds |
| Core API (Go) | Go HTTP | Modern GPS list endpoint with filtering |
| GeoLocationBO | C# + Google Maps API | Reverse geocoding for lat/long to address |
| Admin Portal | Next.js | GPS record listing, approval, map visualization |
Data Flow Summary
| Stage | Action | Storage |
|---|---|---|
| Check-In | Staff opens duty with GPS coordinates | t_SiteVisit_GPS (start fields) |
| Location Stream | Continuous GPS waypoints sent from app | t_SiteVisit_GPS_Detail |
| Photo Capture | Geo-tagged images uploaded as base64 | t_SiteVisit_GPS_Images |
| Check-Out | Staff closes duty with end coordinates | t_SiteVisit_GPS (end fields) |
| Punch Processing | Background job posts to attendance | EmpDailyAttendance |
| Approval | Manager reviews and approves/rejects | t_SiteVisit_GPS (approval fields) |
Key Business Rules
| Rule | Detail |
|---|---|
| Pending Task Check | On check-in, 6 pending task types are counted — if any exist, attendance is conditional |
| 20-Minute Grace | Staff gets 20 minutes to clear pending tasks before attendance is finalized |
| Purpose Remapping | "New Business CP" remapped to "Follow Up CP"; "Conversion CP" to "Booking CP" |
| Role-Based View | RoleLevel 6 and above see team GPS records; below see only own records |
| Location Service Status | App reports GPS on/off, WiFi, battery percentage, signal strength |
| Continuous Tracking | Location captured only while a mobile attendance session is open (OutDateAndTime is null) |
Configuration
| Setting | Value | Description |
|---|---|---|
| GoogleAPIKey | App config | Used for reverse geocoding via Google Maps API |
| Punch Cron | 0/30 * 7-23 * * ? | Every 30 seconds, 7 AM to 11 PM |
| Nearby Search Radius | 50 meters | Google Places API radius for location name |
| Location Type Filter | premise, point_of_interest | Preferred geocoding result types |