LogoVisionLog

Layer 4: Attendance

Attendance logging with timestamp management

The Attendance Layer handles attendance logging with timestamps and duplicate prevention.

Overview

  • Purpose: Log attendance records with proper timestamps
  • Components: AttendanceTracker, PostgreSQL Logger
  • Output: PostgreSQL attendance records

Timestamp Management

The system uses server/system time for consistent timestamp recording.

FeatureDescription
System TimeUse server time for reliable timestamps
UTC StorageStore in UTC for consistency
Timezone DisplayConvert to local timezone for display

Attendance Logger

Data Structure

FieldTypeDescription
Person IDUUIDIdentified person
TimestampDateTimeAttendance time
Camera IDStringSource camera
ConfidenceFloatRecognition confidence (0-1)
Snapshot PathStringPath to face snapshot (optional)

Logger Functions

FunctionDescription
Log AttendanceCreate new attendance record in PostgreSQL
Check DuplicateQuery database for existing entry
Save SnapshotStore face image for verification
Query RecordsRetrieve attendance data from database

Duplicate Prevention

The logger checks for existing entries before creating new records:

  • Prevents multiple entries for the same person on the same day
  • Returns null if duplicate detected

Snapshot Storage

Optional face snapshots can be saved for:

  • Visual verification
  • Audit trail
  • Debugging recognition issues

Complete Pipeline

The attendance layer processes recognition results through these steps:

  1. Receive Recognition Result - Get matched person from recognition layer
  2. Get Timestamp - Record current system time
  3. Check Duplicates - Verify no existing entry
  4. Save Snapshot - Store face image if provided
  5. Create Record - Insert attendance entry into PostgreSQL
  6. Return Result - Confirm successful logging

Integration

The attendance layer receives input from the Recognition layer and outputs to the Storage layer:

InputOutput
Recognition result (person ID, confidence)Attendance record
Camera IDLog entry
Face image (optional)Snapshot file

On this page