---
title: "7. How Attendance is Recorded"
space: "CAMS Biometric Integration"
url: "https://docs.navari.co.ke/cams-biometric/how-attendance-is-recorded"
updated: "2026-05-27"
---

## How Attendance Is Recorded

### 7.0 Real-Time Flow

When an employee punches the biometric device:

1. The device sends the event to the CAMS Gateway
2. CAMS Gateway immediately POSTs the normalised JSON payload to your Callback URL
3. The `attendance()` function in `cams_call.py` receives the request
4. The payload JSON is parsed. The function detects whether it is a `RealTime` callback or a `PunchLog` batch
5. `handle_attendance_log()` is called for real-time punches
6. The `UserId` from the payload is looked up against the `attendance_device_id` field across all Employee records (via direct DB query, bypassing permission checks safely)
7. If a match is found, an **Employee Checkin** document is created with:
  - `employee`: the matched employee name
  - `time`: parsed from `LogTime` in the payload
  - `custom_original_time`: the unmodified original timestamp, preserved even if the timezone setting changes later
  - `shift`: the employee's currently active shift assignment
  - `log_type`: derived from the punch type (IN or OUT)
8. `update_last_sync_time()` is called to update the shift assignment's last sync timestamp
9. 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.