National-COVID-Cohort-Collaborative / Data-Ingestion-and-Harmonization

Data Ingestion and Harmonization
41 stars 12 forks source link

CMS: Medicare and Medicaid - ED to inpatient visit or Inpatient visit based on the revenue codes #113

Closed stephanieshong closed 1 week ago

stephanieshong commented 1 year ago

If the claim contains ED revenue code, then the visit created from this claim get assigned to ED->Inpatient visit for the entire claim instead of just Inpatient visit. Be sure to reference all revenue codes that can be found in multiple segments and multiple columns 1-45. And there should only be one visit created for the claim.

stephanieshong commented 1 week ago

The list of Revenue code within a claim is reviewed within a claim before selecting the visit_concept_id. This prevents us from creating two visits out of one claim.

df_ER = df_rev_codes_long.withColumn( "is_er", F.col("REV_CTR").isin(["0450", "0451", "0452", "0456", "0459", "0981"]) | F.col("TYPE_ADM").isin(["1", "5"]) )

stephanieshong commented 1 week ago

ip visit type prep: https://unite.nih.gov/workspace/data-integration/code/repos/ri.stemma.main.repository.eb91bc74-e3a4-4a41-9ed4-446e74109f6e/contents/refs%2Fheads%2Fmaster/transforms-python/src/cms/datasets/step03_prepared/ip_visit.py