Compute President and top-10 compensation CAGRs over a shared ten-year window
The top-10 CAGR was hardcoded to the last five years while the President CAGR used the full range, so the two cards covered different periods. Also fix start_comp, which returned the end value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X9jG4CUFcH6n4vFvgtwndY
This commit is contained in:
parent
2cd7aa1c9d
commit
5c82c22aa2
3 changed files with 40 additions and 34 deletions
|
|
@ -7,6 +7,8 @@ from admin_analytics.dashboard.queries import (
|
|||
query_admin_per_student,
|
||||
query_admin_faculty_ratio,
|
||||
query_top_earners,
|
||||
query_comp_cagr,
|
||||
query_aggregate_comp_cagr,
|
||||
query_comp_by_role,
|
||||
query_comp_vs_cpi,
|
||||
query_staff_composition,
|
||||
|
|
@ -129,6 +131,23 @@ class TestTopEarners:
|
|||
assert df_empty.height == 0
|
||||
|
||||
|
||||
class TestCompCagr:
|
||||
def test_uses_last_ten_tax_years(self, db_conn):
|
||||
# 12 years of data; the window should start at 2015, not 2013
|
||||
for year in range(2013, 2025):
|
||||
comp = 1_000_000 if year < 2015 else 500_000 * 2 ** ((year - 2015) / 9)
|
||||
db_conn.execute(
|
||||
"INSERT INTO raw_990_schedule_j (tax_year, person_name, title, total_compensation) "
|
||||
"VALUES (?, 'P', 'PRESIDENT', ?)",
|
||||
[year, round(comp)],
|
||||
)
|
||||
for result in (query_comp_cagr(db_conn), query_aggregate_comp_cagr(db_conn)):
|
||||
assert (result["start_year"], result["end_year"]) == (2015, 2024)
|
||||
assert result["start_comp"] == 500_000
|
||||
assert result["end_comp"] == 1_000_000
|
||||
assert result["cagr_pct"] == 8.0
|
||||
|
||||
|
||||
class TestCompByRole:
|
||||
def test_groups_by_role(self, db_conn):
|
||||
_seed_990(db_conn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue