Skip to content

JOYBOY-3/A.R.I.S.E

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

50 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Flask Python SQLite ESP32 Chart.js Render

A.R.I.S.E. β€” Automated Resilient Intelligent Student Attendance Ecosystem

A full-stack, hybrid (offline + online), biometric-enabled attendance management system built for educational institutions β€” runs from a USB pendrive locally and syncs to the cloud.


πŸ“‹ Table of Contents


πŸ” Overview

A.R.I.S.E. is designed for institutions that need a portable, reliable attendance system. The core server runs from a USB pendrive on any computer in the classroom β€” no internet required for daily use. When internet is available, it automatically syncs to a cloud replica on Render.com, enabling:

  • Offline classes β†’ Biometric (ESP32 fingerprint) or manual attendance via the local server
  • Online classes β†’ OTP-based attendance via the cloud server with a shareable link
  • Both records are merged on the cloud with zero data loss

Who uses it?

Role What they do
Admin Manages semesters, teachers, students, courses, enrollments. Views analytics dashboard
Teacher Starts sessions, monitors attendance in real-time, exports reports to Excel
Student Views personal attendance, course history, streak analytics, and leaderboard
ESP32 Scanner Marks biometric attendance via fingerprint scanning during offline sessions

πŸ— Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        A.R.I.S.E. Architecture                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                     β”‚
β”‚   LOCAL (USB Pendrive)                CLOUD (Render.com)            β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚   β”‚  Flask Server     │──── sync ────▢│  Flask Server     β”‚         β”‚
β”‚   β”‚  SQLite DB        β”‚   (auto 5m)   β”‚  SQLite DB        β”‚         β”‚
β”‚   β”‚  Port 5000        β”‚               β”‚  Port 443 (HTTPS) β”‚         β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β”‚          β”‚                                   β”‚                      β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚   β”‚ ESP32 Scanner     β”‚               β”‚ Online Attendance β”‚         β”‚
β”‚   β”‚ (Fingerprint)     β”‚               β”‚ (OTP via browser) β”‚         β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β”‚                                                                     β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                              β”‚
β”‚   β”‚ Admin / Teacher / β”‚   ← All web UIs work on both               β”‚
β”‚   β”‚ Student Portals   β”‚     local and cloud servers                 β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Sync Strategy: Smart Merge

The sync engine ensures no data loss between local and cloud:

  1. Local β†’ Cloud push: Local DB is the master for admin data (students, courses, etc.)
  2. Online records preserved: Before replacing the cloud DB, all online session records are extracted, the DB is replaced, then online records are re-inserted with remapped IDs
  3. Result: Cloud always has both online + offline attendance records

✨ Key Features

πŸŽ“ Admin Panel

  • Full CRUD management for semesters, teachers, students, courses
  • Course enrollment manager with drag-and-drop-style student assignment
  • Enrollment roster view by semester
  • Batch configuration (batch name, system settings)
  • Analytics dashboard with 4 sub-tabs:
    • Overview β€” 8 KPI cards + course-wise summary table
    • Course Analytics β€” Per-student attendance breakdown with status badges
    • Student Lookup β€” Cross-course attendance for any student
    • Trends β€” Chart.js charts: daily, day-of-week, online vs offline, course comparison
  • Cloud sync controls (manual push, status check)

πŸ‘¨β€πŸ« Teacher Dashboard

  • Start/end/extend attendance sessions for any assigned course
  • Real-time attendance monitoring β€” see who's present live
  • Manual override β€” mark individual students present/absent with reason
  • Emergency bulk mark β€” mark all enrolled students present at once
  • Session history with full session detail view
  • Excel export β€” download per-session attendance reports (.xlsx)
  • Course analytics β€” attendance trends and statistics per course
  • Online class mode β€” start online sessions with OTP-based verification (cloud only)
  • Device status monitoring for connected ESP32 scanners

