Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor connector: Add adjustment logic and better enrollment dates #68

Merged
merged 21 commits into from
Nov 21, 2024

Conversation

sarah-tuva
Copy link
Member

@sarah-tuva sarah-tuva commented Nov 12, 2024

Describe your changes

Please include a summary of any changes.

  • Update package version range to Tuva v0.12.x
  • Update project config defaults
  • Add adjustment logic for DME claims
  • Add adjustment logic for institutional claims
  • Add adjustment logic for physician claims
  • Add part D mapping and adjustment logic for pharmacy claims
  • Add dbt tests for final models
  • Add new enrollment file logic to populate eligibility dates with custom source
    • Background: The CCLF specification does not have a field that can be mapped directly to enrollment_start_date and enrollment_end_date, and the Part A and Part B entitlement dates (BENE_PART_A_ENRLMT_BGN_DT, BENE_PART_B_ENRLMT_BGN_DT) are often incorrect or not useful for claims analytics.
    • Enhancement: We have included an additional source called Enrollment that can be populated with enrollment dates relevant to your data. These enrollment dates may come from an attribution file, beneficiary alignment report (BAR), or any source you may have.

How has this been tested?

Please describe the tests you ran to verify your changes. Provide instructions or code to reproduce output.

Ran dbt build with original connector and refactored connector. Validated and compared output results.

Reviewer focus

Please summarize the specific items you’d like the reviewer(s) to look into.

Checklist before requesting a review

  • (Optional) I have recorded a Loom performing a self-review of my code
  • My code follows style guidelines
  • I have commented my code as necessary
  • (New models only) I have implemented generic dbt tests to validate primary keys/uniqueness in my model
  • I have added at least one Github label to this PR

(Optional) Gif of how this PR makes you feel

Loom link

https://www.loom.com/share/7537bfa98fba4a6f95c86796fbe4bca0?sid=18ce83eb-cf84-4b6e-96dc-d349c374aec5

@sarah-tuva sarah-tuva added the enhancement New feature or request label Nov 12, 2024
@sarah-tuva sarah-tuva changed the title Refactor connector: Add adjustment logic and enrollment dates Refactor connector: Add adjustment logic and better enrollment dates Nov 12, 2024
@sarah-tuva
Copy link
Member Author

sarah-tuva commented Nov 14, 2024

CI/CD has not be setup for Fabric yet. Locally testing passed.

fabric_ci_results.txt

Copy link

@chase-jones chase-jones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raising a couple of concerns @sarah-tuva . Would like to have more time to go through if possible. Concern that some claims would be getting thrown out incorrectly with logic as it stands.

and sort_adjusted_claims.clm_from_dt = header_totals.clm_from_dt
and sort_adjusted_claims.clm_thru_dt = header_totals.clm_thru_dt
and sort_adjusted_claims.current_bene_mbi_id = header_totals.current_bene_mbi_id
where sort_adjusted_claims.row_num = 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of this sort being between different models for row_num.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chase-jones Can you elaborate? I'm not following your concern here.

and sort_adjusted_claims.clm_thru_dt = header_totals.clm_thru_dt
and sort_adjusted_claims.current_bene_mbi_id = header_totals.current_bene_mbi_id
where sort_adjusted_claims.row_num = 1
and sort_adjusted_claims.clm_adjsmt_type_cd <> '1'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concern in that logic of

row_number() over (
            partition by
                  clm_blg_prvdr_oscar_num
                , clm_from_dt
                , clm_thru_dt
                , current_bene_mbi_id
            order by
                  clm_efctv_dt desc
                , cur_clm_uniq_id desc
        )

in models/intermediate/int_institutional_claim_adr.sql
might be non deterministic where here is a 0 and 1 in the same instance for adj reason codes. If this picks the 1, then the entire claim get's thrown out? But if it picks 0 then you get the latest claim?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my exploration of real data, CMS does not always send the proper adjustment type codes for adjusted claims. They were often sending a '0' instead of a '2' for an adjusted claim, so it was unreliable in the sorting logic. This is why we are using the latest claim effective date and claim ID to try to ensure the adjusted claims get selected rather than the canceled claims. Again, this is all based on my own testing with real data (from multiple claim years), but everyone's dataset may be different.

Do you have a suggestion for better sorting logic based on your experience?

@sarah-tuva
Copy link
Member Author

@bradmontierth @chase-jones I have a few people waiting to use this connector. Can I get approval on this PR? I would like to merge it as is. We've tested it on a few real data sets, and the ADR logic seems to be working okay. We can push a patch later if someone comes up with better logic for ADR.

@bradmontierth bradmontierth merged commit f450a26 into main Nov 21, 2024
3 checks passed
@bradmontierth bradmontierth deleted the refactor-connector branch November 21, 2024 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Ready to Release
Development

Successfully merging this pull request may close these issues.

3 participants