7. How Attendance is Recorded
How Attendance Is Recorded
7.0 Real-Time Flow
When an employee punches the biometric device:
- The device sends the event to the CAMS Gateway
- CAMS Gateway immediately POSTs the normalised JSON payload to your Callback URL
- The
attendance()function incams_call.pyreceives the request - The payload JSON is parsed. The function detects whether it is a
RealTimecallback or aPunchLogbatch handle_attendance_log()is called for real-time punches- The
UserIdfrom the payload is looked up against theattendance_device_idfield across all Employee records (via direct DB query, bypassing permission checks safely) - If a match is found, an Employee Checkin document is created with:
employee: the matched employee nametime: parsed fromLogTimein the payloadcustom_original_time: the unmodified original timestamp, preserved even if the timezone setting changes latershift: the employee's currently active shift assignmentlog_type: derived from the punch type (IN or OUT)
update_last_sync_time()is called to update the shift assignment's last sync timestamp- The app returns
{"status": "done"}with HTTP 200 to CAMS
7.1 Employee Check-in to Attendance
FrappeHR's native attendance processing then takes over. Based on shift rules, the Employee Checkin records are processed into Attendance records (Present / Absent / Half Day / etc.) either automatically via scheduled jobs or manually using the Process Attendance tool.
Last updated 4 days ago
Was this helpful?