Skip to main content

Pipeline DAG and Table Dependencies


Pipeline DAG

The diagram below shows the execution order and data dependencies of the pricing pipeline. Each node is a script that produces one or more output tables. Arrows indicate "must run before."

ssp_groupings
|
+---> manual_institutional_line_codes
| |
+---> manual_professional_line_codes
| |
+---> supplemented_sub_package_contents
| |
+---> revenue_code_family_proportions
| |
+---> institutional_line_codes ---> institutional_rc_family_allocation
| |
+---> ancillary_provider_types
| |
+---> institutional_fee_schedule
| |
+---> professional_line_codes ---> professional_ncci_groups
| |
+---> professional_fee_schedule
| |
+---> prices (combined_subcategory + combined_ssp)
| |
+---> combo_ssps

Steps run top-to-bottom. Each step depends on ssp_groupings and typically on the step(s) directly above it. The two side branches (institutional_rc_family_allocation and professional_ncci_groups) are produced within their parent scripts and feed back into downstream steps.


Table Dependency Matrix

Each row is an output table. Columns indicate which upstream tables it reads from. An X means the row table depends on the column table.

Output tablessp_groupingsmanual_inst_line_codesmanual_prof_line_codessupplemented_sub_pkgrev_code_family_proportionsinstitutional_line_codesinst_rc_family_allocationancillary_provider_typesinstitutional_fee_scheduleprofessional_line_codesprof_ncci_groupsprofessional_fee_schedule
manual_institutional_line_codesX
manual_professional_line_codesXX
supplemented_sub_package_contentsXX
revenue_code_family_proportionsX
institutional_line_codesXXX
institutional_rc_family_allocationXX
ancillary_provider_typesXX
institutional_fee_scheduleX
professional_line_codesXXX
professional_ncci_groupsX
professional_fee_scheduleXX
combined_subcategory_fee_scheduleXXX
combined_ssp_fee_scheduleXXX
combo_ssps

Note: combo_ssps reads from and writes to combined_ssp_fee_schedule and combined_subcategory_fee_schedule directly (INSERT statements).


Entity Relationship Summary

Key tables and the columns used to join them together.

Table AJoin Key(s)Table B
ssp_groupingscode = base_codesupplemented_sub_package_contents
ssp_groupingscode = anchor_codemanual_institutional_line_codes
ssp_groupingscode = anchor_codemanual_professional_line_codes
ssp_groupingsssp_grouperrevenue_code_family_proportions
ssp_groupingsssp_grouper, sub_category, codeinstitutional_fee_schedule (via national_benchmarks + medicare)
supplemented_sub_package_contentsbase_code, line_codeinstitutional_line_codes
supplemented_sub_package_contentsbase_code, line_code, fee_typeprofessional_line_codes
institutional_line_codesssp_grouper, revenue_code_familyinstitutional_rc_family_allocation
institutional_rc_family_allocationssp_grouper, sub_category, pos, provider_idinstitutional_fee_schedule
professional_line_codesssp_grouper, service_type, line_codeprofessional_ncci_groups
institutional_fee_schedulessp_grouper, sub_category, pos, provider_idcombined_subcategory_fee_schedule
professional_fee_schedulessp_grouper, sub_category, pos, provider_idcombined_subcategory_fee_schedule
institutional_rc_family_allocationssp_grouper, sub_category, pos, provider_idcombined_subcategory_fee_schedule (carve-outs)
new_id_crosswalkold_ssp_grouper, sub_categorycombined_subcategory_fee_schedule
combined_ssp_fee_schedulessp_grouper, pos, provider_idcombo_ssps (self-join on two source SSPs)

Source Tables

External tables from tq_production and other shared schemas consumed by the pipeline.

SSP Definitions

Source tablePurpose
tq_production.standard_service_packages.sub_package_contentsCanonical mapping of base codes to line codes, fee types, and association rates
tq_production.standard_service_packages.sub_packagesSSP-level metadata including sub_package_total_billed_count (claim volume)

Medicare Reference Pricing

Source tablePurpose
tq_production.reference_external.ipps_reference_pricingInpatient Medicare rates by MS-DRG (IPPS)
tq_production.reference_external.opps_reference_pricingOutpatient Medicare rates by APC (OPPS)
tq_production.reference_external.physician_reference_pricingProfessional Medicare rates by HCPCS and state (MPFS)
tq_production.reference_external.clinical_laboratory_reference_pricingClinical lab Medicare rates (CLFS), national fallback
tq_production.reference_internal.anesthesia_reference_pricingAnesthesia Medicare rates by HCPCS and state
tq_production.reference_external.asp_reference_pricingAverage Sales Price for drugs -- used to identify drug carve-out codes

Provider and Service Spines

Source tablePurpose
tq_production.spines.spines_provider_hospitalsMaps provider_id to provider_state for state-level Medicare rate lookup
tq_production.spines.spines_servicesService code metadata (descriptions, types)
tq_production.spines.spines_services_relationshipsLinks services to clinical categories
tq_production.spines.spines_services_clinical_categoriesClinical category labels (e.g., Radiology, Anesthesia) used for service type classification

Coding References

Source tablePurpose
tq_production.reference_legacy.ref_aapc_cpthierarchyAAPC CPT hierarchy -- used to identify implant/device C-codes, Q-codes, and L-codes for carve-outs
redshift_datahouse.internal_reference.ref_cms_ncci_ptp_edits_practitioner_v2CMS NCCI Procedure-to-Procedure edits -- identifies mutually exclusive code pairs for NCCI grouping

Commercial Benchmark Rates

Source tablePurpose
tq_dev.internal_dev_csong_cld_v2_4_2.prod_combined_abridgedMedian commercial canonical rates from the Clear Rates dataset, used as the primary commercial price benchmark

Claims Data (for line code discovery and association rates)

Source tablePurpose
tq_dev.internal_dev_csong_sandbox.medical_headersInstitutional claim headers -- used for encounter matching
tq_dev.internal_dev_csong_sandbox.medical_service_linesInstitutional service lines -- used for procedure code and revenue code extraction
tq_dev.internal_dev_csong_sandbox.medical_headers_professionalProfessional claim headers -- used for professional encounter matching
tq_dev.internal_dev_csong_sandbox.medical_service_lines_professionalProfessional service lines -- used for professional line code discovery
tq_intermediate.external_komodo.ipps_grouper_drgsDRG assignment per encounter -- used for inpatient anchor code matching

Revenue Code References

Source tablePurpose
tq_intermediate.cld_utils.rc_to_hcpcs_cross_validated_75Revenue code to HCPCS crosswalk -- fallback for mapping line codes to revenue code families
tq_dev.standard_service_packages.sub_package_contents_w_rev_codesEnriched sub_package_contents with revenue codes for Facility Fee rows