How abhilash1401/attendance-ai works
Purpose and Runtime
Attendance AI is a Python 3.10+ terminal application for NRCM students. It authenticates against the NRCM student portal, retrieves and analyzes semester attendance, and offers attendance-planning actions around a 75% target. The executable entry point is main.py; dependencies are declared in requirements.txt.
Application Orchestration
main.py owns the interactive lifecycle: credential prompts, login, initial data retrieval, menu dispatch, refresh, history access, database clearing, and exit. It coordinates portal access, parsing, calculation, and persistence rather than exposing an HTTP or GUI interface.
• main.py
• config.py
NRCM Portal Boundary
Portal-specific network/session behavior is isolated in nrcm_portal.py. This is the external-service boundary: runtime roll number/password are used to authenticate and request student and attendance pages. Portal URLs and attendance-related constants belong in config.py, keeping the rest of the application tied to normalized data rather than request details.
• nrcm_portal.py
• config.py
Data Extraction Pipeline
Raw portal responses flow through separate parsers: student identity/details are extracted by student_parser.py, while semester attendance records are extracted by attendance_parser.py. These modules form the adaptation layer most likely to require changes if NRCM changes its HTML/page structure.
• student_parser.py
• attendance_parser.py
• nrcm_portal.py
Attendance Analysis and Planning
calculator.py converts parsed attendance totals into user-facing decisions: current percentage, safe classes that can be bunked while retaining 75%, classes required to reach 75%, and a next-day attendance plan. main.py invokes these calculations for the corresponding menu actions.
• calculator.py
• main.py
• config.py
Refresh and State Flow
At startup and on “Refresh Attendance,” main.py reuses the portal integration and parsing pipeline to obtain current portal data, then feeds the refreshed records into calculation and history flows. Passwords are runtime-only by design; the application’s durable state is attendance history rather than portal credentials.
• main.py
• nrcm_portal.py
• attendance_parser.py
Local Persistence
history.py manages local SQLite attendance-history storage. The application automatically creates and uses attendance_history.db, enabling historical views and a menu operation to clear stored records. This database is the primary local infrastructure boundary and should be treated as sensitive student data.
• history.py
• main.py
Main entry points: nrcm_portal.py Portal session client · main.py Interactive lifecycle · calculator.py 75% planning calculator · history.py History repository
Components 12
Terminal Application
- Interactive lifecycle · Prompts, dispatches menu actions, refreshes data, and exits.
main.py - Portal settings · Centralizes portal URLs and attendance constants.
config.py - Runtime credentials · Roll number and password are not persisted.
Portal Integration
- NRCM student portal
- Portal session client · Authenticates and retrieves student and attendance pages.
nrcm_portal.py - Student details parser
student_parser.py - Attendance parser · Converts portal attendance pages into semester records.
attendance_parser.py - Student profile
Attendance Analysis
- Current attendance · Refreshed semester attendance totals.
- 75% planning calculator · Computes percentage, bunk allowance, required classes, and next-day plan.
calculator.py
Local History
Sensitive student attendance data.
- History repository · Stores, reads, and clears attendance snapshots.
history.py - Attendance history
Connections 14
- Runtime credentials → Interactive lifecycle: prompted input
- Interactive lifecycle → Portal session client: login and refresh
- Portal settings → Portal session client: URLs and constants
- Portal session client → NRCM student portal: authenticate and fetch pages
- Portal session client → Student details parser: student page
- Portal session client → Attendance parser: attendance page
- Student details parser → Student profile: extract
- Attendance parser → Current attendance: extract
- Current attendance → 75% planning calculator: attendance totals
- Portal settings → 75% planning calculator: 75% target
- 75% planning calculator → Interactive lifecycle: menu results and plan
- Current attendance → History repository: record refresh
- Interactive lifecycle → History repository: view or clear history
- History repository → Attendance history: read, write, clear