A sophisticated web-based dashboard for predicting staffing requirements at Cal Poly Pomona's dining facilities. Features real-time predictions, interactive visualizations, and an AI-powered assistant for intelligent insights.
- Real-time Predictions: Get staffing predictions based on weather, events, and dates
- Interactive Dashboard: Visual representation of staffing needs with stacked bar charts
- Quick Information: Today's summary with worker count, expected customers, and total hours
- Batch Predictions: Generate predictions for date ranges
- Detailed Analysis: Click on chart bars for in-depth breakdowns with weather and event scenarios
- Intelligent Chat Interface: AI agent powered by AWS Bedrock and LangChain
- Contextual Responses: Understands staffing data, weather impacts, and event considerations
- Historical Data Access: Query past performance and trends
- Prediction Explanations: Get insights into why certain staffing levels are recommended
- Natural Language Queries: Ask questions in plain English about dining operations
- Modern Design: Cal Poly Pomona branded interface with smooth animations
- Responsive Layout: Works seamlessly on desktop, tablet, and mobile devices
- Interactive Charts: Click-to-explore functionality with hover details
- Accessibility Features: Keyboard navigation, focus indicators, and screen reader support
The integrated AI assistant can help with:
- Staffing Predictions: "What staffing do I need for next week if it's sunny with no events?"
- Weather Impact Analysis: "How does rainy weather affect dining traffic?"
- Event Planning: "How many extra workers do I need for graduation?"
- Operational Guidance: "How should I schedule my employees for optimal coverage?"
- Smart Fallbacks: Helpful responses even when AI agent is unavailable
- General Purpose Worker (FOH_General)
- Cashier (FOH_Cashier)
- Chef (Kitchen_Prep)
- Line Workers (Kitchen_Line)
- Dishwasher (Dish_Room)
- Management (Management)
- Sunny
- Cloudy
- Rainy
- Extreme Heat
- Regular Day
- Club Fair
- Career Fair
- Sports Events
- Graduation
- Parent Weekend
- Prospective Student Day
- Conference Hosting
- Campus Construction
- Python 3.8 or higher
- AWS Account with Bedrock access (for AI features)
- AWS CLI configured with appropriate credentials
pip install -r requirements.txt
# Install AWS CLI if not already installed
pip install awscli
# Configure your AWS credentials
aws configure
You'll need:
- AWS Access Key ID
- AWS Secret Access Key
- Default region (e.g.,
us-west-2
) - Bedrock model access for Claude 3.5 Sonnet
- Go to AWS Bedrock console
- Navigate to "Model access" in the left sidebar
- Request access to "Claude 3.5 Sonnet" model
- Wait for approval (usually immediate for most accounts)
Ensure these files are present in your project directory:
tx_model.pkl
- Transaction prediction modelwork_model.pkl
- Staffing prediction modeldf.csv
- Historical data fileinference.py
- Prediction logic
python app.py
Open your browser and go to http://localhost:5000
# AWS Configuration
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_DEFAULT_REGION=us-west-2
# Optional: Custom model paths
export TX_MODEL_PATH=./tx_model.pkl
export WORK_MODEL_PATH=./work_model.pkl
export DATA_FILE_PATH=./df.csv
The AI agent can be customized in app.py
:
dining_agent = DiningHallAgent(
enable_tracing=False,
recursion_limit=50, # Adjust for complex queries
model_id="us.anthropic.claude-3-5-sonnet-20241022-v2:0"
)
GET /
- Main dashboard pageGET /api/weather-options
- Get available weather conditionsGET /api/event-options
- Get available campus eventsPOST /api/predict
- Single day predictionPOST /api/batch-predict
- Date range predictionsGET /api/today-summary
- Quick summary for todayPOST /api/simple-batch-predict
- Simplified batch predictionsPOST /api/detailed-predict
- Detailed single-day analysis
POST /api/chat
- Send message to AI assistantPOST /api/chat/clear
- Clear conversation historyPOST /api/chat/reset
- Reset agent stateGET /api/chat/status
- Check agent availability
- View Today's Predictions: Automatically loaded on dashboard load
- Generate Custom Predictions:
- Select start and end dates
- Click "Generate Predictions"
- Explore Details: Click on any chart bar for detailed analysis
- Chat with AI: Click the chat button (π€) in bottom-right corner
- Resize Chat: Drag the bottom-left corner of the chat window
- Full-Screen Chat: Press F11 or click the expand button (βΆ)
- Keyboard Navigation: Use Tab, Enter, and Escape keys
- Mobile Support: Fully responsive design for all devices
- Ask specific questions about dates, weather, or events
- Request explanations for predictions
- Inquire about historical trends
- Get operational recommendations
- Use natural language - no special syntax required
βββ app.py # Flask application with AI integration
βββ inference.py # Prediction logic
βββ dining_agent.py # AI agent implementation
βββ cpp_agent.py # Agent initialization
βββ dataset_generator.py # Data generation utilities
βββ tx_model.pkl # Transaction prediction model
βββ work_model.pkl # Staffing prediction model
βββ df.csv # Historical data
βββ requirements.txt # Python dependencies
βββ templates/
β βββ dashboard.html # Enhanced dashboard template
βββ static/
β βββ css/
β β βββ style.css # Modern styling with Cal Poly colors
β βββ js/
β β βββ dashboard.js # Dashboard functionality
β β βββ chat.js # AI chat widget
β βββ images/
β βββ cpp_logo.svg # Cal Poly Pomona logo
βββ README.md # This file
The dashboard uses Cal Poly Pomona's official colors:
- Primary Green: #1B5E20
- Accent Green: #4CAF50
- Highlight Yellow: #FFC107
- Background: #F8F9FA
- Text: #495057
- Font Stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto'
- Responsive Sizing: Scales appropriately across devices
- Accessibility: High contrast ratios and readable font sizes
- Flask: Web framework
- Python: Core language
- AWS Bedrock: AI model hosting
- LangChain: AI agent framework
- LangGraph: Agent workflow management
- HTML5: Modern markup
- CSS3: Advanced styling with Grid and Flexbox
- JavaScript: Interactive functionality
- Chart.js: Data visualization
- XGBoost: Prediction models
- scikit-learn: Data processing
- pandas: Data manipulation
- numpy: Numerical computations
- AWS Bedrock: Claude 3.5 Sonnet model
- LangChain: Agent framework
- boto3: AWS SDK
# Check AWS credentials
aws sts get-caller-identity
# Verify Bedrock access
aws bedrock list-foundation-models --region us-west-2
- The system automatically handles these with fallback responses
- Clear chat history if issues persist
- Use
/api/chat/reset
endpoint to reset agent state
Ensure all .pkl
files are in the project root directory
# Kill process on port 5000
lsof -ti:5000 | xargs kill -9
# Or use a different port
python app.py --port 5001
- Clear chat history periodically for better performance
- Use specific date ranges rather than very large ranges
- Monitor AWS Bedrock usage to manage costs
- Multi-location Support: Extend to other dining facilities
- Advanced Analytics: Trend analysis and forecasting
- Mobile App: Native iOS/Android applications
- Integration APIs: Connect with existing campus systems
- Real-time Updates: Live data feeds and notifications
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Built with β€οΈ for Cal Poly Pomona Dining Services