How magnat12/msm works
This is a Django shift-management backend: Hikvision access events are fetched and parsed, matched to employee schedules, and saved as daily work records; completed shifts move to history and can be exported to Excel. A separate Telegram bot can trigger scheduled web requests and download a report. The graph follows the documented sync command and sampled integrations; view and model internals were not sampled, and the bot’s /test/ report URL does not match the documented /excel/ route.
Main entry points: main.py Telegram bot · views.py HTTP views · sync_hikvision.py Sync command · models.py Attendance records
Components 14
Event acquisition
- Event fetch and parse
msaproject/hik/services/getevent.py - Sync command
msaproject/hik/management/commands/sync_hikvision.py
Shift processing
- Attendance matching
msaproject/hik/services/attendance.py - Attendance records
msaproject/hik/models.py - History transition
msaproject/hik/signals.py - Application database
msaproject/msa/settings.py
Reports and bot
- Excel export
msaproject/hik/services/excel.py - Telegram bot
bot/main.py - Report download
bot/report.py
Django platform
- HTTP views
msaproject/hik/views.py - URL routing
msaproject/msa/urls.py
Other components
- Operator
- Hikvision device
- Telegram user
Connections 16
- Operator → Sync command: runs sync
- Sync command → Event fetch and parse: fetches events
- Event fetch and parse → Hikvision device: requests events
- Sync command → Attendance matching: passes reports
- Attendance matching → Attendance records: creates or updates
- Attendance records → Application database: persists records
- Attendance records → History transition: post-save signal
- History transition → Application database: archives shifts
- URL routing → HTTP views: routes requests
- HTTP views → Excel export: exports report
- Excel export → Application database: reads history
- Telegram user → Telegram bot: sends commands
- Telegram bot → HTTP views: requests HTTP endpoints
- Telegram bot → Report download: downloads report
- Report download → HTTP views: requests report URL
- Telegram bot → Telegram user: sends report