Phase 1 project prototype

This commit is contained in:
emfurst 2026-03-30 19:29:33 -04:00
commit 2c9ae1c312
29 changed files with 2967 additions and 22 deletions

View file

@ -0,0 +1,53 @@
"""Dash application factory."""
import dash
from dash import dcc, html, Input, Output
from admin_analytics.db.connection import get_connection
from admin_analytics.db.schema import ensure_schema
from admin_analytics.dashboard.pages import overview, compensation, staffing, headcount
def create_app() -> dash.Dash:
"""Create and configure the Dash application."""
app = dash.Dash(__name__, suppress_callback_exceptions=True)
conn = get_connection()
ensure_schema(conn)
app.layout = html.Div(
[
html.H1(
"University of Delaware — Administrative Analytics",
style={"textAlign": "center", "padding": "20px", "color": "#00539F"},
),
dcc.Tabs(
id="tabs",
value="overview",
children=[
dcc.Tab(label="Admin Cost Overview", value="overview"),
dcc.Tab(label="Executive Compensation", value="compensation"),
dcc.Tab(label="Staffing & Enrollment", value="staffing"),
dcc.Tab(label="Current Headcount", value="headcount"),
],
style={"marginBottom": "20px"},
),
html.Div(id="tab-content", style={"padding": "0 20px 20px 20px"}),
],
style={"fontFamily": "system-ui, -apple-system, sans-serif", "maxWidth": "1400px", "margin": "0 auto"},
)
@app.callback(Output("tab-content", "children"), Input("tabs", "value"))
def render_tab(tab: str):
if tab == "overview":
return overview.layout(conn)
elif tab == "compensation":
return compensation.layout(conn)
elif tab == "staffing":
return staffing.layout(conn)
elif tab == "headcount":
return headcount.layout(conn)
return html.Div("Unknown tab")
compensation.register_callbacks(app, conn)
return app