How krutiknaina/employee-profilescan works
Project type and purpose
• Full-stack, monolithic Django web application for corporate employee management.
• Purpose: generate and serve unique QR-coded employee IDs, manage profiles via an admin dashboard, and provide a camera-based in-app QR scanner that routes to a mobile-friendly profile page.
File structure
• Top level:
• Dockerfiles and docker-compose.yml (containerized deployment)
• manage.py (Django CLI entrypoint)
• db.sqlite3 (persistent data store)
• media/ (user-uploaded profile photos and generated QR images)
• staticfiles/ (collected static assets: CSS/JS images from Django admin and front end)
• Templates/ (HTML templates for pages: login, signup, scan, profile, reports, etc.)
• Django Project directory (QR_Employee_Scanner):
• settings.py, urls.py, asgi.py, wsgi.py
• views.py and utils.py containing business logic
• Django App directory (db):
• models.py (Employee model with QR code field)
• views.py (CRUD and scan endpoint handlers)
• migrations/ (schema history)
• Requirements and license files
README insights
• Confirms MVT pattern: Django ORM (SQLite), HTML templates with Bootstrap, JavaScript QR scanner (html5-qrcode.js), qrcode & Pillow for server-side QR generation, optional access control via Django auth.
• Flow: Admin → create profile → QR code generated → scanner page (/scan/) → camera read → redirect to profile view.
Main components and their relationships
A. Client Tier
• Browser/Mobile Device
• Renders HTML templates & serves JS/CSS from staticfiles
• Runs html5-qrcode.js on /scan/ page
B. Application Tier (Django)
• ASGI/WSGI server (QR_Employee_Scanner/asgi.py or wsgi.py)
• URL Router (QR_Employee_Scanner/urls.py)
• Views (QR_Employee_Scanner/views.py, db/views.py)
• Business utils (QR_Employee_Scanner/utils.py) for QR generation
• Admin Interface (built on Django’s admin module)
• Template engine (Templates/*.html)
C. Data Tier
• SQLite database (db.sqlite3) accessed via Django ORM (db/models.py)
• Media storage on disk (media/qr_codes, media/upload)
• Static assets directory (staticfiles/)
D. External libraries
• Python packages: Django, qrcode, Pillow
• JavaScript: html5-qrcode.js
E. Deployment infrastructure
• Docker container (defined by Dockerfile.txt, .dockerignore.txt)
• Service orchestration in docker-compose.yml
Interactions:
1. Client → HTTP GET/POST → Django URL router → appropriate view
2. View → ORM → read/write SQLite
3. View → utils → generate QR code → save to media/qr_codes
4. View → template engine → render HTML → return to client
5. Client on /scan/ loads html5-qrcode.js → camera stream → decode QR → redirect to /profile/<id> → step 1
Architectural patterns and principles
• Django’s Model-View-Template (MVT) layered approach
• Clear separation:
• Presentation layer: Templates + static assets + client-side JS
• Business logic layer: views.py, utils.py
• Data layer: models.py, migrations, SQLite
• Containerization boundary around the Django service
Essential elements
• Clear labels: component name + directory/file reference
• Container boundary if depicting Docker deployment