from fastapi import FastAPI from routes import analytics from logger import setup_logger from database import supabase # Ensure this is properly initialized from fastapi import FastAPI, HTTPException import pandas as pd # Initialize FastAPI app app = FastAPI(title="HR Analytics API", description="HR Insights and Predictive Analytics") # Setup logger setup_logger() # Include routes app.include_router(analytics.router) @app.get("/home") def home(): """ Home endpoint providing API overview. """ return { "message": "Welcome to the HR Analytics and Predictive Insights API", "description": "This API provides HR analytics, including employee satisfaction, performance metrics, and training insights.", "employee_statistics": { "total_employees": 2845, "male_employees": 1257, "female_employees": 1588 }, "endpoints": { "/satisfaction-analysis": "Analyze employee satisfaction by department.", "/department-performance": "Get average performance scores by department.", "/training-analytics": "Analyze training program completion rates.", "/engagement-performance-correlation": "Find correlation between engagement and performance scores.", "/cost-benefit-analysis": "Perform cost-benefit analysis for training programs.", "/training-effectiveness": "Evaluate the effectiveness of training programs.", "/diversity-dashboard": "View diversity metrics by department.", "/worklife-balance-impact": "Analyze the impact of work-life balance on performance.", "/career-development": "Track employee career development over time." }, "documentation": { "Swagger UI": "/docs", "Redoc": "/redoc" } }