An intelligent workforce management system that uses AI and semantic search to match employees with tasks, analyze task complexity, and optimize scheduling decisions.
- AI-Powered Task-Employee Matching: Complete AI engine that combines Gemini complexity analysis with Qdrant semantic search to recommend optimal employee-task matches
- Semantic Employee Search: Uses Qdrant vector database and sentence transformers to find the best employee matches for tasks based on skills, certifications, and performance history
- AI-Powered Task Analysis: Leverages Google Gemini 2.0 Flash to analyze task complexity, estimate durations, and identify required skills
- Smart Scheduling: Priority-based task scheduling with deadline optimization
- Interactive Web Interface: Modern Next.js frontend with drag-and-drop file uploads, task creation, and visual schedule grid
- RESTful API: FastAPI backend with automatic API documentation
- Production Ready: Graceful degradation works even without Qdrant/Gemini configured
- Framework: FastAPI (Python 3.11+)
- Database: SQLite (with SQLAlchemy ORM)
- Vector Database: Qdrant Cloud
- AI/ML:
- Google Gemini 2.0 Flash API
- Sentence Transformers (all-MiniLM-L6-v2)
- Data Processing: Pandas
- Framework: Next.js 16 with React 19
- UI Components: shadcn/ui (Radix UI primitives)
- Styling: Tailwind CSS
- State Management: React Hooks
- Notifications: Sonner (toast notifications)
Dynamic_Staffing/
βββ backend/ # FastAPI application
β βββ main.py # FastAPI app entry point & API endpoints
β βββ scheduler.py # Task scheduling logic
β βββ db.py # Database models and session
β βββ ai/ # AI engine modules
β βββ analyze_and_match.py # Main AI engine for task-employee matching
β βββ gemini_task_complexity.py # Task complexity analysis
β βββ gemini_tradeoff_analysis.py # Tradeoff analysis
βββ scripts/ # Utility scripts
β βββ embed_employees.py # Employee embedding pipeline
β βββ embed_tasks.py # Task embedding pipeline
βββ frontend/ # Next.js frontend
β βββ app/ # Next.js app router pages
β β βββ page.tsx # Landing page
β β βββ intake/ # File upload & task creation
β β βββ review/ # Schedule review & approval
β βββ components/ # React components
β βββ lib/ # Utilities & API client
β βββ package.json
βββ data/ # CSV data files
β βββ employees.csv
β βββ historical_tasks.csv
βββ Procfile # Railway deployment config
βββ requirements.txt # Python dependencies
βββ README.md # This file
- Python 3.11+ installed
- Node.js 18+ and npm installed
- Qdrant Cloud account (free tier available) - Optional for demo mode
- Google Gemini API key - Optional for demo mode
-
Clone the repository
git clone <repository-url> cd Dynamic_Staffing
-
Set up Backend
Create a virtual environment (recommended):
python -m venv venv # Windows (PowerShell) .\venv\Scripts\Activate.ps1 # Windows (Command Prompt) venv\Scripts\activate.bat # Linux/Mac source venv/bin/activate
Install Python dependencies:
pip install -r requirements.txt
-
Set up Frontend
cd frontend npm install
Create a .env file in the root directory or set environment variables:
Windows (PowerShell):
$env:QDRANT_URL="your-qdrant-cloud-url"
$env:QDRANT_API_KEY="your-qdrant-api-key"
$env:GEMINI_API_KEY="your-gemini-api-key"
$env:CORS_ORIGINS="http://localhost:3000,http://localhost:3001"Linux/Mac:
export QDRANT_URL="your-qdrant-cloud-url"
export QDRANT_API_KEY="your-qdrant-api-key"
export QDRANT_API_KEY="your-gemini-api-key"
export CORS_ORIGINS="http://localhost:3000,http://localhost:3001"Note: The application works in demo mode even without Qdrant/Gemini configured. File uploads will succeed but embeddings will be skipped.
Create frontend/.env.local file:
NEXT_PUBLIC_API_URL=http://localhost:8000# Make sure virtual environment is activated
uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000The API will be available at:
- API: http://localhost:8000
- Health Check: http://localhost:8000/health
- Interactive Docs: http://localhost:8000/docs
Open a new terminal:
cd frontend
npm run devThe frontend will be available at:
- Frontend: http://localhost:3000
- Navigate to the intake page
- Upload CSV files containing:
- Employee profiles: Name, skills, certifications, performance history
- Historical tasks: Task types, durations, required skills
- Files are processed and embedded into Qdrant (if configured)
- Define new tasks with:
- Task type and description
- Required skills and skill levels (1-10)
- Priority (1-5)
- Start and end datetime
- Duration
- Review queued tasks
- Click "Start Scheduling" to generate optimized schedule
- Tasks are sorted by priority and deadline
- View weekly schedule grid with colorful task blocks
- Review AI recommendations and tradeoffs
- Export schedule as CSV or PDF
- Finalize and approve schedule
GET /health
Returns API status.
GET /init-session
Initializes a new session and returns a session token (cookie-based).
POST /upload
Upload CSV files (employees_profiles or historical_tasks).
Form Data:
file: CSV filedata_type: "employees_profiles" or "historical_tasks"
POST /create-task
Create a new task.
Request Body:
{
"task_type": "product_inquiry",
"duration_minutes": 120,
"required_skills": {"communication": 7, "customer_service": 5},
"priority": 2,
"start_datetime": "2025-11-20T09:00:00",
"end_datetime": "2025-11-20T17:00:00"
}GET /get-schedule
Retrieve scheduled tasks for the current session.
POST /search-employees
AI-powered employee search matching task requirements.
The analyze_and_match function combines task complexity analysis with employee matching:
from backend.ai.analyze_and_match import analyze_and_match
task_payload = {
"task_type": "phone_support",
"description": "Handle incoming customer calls",
"required_skills": {
"communication": 7,
"customer_service": 5
},
"priority": 2
}
result = analyze_and_match(task_payload)Result Structure:
{
"complexity_analysis": {
"complexity_score": 7,
"recommended_skills": {...},
"challenges": [...],
"duration_estimate": {...}
},
"top_employees": [
{"employee_name": "Alice", "score": 0.76},
{"employee_name": "Michael", "score": 0.71}
],
"recommendation_summary": "This is a high-complexity task..."
}- Complexity Analysis: Uses Google Gemini 2.0 Flash to analyze task complexity
- Employee Search: Searches Qdrant vector database using semantic embeddings
- Recommendation: Combines analysis with matches to generate recommendations
python backend/ai/analyze_and_match.py- Connect GitHub repository to Railway
- Railway will auto-detect
Procfile - Set environment variables in Railway dashboard:
QDRANT_URLQDRANT_API_KEYGEMINI_API_KEYCORS_ORIGINS(your frontend URL)PORT(auto-set by Railway)
- Connect GitHub repository
- Set environment variable:
NEXT_PUBLIC_API_URL(your Railway backend URL)
- Build and deploy
Run the test suite:
python test_application.pyThis will verify:
- All modules import correctly
- Environment variables are set
- AI engine functionality (if configured)
# Activate virtual environment
.\venv\Scripts\Activate.ps1 # Windows
source venv/bin/activate # Linux/Mac
# Run with auto-reload
uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000cd frontend
npm run devFrontend:
cd frontend
npm run build
npm startBackend:
# Remove --reload flag for production
uvicorn backend.main:app --host 0.0.0.0 --port 8000"ModuleNotFoundError"
- Ensure virtual environment is activated
- Run
pip install -r requirements.txt
"Port 8000 already in use"
- Use a different port:
uvicorn backend.main:app --reload --port 8001 - Update
NEXT_PUBLIC_API_URLin frontend.env.local
"CORS error"
- Ensure
CORS_ORIGINSincludes your frontend URL - Check backend terminal for CORS configuration
"Cannot find module"
cd frontend
rm -r node_modules # or Remove-Item -Recurse node_modules
npm install"API connection failed"
- Verify backend is running on port 8000
- Check
NEXT_PUBLIC_API_URLinfrontend/.env.local - Verify CORS is configured in backend
This is a hackathon project by TeamGenn. Contributions and improvements are welcome!
This project is part of a hackathon submission.
TeamGenn - Dynamic Staffing & Scheduling Agent
Note: This project is production-ready and can be deployed. The application gracefully handles missing Qdrant/Gemini configuration, making it suitable for demo purposes.