From 116730b685928d31ec98cbac95db9eb94208986e Mon Sep 17 00:00:00 2001 From: Jared Knowles Date: Mon, 10 Aug 2026 12:17:42 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20national=5Frates.json=20deployment=20?= =?UTF-8?q?=E2=80=94=20copy=20to=20public/=20directory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add missing data/national_rates.json fixture (was only in src/data/, not served by Vite) - LoadingAnimation.jsx: Use import.meta.env.BASE_URL for national rates path - Ensures file is available at /crdc-demo/data/national_rates.json on git-pages --- public/data/national_rates.json | 44 +++++++++++++++++++++++++++++ src/components/LoadingAnimation.jsx | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 public/data/national_rates.json diff --git a/public/data/national_rates.json b/public/data/national_rates.json new file mode 100644 index 0000000..65766dd --- /dev/null +++ b/public/data/national_rates.json @@ -0,0 +1,44 @@ +{ + "metadata": { + "source": "CRDC School Arrest Rate API / Knowles & Miller 2025, White Paper §3 Data", + "year": "21-22", + "description": "National arrest rates per 1,000 students for each race×sex group in the 2021-22 CRDC. Generated from crdc_2122 with RACE != TOTAL and SEX != TOTAL: sum(ARRESTS) / (sum(stu_enroll)/1000).", + "note": "These are observed national rates, used for comparison in Charts 3 & 6." + }, + "rates_per_1000": { + "WH_F": 0.34, + "WH_M": 0.67, + "BL_F": 1.25, + "BL_M": 1.98, + "HI_F": 0.42, + "HI_M": 0.88, + "AM_F": 0.91, + "AM_M": 1.40 + }, + "observed_arrests": { + "WH_F": 3653, + "WH_M": 7606, + "BL_F": 4420, + "BL_M": 7246, + "HI_F": 2876, + "HI_M": 6270, + "AM_F": 202, + "AM_M": 327 + }, + "enrollment": { + "WH_F": 10624313, + "WH_M": 11322741, + "BL_F": 3530162, + "BL_M": 3667523, + "HI_F": 6805008, + "HI_M": 7109091, + "AM_F": 222963, + "AM_M": 233442 + }, + "totals": { + "arrests": 34846, + "enrollment": 48596489, + "rate_per_1000": 0.72, + "districts_reporting_arrests_pct": 11.6 + } +} diff --git a/src/components/LoadingAnimation.jsx b/src/components/LoadingAnimation.jsx index 99ccbd6..a329865 100644 --- a/src/components/LoadingAnimation.jsx +++ b/src/components/LoadingAnimation.jsx @@ -67,7 +67,7 @@ export default function LoadingAnimation({ district, state }) { ) // ——— National rates (from static fixture, instant) ——— - const nationalPromise = fetch('/data/national_rates.json') + const nationalPromise = fetch(import.meta.env.BASE_URL + 'data/national_rates.json') .then(r => r.json()) .then(data => { /* cache for ChartPanel */ window.__NATIONAL_RATES__ = data }) .catch(() => {})