πŸ‘©β€πŸŽ“ Student Portal

  • Personal dashboard with overall attendance percentage
  • Per-course breakdown with detailed session-by-session history
  • Critical alerts when attendance drops below threshold
  • Attendance streaks and leaderboard
  • Semester filter to view historical data
  • Visual analytics with attendance trends

🌐 Online Class Attendance

  • Teacher starts online session on cloud server β†’ gets a shareable link
  • Students open link in browser β†’ enter roll number + rotating OTP
  • OTP refreshes every 30 seconds preventing screenshot sharing
  • Teacher can also manually override online attendance
  • Available only on cloud server β€” local server redirects to cloud

πŸ“‘ ESP32 Smart Scanner

  • Fingerprint-based biometric attendance marking
  • Offline queue β€” stores marks locally when server is unreachable
  • Auto-flush β€” sends queued records when connection restores
  • Heartbeat β€” periodic health check with the server
  • Session-aware β€” only marks during active sessions

πŸ”„ Cloud Sync

  • Automatic sync every 5 minutes (configurable)
  • Smart merge β€” preserves online records, syncs offline records
  • Full binary snapshot via SQLite backup API for consistency
  • API key authentication between local and cloud
  • Status monitoring via /api/sync/status

πŸ›  Tech Stack

Layer Technology
Backend Python 3.10+, Flask 3.1, Gunicorn (production)
Database SQLite 3 (portable, zero-config)
Authentication JWT (PyJWT), bcrypt password hashing
Security Flask-Limiter (rate limiting), Flask-CORS
Frontend Vanilla HTML/CSS/JS (no frameworks β€” fast loading)
Charts Chart.js 4.x (admin analytics + student analytics)
Excel Export openpyxl
Scheduling APScheduler (session auto-expiry, sync)
IoT ESP32 + Adafruit Fingerprint sensor
Config python-dotenv (.env files)
Cloud Render.com (free tier compatible)

πŸ—„ Database Schema

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   admins     β”‚    β”‚  semesters   β”‚    β”‚   teachers   β”‚
│─────────────│    │─────────────│    │──────────────│
β”‚ id (PK)      β”‚    β”‚ id (PK)      β”‚    β”‚ id (PK)      β”‚
β”‚ username     β”‚    β”‚ semester_nameβ”‚    β”‚ teacher_name β”‚
β”‚ password     β”‚    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜    β”‚ pin          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚            β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚                   β”‚
                   β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
                   β”‚           courses                β”‚
                   │─────────────────────────────────│
                   β”‚ id (PK)                          β”‚
                   β”‚ semester_id (FK β†’ semesters)     β”‚
                   β”‚ teacher_id (FK β†’ teachers)       β”‚
                   β”‚ course_name, course_code          β”‚
                   β”‚ default_duration_minutes          β”‚
                   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                          β”‚                   β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚  enrollments β”‚         β”‚    sessions      β”‚
              │──────────────│         │─────────────────│
              β”‚ student_id   β”‚         β”‚ id (PK)          β”‚
              β”‚ course_id    β”‚         β”‚ course_id (FK)   β”‚
              β”‚ class_roll_idβ”‚         β”‚ start_time       β”‚
              β”‚ (PK: s_id,  β”‚         β”‚ end_time         β”‚
              β”‚  c_id)       β”‚         β”‚ is_active        β”‚
              β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚ session_type     β”‚
                     β”‚                 β”‚ topic, otp_seed  β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”         β”‚ session_token    β”‚
              β”‚   students   β”‚         β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              │──────────────│                β”‚
              β”‚ id (PK)      β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚ student_name β”‚    β”‚  attendance_records     β”‚
              β”‚ univ_roll_no β”‚    │────────────────────────│
              β”‚ enrollment_noβ”‚    β”‚ id (PK)                 β”‚
              β”‚ password     β”‚    β”‚ session_id (FK)         β”‚
              β”‚ email1,email2β”‚    β”‚ student_id (FK)         β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚ timestamp               β”‚
                                  β”‚ override_method         β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚ manual_reason           β”‚
              β”‚system_settingsβ”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              │──────────────│
              β”‚ key (PK)     β”‚
              β”‚ value        β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

