// Builds the sex-verification-test-costs tables (CSV) from prices read 2026-10-23. // Every value below was read by hand from the source named in source_id; see the dataset's sources. // Usage: node build_costs.js -> writes sex_verification_test_prices.csv and wa_child_coverage.csv const fs = require('fs'); const path = require('path'); const out = __dirname; // route: checkup | testosterone | karyotype | sry-fish // price_type: family_cost_share | payer_rate | billed_charge | consumer_cash | press_reported const rows = [ // Route 1: provider's record or exam at a routine visit ['chk-aca-inn', 'checkup', 'Well-child preventive visit, in-network, ACA-compliant plan', '', 0, 'family_cost_share', 'Private insurance (ACA preventive rule)', '2026-10-23', 'Children', 'healthcare-gov-children', 'HealthCare.gov: generally $0 in network for Marketplace plans and many other plans; $0 is not guaranteed in all cases.'], ['chk-ah-family', 'checkup', 'EPSDT well-child checkup, Apple Health client', '99394', 0, 'family_cost_share', 'Washington Apple Health (Medicaid)', '2026-07-01', 'Ages 5-20, one per calendar year', 'doh-well-care', 'Washington DOH: Apple Health covers a yearly well visit at no cost; HCA expects one checkup every calendar year for ages 5 through 20.'], ['chk-ah-rate', 'checkup', 'EPSDT well-child checkup, established patient age 12-17 (state payment, non-facility)', '99394', 82.07, 'payer_rate', 'Washington Apple Health (Medicaid)', '2026-07-01', 'Ages 12-17', 'hca-epsdt-fs', 'What HCA pays the provider, not what the family pays.'], ['chk-cash-mc', 'checkup', 'Sports physical, retail clinic cash price (no insurance accepted)', '', 82, 'consumer_cash', 'CVS MinuteClinic', '2026-10-23', 'Not stated on price list', 'cvs-minuteclinic-prices', 'Families already need a sports physical; this is not an added cost of verification. Whether a retail-clinic clinician is the student\'s "personal health care provider" under the measure is unsettled.'], // Route 2: serum testosterone (CPT 84403) ['t-ah-rate', 'testosterone', 'Total testosterone, serum', '84403', 20.65, 'payer_rate', 'Washington Apple Health (Medicaid)', '2026-10-01', 'All ages', 'hca-physician-fs', 'HCA maximum allowable fee. HCA billing guide: expedited prior authorization is not required for clients assigned female at birth or anyone 17 and younger.'], ['t-mcr-us', 'testosterone', 'Total testosterone, serum: Medicare average allowed amount, U.S.', '84403', 25.19, 'payer_rate', 'Medicare Part B', '2024', 'Medicare beneficiaries', 'cms-mup-geo-2024', '1,288,334 services in 2024.'], ['t-mcr-wa', 'testosterone', 'Total testosterone, serum: Medicare average allowed amount, Washington', '84403', 25.26, 'payer_rate', 'Medicare Part B', '2024', 'Medicare beneficiaries', 'cms-mup-geo-2024', '19,549 services in 2024.'], ['t-chg-us', 'testosterone', 'Total testosterone, serum: average submitted (billed) charge to Medicare, U.S.', '84403', 148.21, 'billed_charge', 'Labs billing Medicare', '2024', 'Medicare beneficiaries', 'cms-mup-geo-2024', 'A list price; Medicare pays far less. An uninsured patient may be billed near list unless the lab offers a self-pay price.'], ['t-chg-wa', 'testosterone', 'Total testosterone, serum: average submitted (billed) charge to Medicare, Washington', '84403', 144.99, 'billed_charge', 'Labs billing Medicare', '2024', 'Medicare beneficiaries', 'cms-mup-geo-2024', 'A list price, as above.'], ['t-quest-dtc', 'testosterone', 'Testosterone test, direct to consumer (test $69 plus $6 physician service fee)', '84403', 75, 'consumer_cash', 'Quest Diagnostics (questhealth.com)', '2026-10-23', 'Patients 18 to 100 only', 'quest-testosterone', 'Not available for students under 18.'], ['t-labcorp-dtc', 'testosterone', 'Total Testosterone Test, direct to consumer (list price)', '84403', 69, 'consumer_cash', 'Labcorp OnDemand', '2026-10-23', 'Ages 18-100; site says clinically appropriate only for people assigned male at birth', 'labcorp-ondemand-testosterone', 'Shown on sale for $51.75 on 2026-10-23. Not available for students under 18.'], ['t-press', 'testosterone', 'Routine blood testosterone test without insurance, as reported', '', 162, 'press_reported', 'Reported by The Spokesman-Review (an op-ed attributes $162.75 to Labcorp)', '2026-09-27', 'Not stated', 'spokesman-2026-09-27', 'We could not find this price on a public Labcorp page.'], // Route 3: chromosome analysis (karyotype): culture 88230 + analysis 88262 + interpretation 88291 ['k-ah-88230', 'karyotype', 'Tissue culture, lymphocytes (karyotype step 1)', '88230', 93.19, 'payer_rate', 'Washington Apple Health (Medicaid)', '2026-10-01', 'All ages', 'hca-physician-fs', 'No prior authorization listed.'], ['k-ah-88262', 'karyotype', 'Chromosome analysis, count 15-20 cells, 2 karyotypes (step 2)', '88262', 100.39, 'payer_rate', 'Washington Apple Health (Medicaid)', '2026-10-01', 'All ages', 'hca-physician-fs', 'No prior authorization listed.'], ['k-ah-88291', 'karyotype', 'Cytogenetics interpretation and report (step 3)', '88291', 20.07, 'payer_rate', 'Washington Apple Health (Medicaid)', '2026-10-01', 'All ages', 'hca-physician-fs', ''], ['k-mcr-88230', 'karyotype', 'Tissue culture, lymphocytes: Medicare average allowed, U.S.', '88230', 113.29, 'payer_rate', 'Medicare Part B', '2024', 'Medicare beneficiaries', 'cms-mup-geo-2024', 'Only 147 services in 2024; most cytogenetics is billed by hospitals, outside this file.'], ['k-mcr-88262', 'karyotype', 'Chromosome analysis, 15-20 cells: Medicare average allowed, U.S.', '88262', 122.49, 'payer_rate', 'Medicare Part B', '2024', 'Medicare beneficiaries', 'cms-mup-geo-2024', '3,540 services in 2024.'], ['k-mcr-88291', 'karyotype', 'Cytogenetics interpretation (office setting): Medicare average allowed, U.S.', '88291', 34.38, 'payer_rate', 'Medicare Part B', '2024', 'Medicare beneficiaries', 'cms-mup-geo-2024', '35,722 services in 2024 (place of service O).'], ['k-chg-88230', 'karyotype', 'Tissue culture, lymphocytes: average billed charge, U.S.', '88230', 501.70, 'billed_charge', 'Labs billing Medicare', '2024', 'Medicare beneficiaries', 'cms-mup-geo-2024', ''], ['k-chg-88262', 'karyotype', 'Chromosome analysis, 15-20 cells: average billed charge, U.S.', '88262', 479.71, 'billed_charge', 'Labs billing Medicare', '2024', 'Medicare beneficiaries', 'cms-mup-geo-2024', ''], ['k-chg-88291', 'karyotype', 'Cytogenetics interpretation (office setting): average billed charge, U.S.', '88291', 80.78, 'billed_charge', 'Labs billing Medicare', '2024', 'Medicare beneficiaries', 'cms-mup-geo-2024', ''], ['k-press', 'karyotype', 'Chromosome testing, as reported', '', 1310, 'press_reported', 'Reported by The Spokesman-Review (an op-ed attributes "more than $1,300" to Labcorp)', '2026-09-27', 'Not stated', 'spokesman-2026-09-27', 'We could not find this price on a public Labcorp page.'], ['k-quest-dtc', 'karyotype', 'Chromosome analysis sold direct to consumers', '', null, 'consumer_cash', 'Quest Diagnostics (questhealth.com)', '2026-10-23', 'Not applicable', 'quest-catalog', 'Not offered: no chromosome, karyotype or SRY test in the consumer catalog.'], ['k-labcorp-dtc', 'karyotype', 'Chromosome analysis sold direct to consumers', '', null, 'consumer_cash', 'Labcorp OnDemand', '2026-10-23', 'Not applicable', 'labcorp-ondemand-catalog', 'Not offered: genetic tests listed are a celiac HLA test and a health-risk panel, not a sex-chromosome test.'], // Route 3b: SRY by FISH, component codes only (no published package price found) ['s-ah-88271', 'sry-fish', 'DNA probe, each (FISH), component', '88271', 17.14, 'payer_rate', 'Washington Apple Health (Medicaid)', '2026-10-01', 'All ages', 'hca-physician-fs', 'Component only. How a lab bills an SRY FISH test varies; we found no published price for an SRY test as a package.'], ['s-ah-88275', 'sry-fish', 'Interphase in situ hybridization, 100-300 cells, component', '88275', 40.95, 'payer_rate', 'Washington Apple Health (Medicaid)', '2026-10-01', 'All ages', 'hca-physician-fs', 'Component only.'], ['s-mcr-88271', 'sry-fish', 'DNA probe, each (FISH): Medicare average allowed, U.S.', '88271', 20.97, 'payer_rate', 'Medicare Part B', '2024', 'Medicare beneficiaries', 'cms-mup-geo-2024', 'Component only.'], ['s-mcr-88275', 'sry-fish', 'Interphase in situ hybridization, 100-300 cells: Medicare average allowed, U.S.', '88275', 50.08, 'payer_rate', 'Medicare Part B', '2024', 'Medicare beneficiaries', 'cms-mup-geo-2024', 'Component only.'], ]; const header = ['row_id', 'route', 'item', 'cpt_code', 'price_usd', 'price_type', 'payer_or_seller', 'as_of', 'eligible_patients', 'source_id', 'note']; const esc = (v) => { if (v === null || v === undefined) return ''; const s = String(v); return /[",\n]/.test(s) ? '"' + s.replace(/"/g, '""') + '"' : s; }; const csv = [header.join(',')].concat(rows.map((r) => r.map(esc).join(','))).join('\n') + '\n'; fs.writeFileSync(path.join(out, 'sex_verification_test_prices.csv'), csv); const cov = [ ['measure', 'geography', 'year', 'value', 'margin_of_error_90', 'unit', 'source_id'], ['Civilian noninstitutionalized population under 19', 'Washington', 2024, 1745961, '', 'people', 'acs-2024-dp03'], ['Under 19 with no health insurance coverage', 'Washington', 2024, 68017, '', 'people', 'acs-2024-dp03'], ['Under 19 with no health insurance coverage, percent', 'Washington', 2024, 3.9, 0.4, 'percent', 'acs-2024-dp03'], ]; fs.writeFileSync(path.join(out, 'wa_child_coverage.csv'), cov.map((r) => r.map(esc).join(',')).join('\n') + '\n'); // Derived sums used by the saved analyses const byId = Object.fromEntries(rows.map((r) => [r[0], r[4]])); const r2 = (x) => Math.round(x * 100) / 100; const sums = { karyotype_apple_health: r2(byId['k-ah-88230'] + byId['k-ah-88262'] + byId['k-ah-88291']), karyotype_medicare_allowed: r2(byId['k-mcr-88230'] + byId['k-mcr-88262'] + byId['k-mcr-88291']), karyotype_billed_charge: r2(byId['k-chg-88230'] + byId['k-chg-88262'] + byId['k-chg-88291']), }; fs.writeFileSync(path.join(out, 'derived_sums.json'), JSON.stringify(sums, null, 2) + '\n'); console.log(sums, rows.length, 'rows');