A comprehensive, role-based campus management platform built with Flask, featuring intelligent chatbot assistance, content management for notices & FAQs, admin dashboards, web scraping integration, and multi-user authentication. Designed for colleges and institutes to streamline student communication and administrative workflows.
Campus Management Assistant is a complete solution for academic institutions to:
- Support Students & Guests with an intelligent chatbot answering FAQs, exam info, hostel rules, admission details
- Manage Content through admin dashboards for notices, FAQs, user accounts, and system logs
- Automate Data Collection via web scraper integration to pull official announcements
- Enforce Access Control with role-based dashboards (Guest, Student, Moderator, Admin)
- Scale Easily with a modular Flask architecture and extensible service layer
🤖 Chatbot: Runs in static-knowledge mode with 45+ questions across English, Hindi, Tamil, Telugu, and Marathi. Optional LLM integration available for future enhancement.
┌─────────────────────────────────────────────────────────────────┐
│ Users (Browser/HTTP) │
│ Guest | Student | Moderator | Admin │
└────────────────────┬────────────────────────────────────────────┘
│ HTTP Requests
▼
┌────────────────────────────────────┐
│ Flask Application │
│ (Static Frontend + REST API) │
└────────────┬───────────────────────┘
│
┌────────────┴──────────────────────┐
│ │
▼ ▼
┌──────────────────┐ ┌──────────────────┐
│ Blueprints │ │ Static Files │
│ (Routes) │ │ (/css, /js) │
└──────────────────┘ └──────────────────┘
│ ├─ auth │
│ ├─ guest │
│ ├─ student │
│ ├─ moderator │
│ ├─ admin │
│ ├─ api │
│ ├─ files │
│ ├─ chatbot │
│ └─ scraper │
│
▼
┌──────────────────────────────────────────┐
│ Service Layer │
│ ├─ chatbot_service │
│ ├─ notice_service │
│ ├─ faq_service │
│ ├─ email_service │
│ ├─ pdf_service │
│ ├─ scraper_service │
│ └─ logs_service │
└──────────┬───────────────────────────────┘
│
▼
┌──────────────────────────────────────────┐
│ SQLAlchemy ORM Models │
│ ├─ User (with roles/permissions) │
│ ├─ Notice, NoticeCategory, NoticeFile │
│ ├─ FAQ (with department filtering) │
│ ├─ Logs (audit trail) │
│ ├─ Scraper (config + history) │
│ └─ ChatbotDocument (training data) │
└──────────┬───────────────────────────────┘
│
▼
┌─────────────────────┐
│ SQLite Database │
│ (app/database/) │
└─────────────────────┘
│
┌──────┴──────────┐
▼ ▼
┌────────────┐ ┌──────────────┐
│ User Data │ │ Notices & │
│ (Auth) │ │ FAQs │
└────────────┘ └──────────────┘
campus-management-assistant/
├─ README.md # This file
├─ requirements.txt # Python dependencies
├─ run.py # Flask development server entrypoint
├─ .gitignore # Git exclusions
│
├─ app/
│ ├─ __init__.py # Flask app factory (create_app)
│ ├─ config.py # Configuration from .env
│ ├─ extensions.py # Flask extensions (db, login_manager)
│ │
│ ├─ routes/ # Blueprint route handlers
│ │ ├─ auth.py # Login, logout, registration
│ │ ├─ guest.py # Public pages (home, notices, chatbot)
│ │ ├─ student.py # Student dashboard & features
│ │ ├─ moderator.py # Moderator dashboard
│ │ ├─ admin.py # Admin dashboard & user management
│ │ ├─ api.py # RESTful API endpoints
│ │ ├─ chatbot.py # Chatbot query endpoints
│ │ ├─ files.py # File upload/download handlers
│ │ └─ scraper.py # Web scraper UI & configuration
│ │
│ ├─ services/ # Business logic & external integrations
│ │ ├─ chatbot_service.py # Chatbot query processing
│ │ ├─ chatbot_static_knowledge.py # 45+ Q&A knowledge base (multilingual)
│ │ ├─ notice_service.py # Notice CRUD & filtering
│ │ ├─ faq_service.py # FAQ CRUD & management
│ │ ├─ email_service.py # Email notifications
│ │ ├─ pdf_service.py # PDF parsing & extraction
│ │ ├─ scraper_service.py # Web scraping orchestration
│ │ ├─ logs_service.py # Audit & activity logging
│ │ └─ auth_service.py # User authentication logic
│ │
│ ├─ models/ # SQLAlchemy ORM models
│ │ ├─ user.py # User (roles: guest, student, moderator, admin)
│ │ ├─ notice.py # Notice posts
│ │ ├─ notice_category.py # Notice categories
│ │ ├─ notice_file.py # Attached files to notices
│ │ ├─ faq.py # FAQ entries
│ │ ├─ logs.py # Activity/audit logs
│ │ ├─ scraper.py # Scraper configurations
│ │ └─ chatbot_document.py # Training documents for chatbot
│ │
│ ├─ frontend/ # Static HTML, CSS, JavaScript
│ │ ├─ admin/ # Admin dashboard pages (5 HTML files)
│ │ │ ├─ dashboard.html
│ │ │ ├─ notices.html
│ │ │ ├─ faq.html
│ │ │ ├─ users.html
│ │ │ ├─ logs.html
│ │ │ └─ scraper.html
│ │ ├─ moderator/ # Moderator pages (3 HTML files)
│ │ │ ├─ dashboard.html
│ │ │ ├─ notices.html
│ │ │ └─ faq.html
│ │ ├─ student/ # Student pages (4 HTML files)
│ │ │ ├─ dashboard.html
│ │ │ ├─ notices.html
│ │ │ ├─ faq.html
│ │ │ └─ chatbot.html
│ │ ├─ guest/ # Public pages (3 HTML files)
│ │ │ ├─ home.html
│ │ │ ├─ notices.html
│ │ │ └─ chatbot.html
│ │ ├─ auth/ # Authentication pages (2 HTML files)
│ │ │ ├─ login.html
│ │ │ └─ register.html
│ │ ├─ css/ # Stylesheets (18 files)
│ │ │ ├─ admin/ # Admin-specific styles (6 files)
│ │ │ ├─ moderator/ # Moderator styles (3 files)
│ │ │ ├─ student/ # Student styles (4 files)
│ │ │ ├─ guest/ # Public styles (3 files)
│ │ │ └─ cred/ # Auth form styles (login.css, register.css)
│ │ └─ js/ # JavaScript (30 files)
│ │ ├─ admin/ # Admin-specific scripts
│ │ ├─ moderator/ # Moderator scripts
│ │ ├─ student/ # Student scripts
│ │ ├─ guest/ # Public scripts
│ │ ├─ auth/ # Auth form scripts
│ │ ├─ api.js # REST API client
│ │ ├─ auth.js # Authentication helpers
│ │ ├─ storage.js # Local storage utilities
│ │ └─ utils.js # Common utilities
│ │
│ ├─ templates/ # Email templates
│ │ └─ email/
│ │ └─ notice_published.html
│ │
│ ├─ database/ # SQLite database (auto-created)
│ │ └─ app.db
│ │
│ └─ uploads/ # File storage
│ ├─ notices/ # Notice attachments
│ └─ scraped/ # Scraped content
│
├─ scripts/ # Utility scripts
│ ├─ db_counts.py # Database statistics
│ ├─ migrate_add_scraper_name.py # Schema migrations
│ ├─ test_chatbot_static.py # Chatbot testing
│ ├─ test_email_notify.py # Email testing
│ ├─ test_scrape.py # Scraper testing
│ └─ test_smtp_login.py # SMTP configuration testing
│
└─ tests/ # Test suite
├─ run_tests.py # Test runner
├─ seed_data.py # Test database seeding
├─ test_routes.py # Route tests
├─ test_admin_users_scraper_auth.py # Integration tests
├─ test_env_config.py # Configuration tests
├─ test_moderator_admin.py # Permission tests
└─ diagnose_chatbot.py # Chatbot diagnostics
graph TD
A["👤 User Request<br/>(Browser)"] -->|HTTP GET/POST| B["Flask App<br/>(WSGI)"]
B --> C{Route Handler<br/>Blueprint}
C -->|Authentication| D["Auth Service<br/>(Flask-Login)"]
C -->|Data Processing| E["Business Services<br/>(chatbot, notice, etc.)"]
C -->|File Serving| F["Static Files<br/>(CSS, JS, HTML)"]
D -->|User Session| G["SQLAlchemy ORM"]
E -->|Read/Write| G
G -->|Queries| H["SQLite Database"]
E -->|Email Notifications| I["Email Service<br/>(SMTP)"]
E -->|PDF Processing| J["PDF Service<br/>(pdfplumber)"]
E -->|Web Scraping| K["Scraper Service<br/>(BeautifulSoup)"]
F -->|HTTP 200| L["HTML/CSS/JS<br/>Response"]
D -->|Redirect| L
E -->|JSON API| L
L -->|Browser Render| M["👁️ User Interface"]
- 45+ multilingual Q&A pairs covering:
- Library hours, hostel rules, admission process
- Exam schedules, fee structures, placement info
- Supported languages: English, Hindi, Tamil, Telugu, Marathi
- Role-aware responses: Different content for guest vs. student
- Static knowledge mode: No external API dependency (optional LLM integration available)
- Health check endpoint:
GET /chatbot/health
- Notices: Create, edit, delete with file attachments
- Categories: Organize notices by department/type
- FAQs: Q&A database with department filtering
- Moderator queue: Pending notice approval workflow
- Role-based access control: Guest, Student, Moderator, Admin
- Activation status: Deactivated users auto-logout on next request
- Audit logs: Track user actions and system events
- User management (create, activate, deactivate, delete)
- Notice publication & approval
- FAQ management & answering
- System logs & activity monitoring
- Web scraper configuration & testing
- Configure scraping sources (URLs, selectors, schedules)
- Automatic or manual scraping
- Extracted content indexed for chatbot search
- Rate limiting & error handling
- Email notifications for published notices
- PDF parsing for document ingestion
- Asynchronous email queueing (optional)
- Python: 3.10+ (3.11 recommended)
- Virtual Environment:
venvorconda - Database: SQLite (auto-created)
-
Clone & navigate:
git clone https://github.com/0-Shimanshu/Minor_Project_CMCA.git cd campus-management-assistant -
Create virtual environment:
python -m venv .\venv . .\venv\Scripts\Activate.ps1
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment (create
.envin project root):SECRET_KEY=your-secret-key-here-change-in-production COLLEGE_DOMAIN=aitr.ac.in ADMIN_LOGIN_ID=admin ADMIN_PASSWORD=admin123 # Optional: Email Configuration SMTP_SERVER=smtp.gmail.com SMTP_PORT=587 SMTP_USER=your-email@gmail.com SMTP_PASSWORD=your-app-password # Optional: LLM Integration (future) # GEMINI_API_KEY=your-api-key
-
Run the application:
python .\run.pyServer starts at: http://127.0.0.1:5000
-
First login:
- URL:
http://127.0.0.1:5000/login - Default credentials:
- Login ID:
admin - Password:
admin123
- Login ID:
- Change immediately in production!
- URL:
| Role | Access | Features |
|---|---|---|
| Guest | Public | Home, notices (read-only), chatbot |
| Student | Authenticated | Dashboard, notices, FAQs, personal chatbot, exam info |
| Moderator | Authenticated | Notice approval, FAQ answering, dashboard |
| Admin | Authenticated | Full CRUD, user management, logs, scraper config |
- Session-based authentication via Flask-Login
- Automatic logout for deactivated users
- Password hashing using Werkzeug
- CSRF protection on forms
- Role-based route guards (
@require_roledecorator)
POST /login Login with credentials
POST /logout Logout current user
POST /register Student self-registration
GET / Home page
GET /notices Public notices list
GET /guest/chatbot Chatbot UI
POST /guest/chatbot Submit chatbot query
GET /student/dashboard Personal dashboard
GET /student/notices My notices
GET /student/faq FAQ search
GET /student/chatbot Student chatbot
POST /student/chatbot Submit query
GET /api/notices List notices (paginated)
GET /api/notices/<id> Notice details
POST /api/notices Create notice (admin/moderator)
PUT /api/notices/<id> Update notice
DELETE /api/notices/<id> Delete notice
GET /api/faqs List FAQs
POST /api/faqs Create FAQ
PUT /api/faqs/<id> Update FAQ
DELETE /api/faqs/<id> Delete FAQ
POST /api/chatbot/query Chatbot API endpoint
GET /chatbot/health Chatbot health check
GET /admin/dashboard Admin dashboard
GET /admin/users User management
POST /admin/users Create user
DELETE /admin/users/<id> Delete user
GET /admin/notices All notices
GET /admin/faq FAQ management
GET /admin/logs Activity logs
GET /admin/scraper Scraper config
GET /css/<path> Serve CSS files
GET /js/<path> Serve JavaScript files
GET /uploads/* Serve user uploads
- users: User profiles, roles, activation status
- notices: Notice posts with timestamps
- notice_categories: Department/topic categorization
- notice_files: File attachments to notices
- faqs: Frequently asked questions
- logs: Audit trail of user actions
- scrapers: Web scraper configurations
- chatbot_documents: Training documents for knowledge base
User (1) ──→ (N) Notice
User (1) ──→ (N) FAQ
Notice (1) ──→ (N) NoticeFile
User (1) ──→ (N) Logs
Scraper (1) ──→ (N) ScraperHistory
| Variable | Default | Purpose |
|---|---|---|
SECRET_KEY |
(required) | Session signing key |
COLLEGE_DOMAIN |
example.edu |
College domain for branding |
ADMIN_LOGIN_ID |
admin |
Initial admin username |
ADMIN_PASSWORD |
admin123 |
Initial admin password |
SMTP_SERVER |
(optional) | Email server (Gmail: smtp.gmail.com) |
SMTP_PORT |
587 |
Email port |
SMTP_USER |
(optional) | Email sender address |
SMTP_PASSWORD |
(optional) | Email app password |
DATABASE_URL |
(auto) | SQLite path |
app/
├─ database/
│ └─ app.db ← Auto-created on first run
├─ uploads/
│ ├─ notices/ ← Notice attachments
│ └─ scraped/ ← Scraped content
└─ ...
- Login with admin credentials
- Navigate to Admin Dashboard
- Manage Users: Create students/moderators, set activation status
- Publish Notices: Create notices with attachments, assign categories
- Configure Scraper: Add scraping sources, test extraction
- Review Logs: Audit user activities and system events
- Register or login
- View Dashboard: Personalized notices & notices
- Search FAQs: Find answers by keyword or department
- Use Chatbot: Ask questions about exams, fees, hostels
- Download Notices: Access attached files
- Visit home page
- Browse Public Notices (without login)
- Use Public Chatbot: Limited Q&A for unauthenticated users
- Option to Register as student
# Python tests
python -m pytest -v
# Custom test script
python tests/run_tests.py
# Chatbot testing
python scripts/test_chatbot_static.py
# Email testing
python scripts/test_email_notify.py# Delete and recreate database
rm app/database/app.db
python run.py # Auto-recreates database & default admin# Enable Flask debug mode in .env or run.py
export FLASK_DEBUG=1
python run.py- Change
SECRET_KEYto a strong random string - Update
ADMIN_LOGIN_IDandADMIN_PASSWORD - Configure SMTP for email notifications
- Use production WSGI server (Gunicorn, Waitress, etc.)
- Place behind reverse proxy (Nginx, Apache)
- Enable HTTPS/SSL
- Set up database backups
- Configure logging & monitoring
- Test chatbot with production knowledge base
Example with Waitress (Windows) or Gunicorn (Linux):
# Install Waitress (Windows)
pip install waitress
waitress-serve --host 0.0.0.0 --port 8000 run:app
# Or Gunicorn (Linux)
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:8000 run:app| Layer | Technology |
|---|---|
| Backend Framework | Flask 2.x |
| ORM | SQLAlchemy |
| Database | SQLite (development), PostgreSQL (production-ready) |
| Authentication | Flask-Login, Werkzeug |
| Frontend | HTML5, CSS3, Vanilla JavaScript |
| Web Scraping | BeautifulSoup4, Requests |
| PDF Processing | pdfplumber |
| SMTP (configurable) | |
| Environment | python-dotenv |
| Testing | pytest, Playwright (optional) |
Problem: sqlalchemy.exc.OperationalError
Solution: Delete app/database/app.db and restart the app
Problem: Address already in use on port 5000
Solution:
# Change port in run.py or use:
python run.py --port 8000Problem: SMTP connection fails Solution:
- Verify credentials in
.env - Enable "Less secure apps" for Gmail
- Use app-specific passwords
- Test with:
python scripts/test_smtp_login.py
Problem: "I could not find a relevant answer..." Solution:
- Check
chatbot_static_knowledge.pyfor matching keywords - Add new Q&A entries as needed
- Test with:
python scripts/test_chatbot_static.py
Problem: Scraped data is empty Solution:
- Verify CSS selectors in scraper config
- Check target website structure hasn't changed
- Test manually in scraper UI
- Check logs for errors
- Flask Docs: https://flask.palletsprojects.com/
- SQLAlchemy: https://docs.sqlalchemy.org/
- BeautifulSoup: https://www.crummy.com/software/BeautifulSoup/
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Commit changes:
git commit -m "Add your feature" - Push to branch:
git push origin feature/your-feature - Open a Pull Request
- Follow PEP 8 for Python
- Keep functions focused and well-documented
- Add tests for new features
- Update README for significant changes
This project is proprietary software. Adapt and use as permitted by your institution.
Built for Acropolis Institute of Technology & Research (AITR)
For issues, questions, or suggestions:
- Open an issue on GitHub
- Contact the development team
- Check the
/admin/logssection for system diagnostics
Last Updated: December 31, 2025 | Status: ✅ Production Ready
Python 3.10+ (3.11 recommended). Install from requirements.txt:
- Flask, Flask‑SQLAlchemy, Flask‑Login
- python‑dotenv, requests, beautifulsoup4
- pdfplumber
- google‑generativeai (optional; current mode is static knowledge)
- Create and activate a virtual environment, then install dependencies:
# From d:\mn\campus-management-assistant
python -m venv .\venv
. .\venv\Scripts\Activate.ps1
pip install -r requirements.txt- Configure environment (create
.envin the project root):
SECRET_KEY=change_me
COLLEGE_DOMAIN=example.edu
ADMIN_LOGIN_ID=admin
ADMIN_PASSWORD=admin123
- Run the app:
python .\run.py
# Server starts on http://127.0.0.1:5000On first startup, the app ensures the database exists and creates a default admin using ADMIN_LOGIN_ID/ADMIN_PASSWORD.
GET /and role‑specific views via blueprints (guest,student,moderator,admin)- Chatbot UIs:
GET /guest/chatbot,POST /guest/chatbotPOST /student/chatbot(requires login, student role)POST /chatbot/query(JSON API)GET /chatbot/health
- Programmatic endpoints under
/api(see app/routes/api.py) - Assets:
GET /css/<file>,GET /js/<file>served fromfrontend/
Set in .env at project root:
- SECRET_KEY: session signing key (required)
- COLLEGE_DOMAIN: domain used for branding and email fallbacks (optional)
- ADMIN_LOGIN_ID: initial admin login id (optional, default
admin) - ADMIN_PASSWORD: initial admin password (optional, default
admin123)
- First run creates the database and (if missing) a default admin.
- Login as admin → add moderators/students, manage notices/FAQs, configure scraping sources.
- Students can ask the chatbot (student visibility); guests can use the guest chatbot (public visibility).
- Scraper and PDF parsing services help ingest official content for the assistant.
- Database file:
app/database/app.db(auto‑created) - Uploads:
app/uploads/notices,app/uploads/scraped
- Auth via Flask‑Login; sessions invalidated for deactivated users
- Default admin is created on boot if none exists
- Use a strong
SECRET_KEYin production; change default credentials
- Blueprints are registered in
app/__init__.py - Environment loading via
app/config.pyusing.env - To inspect/alter models, use Flask shell or a SQLite browser
- UI tests available under the repo’s
tests/ui(Playwright)
Run Python tests:
python -m pytest -qRun UI tests (requires Node.js):
npm install
npx playwright install
npx playwright test- If the DB schema evolves, the app attempts lightweight migrations on boot
- Delete
app/database/app.dbto reset local data (dev only) - Check
.envpaths and ensure the virtual environment is active
Place screenshots under assets/screenshots/ and they will render here:
- Use a production WSGI server (e.g., Waitress on Windows, Gunicorn on Linux) behind a reverse proxy.
- Set a strong
SECRET_KEYand change default admin credentials. - Move SQLite to a persistent location or upgrade to a managed RDBMS if needed.
- Configure logs rotation and health checks (
/chatbot/health).
- Open issues and PRs with clear descriptions.
- Keep style consistent; avoid introducing heavy frameworks or breaking agnostic design.
Proprietary or institution‑specific. Adapt as needed for your deployment.


