This is the backend server for the Campus Resource Management system, designed to handle hall bookings, faculty information, and user authentication for a university environment. This service handles priority logic, AI-driven forecasting, and automated reallocation.
- User Authentication: Session-based authentication with MongoDB persistent store.
- Priority Levels: Bookings categorized as
Normal,High, orCritical. - Intelligent Overrides: Admin can approve "Critical" events by overriding existing "Normal" bookings.
- Automated Displacement: Displaced bookings are automatically rejected with a notification, triggering the Reallocation Engine.
Located in src/controllers/forecastingController.js:
- Prophet ML (Facebook): Python script (
predict_demand.py) predicts booking trends for the next 7 days based on 90-day history. - Statistical Fallback: Day-of-week weighted averaging ensures forecasting works even without Python.
- Google Gemini AI Integration: (Requires
GEMINI_API_KEY)- Optimization Recommendations: Qualitative analysis of resource usage.
- Monopolization Alerts: Detects if a department is over-booking resources.
- Space Efficiency Score: Matches intended attendees to actual room capacity (0-100 scale).
The "Self-Healing" logic found in src/services/reallocationEngine.js:
- Weighted Scoring Algorithm (40/30/30):
- 40% Capacity Fit: Minimizes wasted space by finding the closest capacity match.
- 30% Floor Proximity: Suggests rooms near the original location (block/floor matching).
- 30% Utilization Fairness: Prioritizes less-used rooms to distribute wear-and-tear.
- Workflow: One-click reallocation suggestions on the Coordinator's dashboard.
- Audit Logs: Complete history of every creation, approval, and override.
- Nodemailer Integration: Automated email notifications for status updates.
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB with Mongoose ODM
- Task Scheduling: Node-cron (Automated alerts)
- Session Management: Express-session & Connect-mongo
- CI/CD: GitHub Actions (backend-ci.yml)
- Request: A Coordinator submits a booking.
- Analysis: System checks for time overlaps (
Booking.exists()). - Approval: Admin reviews. If it's a priority override, the
reallocationControlleris spawned. - Insight:
forecastingControllerperiodicity runs the Prophet script viachild_process.spawn.
-
Install dependencies:
npm install
-
Environment Configuration (
.env):MONGO_URI=your_mongodb_uri PORT=8000 AI_KEY=your_gemini_api_key (optional)
-
Run the Server:
npm run dev
- Aravind R K
- Kanishka D
- Sandheep G S
- Radha Krishna
- Sujith Kumar A