9 tables total: admins, semesters, teachers, students, courses, enrollments, sessions, attendance_records, system_settings


πŸš€ Getting Started

Prerequisites

  • Python 3.10 or higher
  • pip (Python package manager)
  • Git

Installation

# 1. Clone the repository
git clone https://github.com/JOYBOY-3/A.R.I.S.E.git
cd A.R.I.S.E

# 2. Create and activate virtual environment
python -m venv venv

# Windows
.\venv\Scripts\activate

# Linux/macOS
source venv/bin/activate

# 3. Install dependencies
pip install -r requirements.txt

# 4. Set up environment variables
cp .env.example .env
# Edit .env with your settings (SECRET_KEY is auto-generated on first run)

# 5. Initialize the database
python database_setup.py

Running the Server

# Development
python server.py

# Production (with Gunicorn)
gunicorn wsgi:app --bind 0.0.0.0:5000

The server starts at http://localhost:5000/

Default Credentials

Role Login Page Username/ID Password/PIN
Admin /admin-login admin admin
Teacher / (main page) Course code dropdown Teacher PIN
Student /student University Roll No. Student password

⚠️ Change default credentials immediately after first login!


βš™οΈ Environment Variables

Copy .env.example to .env and configure:

# --- Security ---
SECRET_KEY=auto_generate_on_first_run    # Auto-generates on first launch

# --- Server ---
FLASK_ENV=development                     # development | production
HOST=0.0.0.0
PORT=5000

# --- Database ---
DATABASE_PATH=attendance.db

# --- Admin ---
ADMIN_DEFAULT_PASSWORD=admin              # Only used during database_setup.py

# --- Cloud Sync ---
CLOUD_SERVER_URL=https://your-app.onrender.com
SYNC_API_KEY=your-secret-sync-key
SYNC_INTERVAL_SECONDS=300                 # Auto-sync every 5 minutes (0=manual)

# --- Cloud Detection (auto-set by Render) ---
# IS_CLOUD_SERVER=true                    # Set on cloud, not on local
# RENDER=true                             # Auto-detected on Render.com

☁️ Deployment (Render Cloud)

Quick Deploy to Render

  1. Push code to GitHub

  2. Create a new Web Service on Render.com

  3. Connect your GitHub repo

  4. Configure:

    • Build Command: pip install -r requirements.txt
    • Start Command: gunicorn wsgi:app (or use the Procfile)
    • Environment: Python 3
  5. Set environment variables on Render dashboard:

Variable Value
SECRET_KEY (long random string)
FLASK_ENV production
SYNC_API_KEY (same key as local server)
IS_CLOUD_SERVER true
  1. On your local server's .env, set:
CLOUD_SERVER_URL=https://your-app.onrender.com
SYNC_API_KEY=same-key-as-cloud

Files for Deployment

File Purpose
Procfile Tells Render how to start the app
wsgi.py WSGI entry point for Gunicorn
render.yaml Render infrastructure-as-code config
requirements.txt Python dependencies

πŸ”„ Cloud Sync Engine

The sync engine (sync_engine.py) handles bidirectional data consistency:

How It Works

LOCAL (USB)                              CLOUD (Render)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Offline classes  β”‚                     β”‚ 1. Extract online    β”‚
β”‚ only in local DB │──── push ──────────▢│    records from DB   β”‚
β”‚                  β”‚    (full binary)     β”‚                      β”‚
β”‚ Master data:     β”‚                     β”‚ 2. Replace DB with   β”‚
β”‚ students,courses β”‚                     β”‚    local snapshot     β”‚
β”‚ teachers, etc.   β”‚                     β”‚                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                     β”‚ 3. Re-insert online  β”‚
                                        β”‚    records (remap IDs)β”‚
                                        β”‚                      β”‚
                                        β”‚ Result: BOTH online  β”‚
                                        β”‚ + offline records βœ…  β”‚
                                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Features

  • SQLite Backup API for consistent snapshots (no corruption risk)
  • Smart merge β€” online sessions are preserved through extractβ†’replaceβ†’re-insert
  • ID remapping β€” re-inserted sessions get new auto-increment IDs, attendance FK updated
  • Deduplication β€” checks (course_id, start_time, session_type) before inserting
  • Auto-sync every 300 seconds (configurable)
  • API key authentication on both ends

