Some checks failed
CI / lint (push) Successful in 45s
CI / notebooks-smoke (push) Successful in 1m40s
CI / lint (pull_request) Successful in 28s
CI / test (push) Failing after 3m39s
CI / notebooks-smoke (pull_request) Successful in 1m35s
CI / test (pull_request) Failing after 3m22s
Infra CI / notebooks (push) Successful in 1m0s
Infra CI / zotero (push) Successful in 17s
Infra CI / docs (push) Successful in 20s
Infra CI / api (push) Successful in 1m11s
Infra CI / bcda (push) Successful in 1m31s
Infra CI / mc (push) Successful in 16s
Infra CI / llm (push) Successful in 52s
Infra CI / zotero (pull_request) Successful in 23s
Infra CI / docs (pull_request) Successful in 16s
Infra CI / notebooks (pull_request) Successful in 58s
Infra CI / api (pull_request) Successful in 17s
Infra CI / bcda (pull_request) Successful in 16s
Infra CI / llm (pull_request) Successful in 20s
Infra CI / mc (pull_request) Successful in 17s
Local files land in the DuckDB mirror with the source headers kept: group labels, stacked IRS names, headerless code maps, and the HCPCS action key. The read-only explorer and the review page are wired at lead.fhirworx.io. OEWS now includes 2025.
55 lines
1.7 KiB
Python
55 lines
1.7 KiB
Python
"""Column and filename cues for the public-data spine. No crosswalk."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from lead.load.spine_map import file_quarter, file_year, spine_columns
|
|
|
|
|
|
def test_county_fips_year_and_quarter_are_named():
|
|
got = spine_columns(["area_fips", "year", "qtr", "employment"])
|
|
assert got.fips == "area_fips"
|
|
assert got.year == "year"
|
|
assert got.quarter == "qtr"
|
|
|
|
|
|
def test_a_literal_fips_wins_over_area_fips():
|
|
assert spine_columns(["area_fips", "fips"]).fips == "fips"
|
|
|
|
|
|
def test_state_and_county_parts_stay_uncomposed():
|
|
got = spine_columns(["statefips", "countyfips", "a00100"])
|
|
assert got.state_fips == "statefips"
|
|
assert got.county_fips == "countyfips"
|
|
assert got.fips == ""
|
|
|
|
|
|
def test_hsa_hrr_cbsa_zcta_and_zip_are_separate():
|
|
got = spine_columns(["hsa_num", "hrrnum", "cbsa_code", "zcta5", "zipcode"])
|
|
assert (got.hsa, got.hrr, got.cbsa, got.zcta, got.zip) == (
|
|
"hsa_num",
|
|
"hrrnum",
|
|
"cbsa_code",
|
|
"zcta5",
|
|
"zipcode",
|
|
)
|
|
|
|
|
|
def test_irs_national_filenames_carry_one_year():
|
|
assert file_year("23incyallagi.csv") == 2023
|
|
assert file_year("12cyallagi.csv") == 2012
|
|
assert file_year("23zpallnoagi.csv") == 2023
|
|
assert file_year("1989countyincome.zip") == 1989
|
|
assert file_year("1998zipcode.zip") == 1998
|
|
assert file_year("county2013.zip") == 2013
|
|
|
|
|
|
def test_two_years_in_one_name_are_not_a_year():
|
|
assert file_year("cpi_medical_2007_2026.json") is None
|
|
|
|
|
|
def test_one_quarter_token_is_the_file_quarter():
|
|
assert file_year("MDS_Facility_Level_2026_Q2.csv") == 2026
|
|
assert file_quarter("MDS_Facility_Level_2026_Q2.csv") == 2
|
|
assert file_quarter("2024_qtrly_by_industry.zip") is None
|
|
assert file_quarter("2024.q1-q4.by_industry.csv") is None
|