Updates after testing
This commit is contained in:
parent
2c9ae1c312
commit
04095c9970
15 changed files with 238 additions and 33 deletions
|
|
@ -4,15 +4,13 @@ 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)
|
||||
conn = get_connection(read_only=True)
|
||||
|
||||
app.layout = html.Div(
|
||||
[
|
||||
|
|
@ -22,10 +20,10 @@ def create_app() -> dash.Dash:
|
|||
),
|
||||
dcc.Tabs(
|
||||
id="tabs",
|
||||
value="overview",
|
||||
value="compensation",
|
||||
children=[
|
||||
dcc.Tab(label="Admin Cost Overview", value="overview"),
|
||||
dcc.Tab(label="Executive Compensation", value="compensation"),
|
||||
dcc.Tab(label="Admin Cost Overview", value="overview"),
|
||||
dcc.Tab(label="Staffing & Enrollment", value="staffing"),
|
||||
dcc.Tab(label="Current Headcount", value="headcount"),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -113,6 +113,4 @@ def layout(conn: duckdb.DuckDBPyConnection):
|
|||
style={"display": "flex", "gap": "16px"},
|
||||
),
|
||||
dcc.Graph(figure=cat_fig),
|
||||
html.H3("Staff Directory Detail", style={"marginTop": "24px"}),
|
||||
table,
|
||||
])
|
||||
|
|
|
|||
|
|
@ -73,6 +73,11 @@ def layout(conn: duckdb.DuckDBPyConnection):
|
|||
mode="lines+markers", name="Management Growth",
|
||||
line={"color": "#E07A5F"},
|
||||
))
|
||||
growth_fig.add_trace(go.Scatter(
|
||||
x=growth_pd["year"], y=growth_pd["faculty_index"],
|
||||
mode="lines+markers", name="Faculty Growth",
|
||||
line={"color": "#7FB069"},
|
||||
))
|
||||
growth_fig.add_trace(go.Scatter(
|
||||
x=growth_pd["year"], y=growth_pd["enrollment_index"],
|
||||
mode="lines+markers", name="Enrollment Growth",
|
||||
|
|
@ -80,7 +85,7 @@ def layout(conn: duckdb.DuckDBPyConnection):
|
|||
))
|
||||
growth_fig.add_hline(y=100, line_dash="dot", line_color="#ccc")
|
||||
growth_fig.update_layout(
|
||||
title="Management vs Enrollment Growth (Indexed, Base Year = 100)",
|
||||
title="Management vs Faculty vs Enrollment Growth (Indexed, Base Year = 100)",
|
||||
xaxis_title="Year", yaxis_title="Index",
|
||||
template="plotly_white", height=380,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -221,10 +221,12 @@ def query_student_staff_ratios(conn: duckdb.DuckDBPyConnection) -> pl.DataFrame:
|
|||
|
||||
|
||||
def query_growth_index(conn: duckdb.DuckDBPyConnection) -> pl.DataFrame:
|
||||
"""Management vs enrollment growth, indexed to first year = 100."""
|
||||
"""Management, faculty, and enrollment growth, indexed to first year = 100."""
|
||||
return conn.execute("""
|
||||
WITH base AS (
|
||||
SELECT s.management_total AS base_mgmt, e.total_enrollment AS base_enrl
|
||||
SELECT s.management_total AS base_mgmt,
|
||||
s.faculty_total AS base_fac,
|
||||
e.total_enrollment AS base_enrl
|
||||
FROM raw_ipeds_staff s
|
||||
JOIN raw_ipeds_enrollment e ON e.unitid = s.unitid AND e.year = s.year
|
||||
WHERE s.unitid = ?
|
||||
|
|
@ -232,9 +234,12 @@ def query_growth_index(conn: duckdb.DuckDBPyConnection) -> pl.DataFrame:
|
|||
)
|
||||
SELECT s.year,
|
||||
s.management_total,
|
||||
s.faculty_total,
|
||||
e.total_enrollment,
|
||||
ROUND(s.management_total * 100.0
|
||||
/ NULLIF((SELECT base_mgmt FROM base), 0), 1) AS mgmt_index,
|
||||
ROUND(s.faculty_total * 100.0
|
||||
/ NULLIF((SELECT base_fac FROM base), 0), 1) AS faculty_index,
|
||||
ROUND(e.total_enrollment * 100.0
|
||||
/ NULLIF((SELECT base_enrl FROM base), 0), 1) AS enrollment_index
|
||||
FROM raw_ipeds_staff s
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue