Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 Student ID Scanner

Barcode / QR code access control system for universities.

Files

File Purpose
scanner_app.py Python backend — camera scanner + REST API
scanner_ui.html Web dashboard — live results + scan history

Quick Setup

1. Install dependencies

pip install opencv-python pyzbar pillow flask flask-cors

Linux only: also run sudo apt install libzbar0

2. Add your students

Edit the students_db dict in scanner_app.py:

students_db = {
    "STU-2024-001": {"name": "Alice Johnson", "department": "CS", "year": 3},
    ...
}

Or load from CSV (see load_from_csv() example at the bottom of the file).

3. Run the backend

python scanner_app.py

This opens your webcam and starts the REST API on http://localhost:5000.

4. Open the dashboard

Open scanner_ui.html in your browser.
Use Manual / Demo Scan to test without a physical card.


Demo student IDs

STU-2024-001   Alice Johnson      Computer Science   Year 3
STU-2024-002   Bob Martinez       Engineering        Year 2
STU-2024-003   Clara Nguyen       Medicine           Year 4
STU-2024-004   David Osei         Business           Year 1
STU-2024-005   Eva Chen           Law                Year 5

API Endpoints

Endpoint Method Description
/api/last_scan GET Most recent scan result
/api/log GET Scan history (up to 200)
/api/stats GET Totals: granted / denied
/api/manual_scan POST {"code": "STU-..."} Simulate a scan

Loading students from CSV

Add this to scanner_app.py and call it before scan_loop():

import pandas as pd

def load_from_csv(path="students.csv"):
    df = pd.read_csv(path)   # columns: id, name, department, year
    for _, row in df.iterrows():
        students_db[row["id"]] = {
            "name":       row["name"],
            "department": row["department"],
            "year":       int(row["year"]),
        }

CSV format (students.csv):

id,name,department,year
STU-2024-001,Alice Johnson,Computer Science,3

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages