KANSAS SCHOOL DISTRICT OUTCOMES: NATIONAL VS. MASSACHUSETTS COMPARISON
Toggle between two paired standards, with imputation
Interactive bubble chart widget package
==========================================================

CONTENTS
--------
index.html
    The standalone, self-contained interactive widget. Opens directly
    in any browser -- no server or install required. Chart data is
    embedded inline inside this file, so it works fully offline once
    downloaded (it does load Chart.js from a CDN via <script src>, so
    an internet connection is needed for that one external file).

    Features:
      - Comparison toggle: "National average" / "Massachusetts
        average". Switching swaps BOTH axes together -- the x-axis
        % Adequacy calculation and the y-axis outcome comparison
        change as a pair (see METHODOLOGY below), not independently.
      - Year slider, 2009-2024, with a play button to animate through
        years
      - Search box and click-to-select highlighting -- each selected
        district gets its own color from a 10-color palette, matched
        to a colored dot on its chip
      - Bubble size = enrollment
      - Interpolated points are drawn with a dashed border (both in
        the chart and noted in the hover tooltip); imputation is
        computed independently for each standard, since each uses a
        different % Adequacy source column

data/ks_district_data_toggle.csv
    Human-readable version of the underlying data, one row per
    district-year, with both standards side by side:
        district_name                       - KS school district
        year                                  - 2009-2024
        pct_adequacy_natl                     - ppcstot / sim_cost_1_bd
                                                 * 100 (National average
                                                 standard), rounded to
                                                 the nearest whole
                                                 percent
        outcome_distance_to_national_avg      - outcome_index minus
                                                 that year's unweighted
                                                 national average
                                                 outcome_index, rounded
                                                 to 2 decimals
        imputed_natl                          - 1 if pct_adequacy_natl,
                                                 outcome_index, or
                                                 enrollment was
                                                 interpolated for this
                                                 district-year under the
                                                 National standard, 0
                                                 otherwise
        pct_adequacy_ma                       - ppcstot / sim_cost_2_bd
                                                 * 100 (Massachusetts
                                                 average standard),
                                                 rounded to the nearest
                                                 whole percent
        outcome_distance_to_ma_avg            - outcome_index minus
                                                 that year's
                                                 Massachusetts average
                                                 outcome_index, rounded
                                                 to 2 decimals
        imputed_ma                            - 1 if pct_adequacy_ma,
                                                 outcome_index, or
                                                 enrollment was
                                                 interpolated for this
                                                 district-year under the
                                                 Massachusetts standard,
                                                 0 otherwise
        enrollment                            - district enrollment
                                                 (identical regardless
                                                 of standard, confirmed
                                                 to match exactly
                                                 between both source
                                                 datasets before
                                                 merging)

data/ks_district_data_toggle.json
    The same data in the compact array format actually embedded in
    index.html's <script> tag:
        [ [district_name, [[year_offset, pct_adequacy_natl, distance_national_x100, imputed_natl, pct_adequacy_ma, distance_ma_x100, imputed_ma, enrollment], ...]], ... ]
    year_offset is years since 2009 (0 = 2009, 15 = 2024); both
    distance fields are *100 (integers) -- divide by 100 to get the
    real values; the imputed fields are each 0 or 1. Provided in case
    you want to inspect, re-use, or re-embed the exact dataset
    elsewhere.

METHODOLOGY NOTES
------------------
This widget is built exactly like the California and New Jersey
toggle widgets in this series, using the district-level national
NECM/SEDA merged file (necm_2024_NEWSEDA.dta), filtered to Kansas
only (not the combined Kansas + Missouri widget built earlier in this
series).

  National average standard:
    x-axis: % Adequacy = ppcstot / sim_cost_1_bd
    y-axis: outcome_index minus that year's unweighted national
            average outcome_index, across all ~13,000 US school
            districts (all 50 states plus DC). This average sits
            close to zero every year (-0.14 to +0.05).

  Massachusetts average standard:
    x-axis: % Adequacy = ppcstot / sim_cost_2_bd (a different cost
            basis than sim_cost_1_bd, so its % Adequacy values aren't
            directly comparable to the National standard's)
    y-axis: outcome_index minus that year's Massachusetts average
            outcome_index (an unweighted mean across roughly 230-240
            MA districts per year, ranging from about 0.16 to 0.49).
            Because MA's average is well above zero, this view shows
            most KS districts with a larger, more consistently
            negative gap than the National standard does.

Both standards' underlying fields (each % Adequacy source, the
shared outcome_index, and enrollment) were imputed independently
using linear interpolation on a per-district basis, subject to one
rule: a value is only imputed if that district has a valid value in
some earlier year AND some later year in the panel -- no
extrapolation at the edges. Both standards ended up with exactly 5
interpolated district-years (out of 4,130 total rows).

Of Kansas's 316 total districts in the source file, 259 have a
usable name in at least one year and are represented here; 57 were
excluded because their leaname field was blank in every single year
available. Among the 259 included, the file has the same blank-name
pattern in certain years (most severely 2014, 2020, and 2021, where
essentially no Kansas district has a name that year) seen elsewhere
in this series; it's handled the same way, by grouping on the stable
leaid identifier and carrying forward whichever year's name is
non-blank.

No district name collisions occurred in this dataset.

USAGE
-----
Just open index.html in a browser. To embed it on a website (e.g. as
an iframe), upload index.html somewhere with a public URL and point an
<iframe src="..."> at it -- the CSV/JSON files aren't required for the
widget to run; they're included here for reference and reuse.
