Skip to main content

Komodo Bill Type Coverage for SSP Encounters

Date: 2026-04-20 Source tables:

  • tq_dev.internal_dev_csong_ssp.medical_headers_both
  • tq_dev.internal_dev_csong_ssp.medical_service_lines_both
  • tq_dev.internal_dev_csong_ssp.ssp_groupings_v3 (ssp-grouper anchor codes)

Scope: year >= 2024 (matches the SSP pricing pipeline's claim filter).

Question

How many distinct encounters (encounter_key) fall outside the SSP pricing pipeline's current encounter-matching filters?

Specifically:

  1. Critical access (bill_type_code starts with 85 or 86) — CAH claims are classified claim_pos = 'other' and so are skipped by ssp_encounter_matches_op (filters claim_pos = 'OP'). Coverage is measured against OP SSPs (CPT/HCPCS anchors) since the bulk of CAH volume is outpatient lab / imaging / ER / E&M rather than inpatient stays.
  2. ASC (bill_type_code starts with 83) — skipped by ssp_encounter_matches_op (filters claim_pos = 'OP'); coverage measured against OP SSPs (CPT/HCPCS anchors).
  3. Physician-group / professional onlyclaim_pos = 'PRO' visits whose visit_id has no facility (non-PRO) claim at all.

Headline numbers

CategorySSPs consideredDistinct encountersMatchedMatch rate
Critical access (85/86)OP (CPT/HCPCS) SSPs15,199,39012,286,56480.8%
ASC (83)OP (CPT/HCPCS) SSPs20,308,50916,211,54679.8%
PRO-only (no facility)OP (CPT/HCPCS) SSPs2,600,727,525~1.68 B (0.1% sample)64.7%

Match rate = share of the category's distinct encounters that join to at least one SSP anchor code. All three categories match CPT/HCPCS procedure codes on medical_service_lines_both against the CPT/HCPCS anchors in ssp_groupings_v3. An encounter is counted as "matched" if any of its service lines lands on an in-scope anchor — it tells us how many of these otherwise-skipped encounters the SSP pipeline could capture if its filters were widened.

CAH volume is dominated by outpatient labs, ER, imaging, and E&M — an OP-anchored scope picks up ~81% of CAH encounters, vs. the ~2% a DRG-based IP scope would reach (only 2.5% of CAH encounters report a diagnosis_group at all).

Baseline medical_headers_both distribution (year >= 2024)

Categorybill_type_code prefixclaim_posDistinct encounters
Hospital outpatient13%OP358,584,676
Hospital inpatient11%IP21,418,872
Critical access85%, 86%other15,199,390
ASC83%other20,308,509
Professional(null)PRO3,886,009,642
All rows4,590,706,144

Visit composition (year >= 2024)

Visit categoryDistinct visitsPRO rowsnon-PRO rows
PRO-only visit (no facility claim)2,349,235,7872,600,727,5250
Facility-only visit301,111,6130340,964,439
PRO + facility visit112,022,6501,285,282,119363,732,063

The PRO-only visit class is the overwhelming majority of the medical_headers_both volume — 2.35B visits vs 413M visits that have at least one facility claim.

1. Critical access (bill_type_code LIKE '85%' OR '86%')

CAH claims are classified claim_pos = 'other' and so are skipped by the SSP pricing pipeline's OP matcher. Match CAH encounters to OP (CPT/HCPCS) SSPs via medical_service_lines_both — this picks up the outpatient lab / imaging / ER / E&M volume that makes up the bulk of CAH activity.

  • Distinct encounters: 15,199,390
  • Encounters matched to at least one OP (CPT/HCPCS) SSP: 12,286,564 (80.8%)
  • Encounter × SSP pairs: 20,429,874
  • Distinct OP SSPs touched: 164

Top SSPs for CAH encounters (full TSV: cah_by_op_ssp.tsv):

OP SSPEncounters
LA.0.blood_test5,269,785
EM.0.ER2,342,327
RA.0.xray1,999,065
CO.0.op_clinic1,820,698
LA.0.urinalysis1,231,499
RA.0.CT1,033,688
RA.0.cardiography1,013,636
RH.0.pt998,516
CO.0.IV_push748,931
RA.0.ultrasound551,359
RA.0.mammogram444,699
CO.0.IV_infusion442,112
RA.0.mri291,262
BE.0.substance_abuse228,818
RA.0.echocardiography175,861

Blood tests, ER visits, outpatient clinic E&M, imaging, and physical therapy dominate CAH OP volume.

2. ASC (bill_type_code LIKE '83%')

  • Distinct encounters: 20,308,509
  • Encounters that match at least one SSP anchor code: 16,211,546 (79.8%)
  • Encounter × SSP pairs: 19,387,025

Top SSPs for ASC encounters (full TSV: op_ssps_by_bill_category.tsv):

SSPEncounters
GA.0.colonoscopy7,021,310
GA.0.egd3,055,884
OP.0.cataract_removal2,469,360
NU.0.nerve_block1,374,260
MS.0.surgical_knee_repair403,606
EM.1.m_other_factors352,183
MS.0.surgical_shoulder_repair334,902
EN.0.tonsil_removal285,765
UR.0.cystourethroscopy283,085
MS.0.excision_hand_wrist242,359

3. Physician-group / PRO-only visits

PRO-only = a visit_id whose only rows in medical_headers_both are claim_pos = 'PRO'.

Full-population counts:

  • Distinct PRO-only visits: 2,349,235,787
  • Distinct PRO-only encounters: 2,600,727,525

Coverage on a 0.1% visit-hash sample (2,349,170 visits → 2,599,490 encounters; sample matches the full population to 4 significant digits):

  • Encounters matched to at least one SSP anchor: 1,682,396 / 2,599,490 = 64.7%
  • Extrapolated: ~1.68 B PRO-only encounters map to an SSP.
  • Encounter × SSP pairs in sample: 1,943,351 (many PRO-only encounters touch only one SSP vs. CAH/ASC which often touch several).

Top SSPs for PRO-only encounters (sample counts × 1,000 ≈ full population; full TSV: pro_only_by_ssp.tsv):

SSPSample encountersExtrapolated
CO.0.op_clinic754,966754,966,000
LA.0.blood_test238,142238,142,000
RH.0.pt199,284199,284,000
BE.0.psychotherapy127,893127,893,000
RA.0.xray90,91190,911,000
LA.0.urinalysis69,12569,125,000
RA.0.cardiography53,39953,399,000
CO.0.vaccine51,07151,071,000
RA.0.ultrasound48,99548,995,000
EM.0.ER48,34148,341,000

These are dominated by office-visit / E&M-style anchors (office clinic, psychotherapy, PT) that legitimately wouldn't have a facility claim.

All OP SSPs by bill-type category

All 167 SSPs with CPT/HCPCS anchor codes (OP-style). Columns are full-population distinct encounters (for ASC) or 0.1% visit-hash sample counts with ×1000 extrapolation (for PRO-only). CAH per-SSP counts are reported separately in section 1 (cah_by_op_ssp.tsv) — same OP-anchor join rule. Sorted by ASC + (PRO-only × 1,000) descending.

Full TSV: op_ssps_by_bill_category.tsv.

OP SSPASCPRO-only (sample)PRO-only (×1000)
CO.0.op_clinic18,568754,966754,966,000
LA.0.blood_test60,096238,142238,142,000
RH.0.pt15,572199,284199,284,000
BE.0.psychotherapy5,022127,893127,893,000
RA.0.xray36,54890,91190,911,000
LA.0.urinalysis57,89669,12569,125,000
RA.0.cardiography21,33853,39953,399,000
CO.0.vaccine56351,07151,071,000
RA.0.ultrasound109,91448,99548,995,000
EM.0.ER6,74248,34148,341,000
RA.0.CT8,32228,92828,928,000
LA.0.pathology135,05823,89823,898,000
RH.0.st26220,85220,852,000
RA.0.mammogram1,61119,34219,342,000
RA.0.mri6,10616,08416,084,000
GA.0.colonoscopy7,021,3106,3496,349,000
RA.0.echocardiography1,10012,92212,922,000
MS.0.arthrocentesis101,96311,93011,930,000
BE.0.psych_eval3897,8937,893,000
ON.0.chemotherapy3867,6087,608,000
DE.0.actinic_destruction1617,3777,377,000
GA.0.egd3,055,8843,7873,787,000
CO.0.IV_infusion13,1616,6486,648,000
OP.0.cataract_removal2,469,3603,2473,247,000
EM.0.critical_care1245,6625,662,000
DE.0.skin_biopsy1,4575,3375,337,000
CO.0.IV_push12,7775,2435,243,000
NU.0.nerve_block1,374,2603,8153,815,000
EM.0.wound_treatment44,4165,0955,095,000
RA.0.CTA5564,7584,758,000
RA.0.dexa8494,5464,546,000
RA.0.audiology243,8083,808,000
EM.0.debridement10,0793,3693,369,000
UR.0.cystourethroscopy283,0852,5482,548,000
MS.0.trigger_point_injection37,5112,5992,599,000
OB.0.fetal_biophysical462,3862,386,000
BE.0.substance_abuse2,4002,2502,250,000
NU.0.sleep_study1,8672,2392,239,000
RH.0.ot9,5092,1602,160,000
RA.0.mpi762,0512,051,000
CO.0.allergy_testing51,7621,762,000
LA.0.genomic6331,7251,725,000
RA.0.PET291,7201,720,000
ON.0.imrt_planning3791,7191,719,000
DE.0.skin_lesion73,0671,6061,606,000
EN.0.laryngoscopy17,5951,3691,369,000
DE.0.cyst_aspiration63,9371,2271,227,000
DE.0.mohs3,1451,0571,057,000
CA.0.cardiac_catheterization24,403837837,000
MS.0.knee_replacement205,531623623,000
MS.0.surgical_shoulder_repair334,902314314,000
MS.0.surgical_knee_repair403,606243243,000
DE.0.lesion_biopsy_percutaneous8,146604604,000
EN.0.tonsil_removal285,765273273,000
MS.0.excision_hand_wrist242,359305305,000
ON.0.imrt51543543,000
MS.0.hip_replacement116,081380380,000
CA.0.varicose_ablation12,592467467,000
RH.0.cardiac27470470,000
EN.0.sinus_surgery100,273366366,000
RE.0.prostate_biopsy81,464378378,000
RE.0.hysteroscopy144,089303303,000
GA.0.cholecystectomy51,956340340,000
DE.0.fine_needle_biopsy1,794324324,000
EN.0.nasal_repair_surg165,190145145,000
GA.0.hernia_repair73,938234234,000
OB.1.delivery119268268,000
RA.0.cardiac_PET1261261,000
MS.0.ns_wrist_fracture4,329253253,000
MS.0.laminectomy_lumbar47,162210210,000
CA.0.PCI6,025251251,000
OP.0.retinal_repair113,245142142,000
PU.0.bronchoscopy3,572248248,000
RE.0.hysterectomy13,316219219,000
GA.0.sigmoidoscopy73,037150150,000
RE.0.ovarian_surgery43,696161161,000
HE.1.bone_marrow_biopsy3,429201201,000
MS.0.surgical_shoulder_replacement36,771166166,000
MS.0.cervical_ACDF19,718176176,000
BE.0.psychoses1,928192192,000
DE.0.tumor_local_excision59,221132132,000
HE.1.CVC17,553172172,000
NU.0.spinal_neurostimulator66,897118118,000
HE.0.lymph_node_biopsy18,560165165,000
UR.0.circumcision29,790152152,000
MS.0.spine_fusion_lumbar10,786152152,000
MS.0.surg_acl_repair99,4635050,000
MS.0.surgical_hip_fracture27,362122122,000
GA.0.appendectomy2,561139139,000
MS.0.ns_hand_fracture1,806139139,000
MS.0.ns_foot_fracture557139139,000
RA.0.EPS587138138,000
ON.0.SRS32130130,000
DE.0.lesion_localization2,107125125,000
ON.1.mastectomy23,852101101,000
MS.0.ns_tibia_fracture643108108,000
CA.0.pacemaker_insertion3,7539595,000
GA.0.colectomy329696,000
MS.0.surg_hand_arthroplasty42,7185353,000
OP.0.glaucoma_surg41,5364949,000
NU.0.SNS_insertion26,3906363,000
CA.0.rhythm_monitor7,9958181,000
BE.0.electroconvulsive308787,000
RA.0.vascular_embolization1,2217878,000
MS.0.knee_hip_revision2,0027676,000
ME.0.thyroid_parathyroid_surgery10,6856464,000
GA.0.liver_biopsy1,2277373,000
NU.0.SNS_programming2,0296969,000
MS.0.ns_arm_fracture1737070,000
EN.0.middle_ear_mastoid_surg28,5764141,000
UR.0.av_access_dialysis9,8405454,000
HE.0.lymphadenectomy2,4835959,000
ON.0.mastectomy6,4925454,000
RE.0.cervical_excision13,4674747,000
CA.0.ICD_replacement4,2805555,000
PU.0.thoracoscopy915858,000
UR.0.turp8,8874848,000
MS.0.ns_shoulder_fracture345252,000
MS.0.ns_ankle_fracture3204747,000
ON.1.breast_reconstruction8,7663838,000
BE.0.SA_pharmacotherapy04646,000
RE.0.prostatectomy8904343,000
MS.0.VCF_treatment3,5644040,000
CA.0.pacemaker_replacement3,0523333,000
MS.0.surg_ankle_repair20,8121515,000
CA.0.carotid_revascularization323333,000
RA.0.parathyroid_scan93232,000
UR.0.hydrocelectomy9,5102121,000
UR.0.nephrectomy1743030,000
DE.0.pilonidal_cyst11,7131717,000
RA.0.mra132525,000
RA.0.mre02525,000
RE.0.colpopexy_pelvic_floor8072323,000
MS.0.ns_nose_fracture10,4271010,000
PU.0.vena_cava_filter1542020,000
RA.0.qMRI11919,000
UR.0.bladder_neck3,9781515,000
ON.0.breast_recon_revision7,4041111,000
MS.0.ns_knee_fracture181717,000
NU.0.intrathecal_pump4,1571212,000
UR.0.urethroplasty4,1531111,000
EN.0.parotid_excision3,0161212,000
CA.0.leadless_pacemaker111414,000
DE.0.panniculectomy3,0901010,000
GA.0.pancreatectomy11313,000
MS.0.arthrotomy_hand_wrist5,84177,000
MS.0.cervical_disc_replacement7,51555,000
CA.0.cardiac_biopsy381212,000
DE.0.tumor_radical_resection6771111,000
RE.0.myomectomy1,6731010,000
MS.0.ns_thigh_fracture631111,000
UR.1.kidney_transplant01111,000
MS.0.surg_ankle_replacement1,54499,000
CA.0.thromboembolectomy181010,000
MS.0.ns_spine_fracture099,000
MS.0.ns_hip_fracture1088,000
MS.0.ns_pelvic_fracture20077,000
NU.0.cranial_neurostimulator45366,000
RA.0.mrs144,000
DE.0.lesion_biopsy_open40333,000
MS.0.ns_collarbone_fracture822,000
RA.0.ablation32700
MS.0.arthrotomy_foot_ankle7700
MS.0.ns_jaw_fracture1000
MS.0.ns_sternum_fracture400
MS.0.ns_facial_fracture300
RE.0.brachytherapy000

SQL

Baseline distribution

SELECT
SUBSTR(bill_type_code, 1, 2) AS bt_prefix,
claim_pos,
COUNT(*) AS row_count,
COUNT(DISTINCT encounter_key) AS encounter_count
FROM tq_dev.internal_dev_csong_ssp.medical_headers_both
WHERE year >= 2024
GROUP BY 1, 2
ORDER BY row_count DESC;

Visit composition

WITH visit_pos AS (
SELECT
visit_id,
COUNT_IF(claim_pos = 'PRO') AS pro_rows,
COUNT_IF(claim_pos != 'PRO') AS nonpro_rows
FROM tq_dev.internal_dev_csong_ssp.medical_headers_both
WHERE year >= 2024
GROUP BY visit_id
)
SELECT
CASE
WHEN pro_rows > 0 AND nonpro_rows = 0 THEN 'pro_only_visit'
WHEN pro_rows > 0 AND nonpro_rows > 0 THEN 'pro_plus_facility_visit'
WHEN pro_rows = 0 AND nonpro_rows > 0 THEN 'facility_only_visit'
END AS visit_category,
COUNT(*) AS n_visits,
SUM(pro_rows) AS total_pro_rows,
SUM(nonpro_rows) AS total_nonpro_rows
FROM visit_pos
GROUP BY 1
ORDER BY n_visits DESC;

CAH encounters by OP (CPT/HCPCS) SSP

Same join shape as the ASC query below — CAH headers → service lines → CPT/HCPCS anchors.

WITH anchors AS (
SELECT DISTINCT ssp_grouper, code AS anchor_code
FROM tq_dev.internal_dev_csong_ssp.ssp_groupings_v3
WHERE ssp_grouper IS NOT NULL AND type IN ('CPT', 'HCPCS')
),
cah_headers AS (
SELECT DISTINCT encounter_key
FROM tq_dev.internal_dev_csong_ssp.medical_headers_both
WHERE year >= 2024
AND (bill_type_code LIKE '85%' OR bill_type_code LIKE '86%')
),
matched AS (
SELECT h.encounter_key, a.ssp_grouper
FROM cah_headers h
JOIN tq_dev.internal_dev_csong_ssp.medical_service_lines_both msl
ON h.encounter_key = msl.encounter_key
AND msl.year >= 2024
JOIN anchors a ON msl.procedure_code = a.anchor_code
WHERE msl.procedure_code IS NOT NULL
)
SELECT ssp_grouper, COUNT(DISTINCT encounter_key) AS encounter_count
FROM matched
GROUP BY 1
ORDER BY encounter_count DESC;

ASC encounters by OP (CPT/HCPCS) SSP

WITH anchors AS (
SELECT DISTINCT ssp_grouper, code AS anchor_code
FROM tq_dev.internal_dev_csong_ssp.ssp_groupings_v3
WHERE ssp_grouper IS NOT NULL AND type IN ('CPT', 'HCPCS')
),
asc_headers AS (
SELECT encounter_key
FROM tq_dev.internal_dev_csong_ssp.medical_headers_both
WHERE year >= 2024
AND bill_type_code LIKE '83%'
),
matched AS (
SELECT h.encounter_key, a.ssp_grouper
FROM asc_headers h
JOIN tq_dev.internal_dev_csong_ssp.medical_service_lines_both msl
ON h.encounter_key = msl.encounter_key
AND msl.year >= 2024
JOIN anchors a ON msl.procedure_code = a.anchor_code
WHERE msl.procedure_code IS NOT NULL
)
SELECT ssp_grouper, COUNT(DISTINCT encounter_key) AS encounter_count
FROM matched
GROUP BY 1
ORDER BY encounter_count DESC;

PRO-only visit encounters by SSP (0.1% visit-hash sample)

rand()-based visit sampling blew the per-node memory limit because the GROUP BY visit_id runs across all 2.35 B PRO-only visits before sampling. Switching to a deterministic visit-hash sample avoids the hash-builder blowup — every row is filtered out in the scan, so the GROUP BY only sees a 0.1% slice. Results are materialized into tmp_pro_only_visit_sample so the downstream SSP join reuses the same sample.

-- Step 1: build the sample table (0.1% of visit_ids via xxhash64 mod 1000)
CREATE OR REPLACE TABLE tq_dev.internal_dev_csong_ssp.tmp_pro_only_visit_sample AS
WITH sampled_headers AS (
SELECT visit_id, encounter_key, claim_pos
FROM tq_dev.internal_dev_csong_ssp.medical_headers_both
WHERE year >= 2024
-- xxhash64(visit_id) mod 1000 == 0 → deterministic 0.1% sample of visit_ids
AND MOD(ABS(from_base(SUBSTR(to_hex(xxhash64(CAST(visit_id AS VARBINARY))), 1, 14), 16)), 1000) = 0
),
pro_only AS (
SELECT visit_id
FROM sampled_headers
GROUP BY visit_id
HAVING COUNT_IF(claim_pos != 'PRO') = 0
)
SELECT DISTINCT h.encounter_key, h.visit_id
FROM sampled_headers h
JOIN pro_only p ON h.visit_id = p.visit_id
WHERE h.claim_pos = 'PRO';

-- Step 2: overall PRO-only match rate
WITH anchors AS (
SELECT DISTINCT code AS anchor_code
FROM tq_dev.internal_dev_csong_ssp.ssp_groupings_v3
WHERE ssp_grouper IS NOT NULL AND type IN ('CPT', 'HCPCS')
),
sample_encs AS (
SELECT encounter_key
FROM tq_dev.internal_dev_csong_ssp.tmp_pro_only_visit_sample
),
matched AS (
SELECT DISTINCT s.encounter_key
FROM sample_encs s
JOIN tq_dev.internal_dev_csong_ssp.medical_service_lines_both msl
ON s.encounter_key = msl.encounter_key AND msl.year >= 2024
JOIN anchors a ON msl.procedure_code = a.anchor_code
)
SELECT
(SELECT COUNT(*) FROM sample_encs) AS total_sample,
(SELECT COUNT(*) FROM matched) AS matched_sample;

-- Step 3: PRO-only match by SSP (multiply by 1000 for full-population estimate)
WITH anchors AS (
SELECT DISTINCT ssp_grouper, code AS anchor_code
FROM tq_dev.internal_dev_csong_ssp.ssp_groupings_v3
WHERE ssp_grouper IS NOT NULL
AND type IN ('CPT', 'HCPCS')
),
matched AS (
SELECT s.encounter_key, a.ssp_grouper
FROM tq_dev.internal_dev_csong_ssp.tmp_pro_only_visit_sample s
JOIN tq_dev.internal_dev_csong_ssp.medical_service_lines_both msl
ON s.encounter_key = msl.encounter_key
AND msl.year >= 2024
JOIN anchors a ON msl.procedure_code = a.anchor_code
)
SELECT ssp_grouper, COUNT(DISTINCT encounter_key) AS encounter_count_sample
FROM matched
GROUP BY 1
ORDER BY encounter_count_sample DESC;