Sync API Endpoints

Endpoint Method Purpose
/api/sync/receive POST Cloud receives DB snapshot from local
/api/sync/push POST Local triggers manual push to cloud
/api/sync/status GET Check sync status (node type, DB size, cloud reachability)

πŸ“‘ API Reference

Health & Sync

Method Endpoint Auth Description
GET /api/health β€” Health check
GET /api/sync/status β€” Sync engine status
POST /api/sync/push JWT Trigger manual sync push
POST /api/sync/receive API Key Receive DB snapshot

Admin APIs

Method Endpoint Description
POST /api/admin/login Admin login (returns JWT)
GET/POST /api/admin/config Get/set batch name and system config
GET/POST /api/admin/semesters List/create semesters
PUT/DELETE /api/admin/semesters/:id Update/delete semester
GET/POST /api/admin/teachers List/create teachers
PUT/DELETE /api/admin/teachers/:id Update/delete teacher
GET/POST /api/admin/students List/create students
PUT/DELETE /api/admin/students/:id Update/delete student
GET/POST /api/admin/courses List/create courses
GET /api/admin/courses-view Courses with teacher/semester names
GET/PUT/DELETE /api/admin/courses/:id Get/update/delete course
GET/POST /api/admin/enrollments/:course_id View/save course enrollments
GET /api/admin/enrollment-roster/:semester_id Full enrollment roster

Admin Analytics APIs

Method Endpoint Description
GET /api/admin/analytics/overview KPIs, course summary, at-risk count
GET /api/admin/analytics/course/:id Per-student attendance for a course
GET /api/admin/analytics/student/:id Cross-course attendance for a student
GET /api/admin/analytics/trends Daily, weekly, online/offline trends

Teacher APIs

Method Endpoint Description
POST /api/teacher/login Teacher login with PIN
GET /api/teacher/course-codes List of available course codes
POST /api/teacher/start-session Start offline attendance session
POST /api/teacher/start-online-session Start online session (cloud only)
POST /api/teacher/manual-override Mark/unmark individual student
POST /api/teacher/emergency-bulk-mark Mark all students present
POST /api/teacher/session/:id/end End active session
POST /api/teacher/session/:id/extend Extend session duration
GET /api/teacher/session/:id/status Get session status
GET /api/teacher/session/:id/online-status Online session real-time status
GET /api/teacher/report/:id Session attendance report
GET /api/teacher/report/export/:id Download Excel report
GET /api/teacher/analytics/:course_id Course analytics
GET /api/teacher/history/:course_id Session history for course
GET /api/teacher/session-detail/:id Detailed session view
POST /api/teacher/update-attendance Update attendance records
GET /api/teacher/validate-session/:course_id Check for active sessions
GET /api/teacher/device-status ESP32 device status

Student APIs

Method Endpoint Description
POST /api/student/login Student login
GET /api/student/dashboard Personal attendance dashboard
GET /api/student/semesters Available semesters
GET /api/student/course/:course_id Per-course attendance detail
GET /api/student/analytics Personal analytics
GET /api/student/critical-alerts Low attendance alerts
GET /api/student/leaderboard Attendance leaderboard

Online Attendance APIs

Method Endpoint Description
GET /online/:token Online attendance page for students
GET /api/online/session/:token/info Session info for online page
POST /api/online/mark-attendance Mark attendance via OTP
GET /api/online/session/:token/otp Get current OTP (teacher only)

Device APIs (ESP32)

