File size: 1,848 Bytes
79d167d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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"
        }
    }