How yuvaraj4-s/visitor_management_system works
Purpose and runtime
This is a Frappe/ERPNext v15 application for visitor lifecycle management: invitation/pre-registration, pass approval, QR gate events, identity/blacklist checks, hospitality, room booking, and audit reporting. It runs as a Python Frappe app backed by MariaDB; ERPNext and HRMS provide dependent doctypes/services. App registration and runtime hooks enter through visitormanagement/hooks.py, with modules declared in visitormanagement/modules.txt.
Domain model and workflow boundary
Frappe DocType JSON defines persistent schema, Desk forms, permissions, and workflow-facing state; Python controllers enforce server-side lifecycle rules, while JS supplies Desk interactions. Core records are Visitor Pass, Invitation, Security Log, Blacklist, Contact Trace, and immutable event history:
• visitormanagement/visitor_management/doctype/visitor_pass/visitor_pass.py
• visitormanagement/visitor_management/doctype/security_log/security_log.py
• visitormanagement/visitor_management/doctype/visitor_invitation/visitor_invitation.py
Preloaded roles and approval state machines are migration fixtures, rather than custom workflow code:
• visitormanagement/fixtures/workflow.json
• visitormanagement/fixtures/workflow_transition.json
• visitormanagement/fixtures/role.json
Pre-visit intake and pass orchestration
Hosts create invitations or reception creates passes. Invitation tokens drive the public pre-registration surface; submitted data creates/updates a Visitor Pass, whose visitor type selects an approval lane. Pass approval is the orchestration boundary that produces QR-ready access and conditional downstream services.
• visitormanagement/visitor_management/web_form/visitor_pre_registration_form/visitor_pre_registration_form.py
• visitormanagement/www/visitor_pre_registration.py
• visitormanagement/visitor_management/doctype/visitor_pass/visitor_pass.py
Portal/web entry behavior is separated from authenticated Desk UI, with client behavior in visitormanagement/visitor_management/web_form/visitor_pre_registration_form/visitor_pre_registration_form.js.
Gate security and audit lifecycle
Gate operations create Security Log events from a QR/pass lookup, require live-photo and identity confirmations for entry/exit, recheck active blacklist status, and transition the pass between checked-in and checked-out. These events open/close contact-tracing records and preserve immutable security/event audit trails.
• visitormanagement/visitor_management/api/visitor_gate.py
• visitormanagement/visitor_management/doctype/security_log/security_log.py
• visitormanagement/visitor_management/doctype/contact_trace_record/contact_trace_record.py
Blacklist matching and policy validation sit in the visitor domain:
• visitormanagement/visitor_management/doctype/visitor_blacklist/visitor_blacklist.py
• visitormanagement/visitor_management/validators.py
• visitormanagement/visitor_management/lifecycle.py
Hospitality and room-booking projections
Approved passes with hospitality selections create Hospitality Requests; selected rooms create Conference Room Bookings. These are separate approval workflows, allowing operational teams to execute services independently from security access. Booking validates room capacity and operating windows.
• visitormanagement/visitor_management/doctype/hospitality_request/hospitality_request.py
• visitormanagement/conference_room/doctype/conference_room_booking/conference_room_booking.py
• visitormanagement/conference_room/doctype/conference_room/conference_room.py
Notifications, scheduling, and presentation
Frappe notifications deliver approval, host, VIP, gate-security, and service alerts through configured site email. Background tasks handle scheduled lifecycle work such as pending-pass handling.
• visitormanagement/visitor_management/tasks.py
• visitormanagement/visitor_management/notification/gate_security_alert/gate_security_alert.py
• visitormanagement/visitor_management/notification/vms_approval_email/vms_approval_email.py
Desk workspaces, dashboards, reports, number cards, calendars, and print formats are read-model/UI projections over the same DocType data:
• visitormanagement/visitor_management/report/active_visitors/active_visitors.py
• visitormanagement/conference_room/report/room_utilization/room_utilization.py
• visitormanagement/visitor_management/print_format/visitor_badge/visitor_badge.html
Installation evolution
Schema/data evolution is performed through Frappe patches listed in visitormanagement/patches.txt; post-model-sync patches backfill data, synchronize workflow/notification fixtures, and update roles/settings. This is the principal upgrade boundary.
• visitormanagement/patches.txt
• visitormanagement/patches/post_model_sync/sync_visitor_pass_workflow.py
• visitormanagement/patches/post_model_sync/backfill_visitor_summary.py
Main entry points: visitor_pass.py Visitor Pass · visitor_gate.py QR gate operations · security_log.py Security Log · hooks.py App hooks
Components 17
Frappe Runtime
- App hooks · Registers runtime integration and scheduled behavior.
visitormanagement/hooks.py - MariaDB DocType data · Frappe-managed persistent records, permissions, and workflow state.
- ERPNext & HRMS · Provide dependent doctypes and services.
Visitor Lifecycle
- Visitor Invitation · Host-created invitation and token source.
visitormanagement/visitor_management/doctype/visitor_invitation/visitor_invitation.py - Public pre-registration · Token-driven unauthenticated visitor intake.
visitormanagement/visitor_management/web_form/visitor_pre_registration_form/visitor_pre_registration_form.py - Visitor Pass · Approval and access orchestration boundary.
visitormanagement/visitor_management/doctype/visitor_pass/visitor_pass.py - Roles & approval workflows · Preloaded roles, states, and transitions.
visitormanagement/fixtures/workflow.json - Blacklist & lifecycle policy · Matches blacklist records and enforces lifecycle rules.
visitormanagement/visitor_management/doctype/visitor_blacklist/visitor_blacklist.py
Operations
- QR gate operations · Looks up passes and records verified entry or exit.
visitormanagement/visitor_management/api/visitor_gate.py - Security Log · Preserves gate audit events and confirmations.
visitormanagement/visitor_management/doctype/security_log/security_log.py - Contact Trace Record · Opened and closed from gate lifecycle events.
visitormanagement/visitor_management/doctype/contact_trace_record/contact_trace_record.py - Hospitality Request · Independently approved hospitality execution.
visitormanagement/visitor_management/doctype/hospitality_request/hospitality_request.py - Conference Room Booking · Validates capacity and operating windows.
visitormanagement/conference_room/doctype/conference_room_booking/conference_room_booking.py - Notifications · Configured email alerts for approval, gate, VIP, and services.
visitormanagement/visitor_management/notification/gate_security_alert/gate_security_alert.py - Scheduled lifecycle tasks · Handles pending-pass and scheduled lifecycle work.
visitormanagement/visitor_management/tasks.py
Upgrade & Presentation
- Desk reports & badge · Reports, dashboards, calendars, and print projections.
visitormanagement/visitor_management/report/active_visitors/active_visitors.py - Schema and data patches · Post-sync backfills and fixture synchronization define upgrades.
visitormanagement/patches.txt
Connections 22
- App hooks → Scheduled lifecycle tasks: schedules
- App hooks → MariaDB DocType data: runs on
- ERPNext & HRMS → MariaDB DocType data: shares
- Visitor Invitation → Public pre-registration: issues token for
- Public pre-registration → Visitor Pass: creates or updates
- Visitor Pass → Roles & approval workflows: uses approval states
- Visitor Pass → Blacklist & lifecycle policy: validates against
- Visitor Pass → Hospitality Request: projects selected services
- Visitor Pass → Conference Room Booking: projects selected rooms
- Visitor Pass → Notifications: triggers alerts
- QR gate operations → Visitor Pass: looks up and transitions
- QR gate operations → Blacklist & lifecycle policy: rechecks blacklist
- QR gate operations → Security Log: creates
- Security Log → Contact Trace Record: opens or closes
- Visitor Pass → MariaDB DocType data: persists
- Security Log → MariaDB DocType data: persists audit trail
- Hospitality Request → MariaDB DocType data: persists
- Conference Room Booking → MariaDB DocType data: persists
- Desk reports & badge → MariaDB DocType data: reads
- Scheduled lifecycle tasks → Visitor Pass: processes pending passes
- Schema and data patches → MariaDB DocType data: evolves schema and data
- Schema and data patches → Roles & approval workflows: synchronizes