Method Endpoint Description
GET /api/session-status Check if any session is active
POST /api/mark-attendance-by-roll-id Mark attendance by class roll ID
POST /api/bulk-mark-attendance Bulk mark from device queue
POST /api/device/heartbeat Device health heartbeat

🌐 Online Class Attendance

Online attendance is available only on the cloud server. Here's the flow:

Teacher (Cloud)                    Student (Any Browser)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Start Online  β”‚                  β”‚ Open shared link     β”‚
β”‚ Session       │──── share URL ──▢│ /online/<token>      β”‚
β”‚               β”‚                  β”‚                      β”‚
β”‚ See OTP on    β”‚                  β”‚ Enter roll number    β”‚
β”‚ dashboard     β”‚                  β”‚ Enter OTP            β”‚
β”‚ (refreshes    β”‚                  β”‚ (30-sec rotation)    β”‚
β”‚  every 30s)   β”‚                  β”‚                      β”‚
β”‚               β”‚                  β”‚ βœ… Marked Present    β”‚
β”‚ Manual overrideβ”‚                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ available     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Security Features

  • Token-based session URLs β€” unique per session
  • Rotating OTP β€” changes every 30 seconds, prevents screenshot sharing
  • One mark per student β€” duplicate submissions are rejected
  • Manual override β€” teacher can mark/unmark any student

πŸ“‘ ESP32 Smart Scanner

Located in FirmwareCodeOfEsp32/sketch_oct8a/.

Setup

  1. Install Arduino IDE or PlatformIO
  2. Install required libraries:
    • Adafruit Fingerprint Sensor Library
    • ArduinoJson
    • WiFi (built-in for ESP32)
  3. Configure Wi-Fi SSID/password and server IP in the firmware
  4. Upload to ESP32

How It Works

  1. Teacher starts a session on the server
  2. ESP32 detects active session via /api/session-status
  3. Student places finger on scanner
  4. ESP32 reads fingerprint β†’ maps to class roll ID
  5. POSTs to /api/mark-attendance-by-roll-id
  6. If server is unreachable β†’ queues locally
  7. On reconnection β†’ flushes queue via /api/bulk-mark-attendance
  8. Periodic heartbeat to /api/device/heartbeat

πŸ“Š Admin Analytics Dashboard

The admin analytics section provides batch coordinators with deep insights:

Overview Tab

  • 8 KPI cards: Total Students, Courses, Sessions, Overall Attendance %, At-Risk Students, Online Sessions, This Week Activity, Avg per Session
  • Course-wise summary table with color-coded attendance percentages

Course Analytics Tab

  • Select any course β†’ see every student's attendance with status badges (🟒 Safe, 🟑 Warning, πŸ”΄ Critical)
  • Per-student present count, total sessions, percentage
  • Session trend chart (Chart.js line chart)

Student Lookup Tab

  • Search any student β†’ see their attendance across all courses
  • Recent absences list
  • Overall attendance badge

Trends Tab (Chart.js Visualizations)

  • Daily Attendance β€” bar chart, last 30 days
  • Day-of-Week Pattern β€” which days have highest attendance
  • Online vs Offline β€” doughnut chart showing session type split
  • Course Comparison β€” bar chart comparing sessions and attendance across courses

πŸ“ Project Structure

A.R.I.S.E/
β”œβ”€β”€ server.py                  # Main Flask application (all routes + logic)
β”œβ”€β”€ config.py                  # Configuration classes + .env loader
β”œβ”€β”€ database_setup.py          # Database schema creation script
β”œβ”€β”€ sync_engine.py             # Local ↔ Cloud sync with smart merge
β”œβ”€β”€ analytics.py               # Analytics computation module
β”œβ”€β”€ wsgi.py                    # WSGI entry point for Gunicorn
β”œβ”€β”€ backup_db.py               # Database backup utility
β”œβ”€β”€ migrate_passwords.py       # Password migration script (plaintext β†’ bcrypt)
β”œβ”€β”€ attendance.db              # SQLite database (created at runtime)
β”‚
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ admin-login.html       # Admin login page
β”‚   β”œβ”€β”€ admin.html             # Admin panel (5 tabs: Settings, Manage, View, Tools, Analytics)
β”‚   β”œβ”€β”€ teacher.html           # Teacher dashboard
β”‚   β”œβ”€β”€ student.html           # Student portal
β”‚   └── online_attendance.html # Online attendance marking page
β”‚
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   β”œβ”€β”€ base.css           # Shared styles, CSS variables, dark mode
β”‚   β”‚   β”œβ”€β”€ admin.css          # Admin panel + analytics styles
β”‚   β”‚   β”œβ”€β”€ teacher.css        # Teacher dashboard styles
β”‚   β”‚   β”œβ”€β”€ student.css        # Student portal styles
β”‚   β”‚   β”œβ”€β”€ online.css         # Online attendance page styles
β”‚   β”‚   └── modal.css          # Custom modal dialog styles
β”‚   β”‚
β”‚   β”œβ”€β”€ js/
β”‚   β”‚   β”œβ”€β”€ admin.js           # Admin panel logic (CRUD, tabs, enrollment)
β”‚   β”‚   β”œβ”€β”€ admin-analytics.js # Analytics dashboard (Chart.js, KPIs, tables)
β”‚   β”‚   β”œβ”€β”€ teacher.js         # Teacher dashboard logic
β”‚   β”‚   β”œβ”€β”€ student.js         # Student portal logic
β”‚   β”‚   β”œβ”€β”€ online.js          # Online attendance logic (OTP, marking)
β”‚   β”‚   └── modal.js           # Custom modal component
β”‚   β”‚
β”‚   └── manifest.json          # PWA manifest
β”‚
β”œβ”€β”€ FirmwareCodeOfEsp32/       # ESP32 fingerprint scanner firmware
β”‚   └── sketch_oct8a/
β”‚
β”œβ”€β”€ .env                       # Environment variables (not in git)
β”œβ”€β”€ .env.example               # Environment template
β”œβ”€β”€ .gitignore                 # Git ignore rules
β”œβ”€β”€ requirements.txt           # Python dependencies (pinned versions)
β”œβ”€β”€ Procfile                   # Render/Heroku start command
β”œβ”€β”€ render.yaml                # Render infrastructure config
β”œβ”€β”€ DEPLOYMENT.md              # Deployment guide
└── README.md                  # This file

πŸ”’ Security

Feature Implementation
Password hashing bcrypt (adaptive cost factor)
Authentication JWT tokens with expiration
Rate limiting Flask-Limiter (5/min login, 100/min API)
CORS Flask-CORS with configurable origins
API key sync Shared secret between local and cloud for sync
Input validation Server-side validation on all endpoints
SQL injection Parameterized queries throughout
Session tokens Cryptographically secure random tokens
OTP rotation 30-second TOTP-style codes for online attendance
Auto-expiry Sessions auto-expire after configured duration

πŸ›  Troubleshooting

Problem Solution
"Server not reachable" Ensure server.py is running, port 5000 is open
"Invalid credentials" Default admin is admin/admin after database_setup.py
"Not enrolled" responses Verify enrollments in Admin β†’ Manage β†’ Enrollments
Sync fails Check CLOUD_SERVER_URL and SYNC_API_KEY match on both servers
Online attendance unavailable Only works on cloud server (IS_CLOUD_SERVER=true)
ESP32 can't connect Verify Wi-Fi config and server IP in firmware
Charts not loading Clear browser cache or hard refresh (Ctrl+Shift+R)
Database locked Stop all server processes, then restart

Logs

Server logs are written to arise_server.log and stdout. Check logs for detailed error messages:

# View last 50 log lines
tail -50 arise_server.log

# Windows
Get-Content arise_server.log -Tail 50

πŸ“„ License

This project is developed for educational purposes.


Built with ❀️ for classrooms that deserve better attendance systems.

Releases

No releases published

Packages

 
 
 

Contributors