PHSKC-APDE / claims_data

Process and analyze WA State Medicaid, Medicare, and All-Payer Claims Database eligibility and claims data
21 stars 4 forks source link

claims_elig returns strange combinations #63

Closed alastairmatheson closed 4 years ago

alastairmatheson commented 4 years ago

There seem to be a few edge cases of combinations of values returned by claims_elig that should not exist. For example: pha_2018 <- claims_elig(conn = db_apde, source = "mcaid_mcare_pha", from_date = "2018-01-01", to_date = "2018-12-31", show_query = F)

pha_2018 %>% filter(mcaid == 1) %>% group_by(pha_agency, pha_subsidy) %>% summarise(count = n())

Produces this:

pha_agency pha_subsidy count
KCHA HARD UNIT 8482
KCHA TENANT BASED/SOFT UNIT 22337
SHA HARD UNIT 14365
SHA TENANT BASED/SOFT UNIT 8418
SHA NA 2
Non-PHA HARD UNIT 2
Non-PHA TENANT BASED/SOFT UNIT 9
Non-PHA NA 461086

Need to figure out why people who match to non-PHA (which was a recode from pha_agency == NA) are showing up with PHA subsidy types.

alastairmatheson commented 4 years ago

@dcolombara I assigned you just in case you get a chance to look into this before I do, but I'll take a look later this week or sometime next week.

alastairmatheson commented 4 years ago

I've looked into some examples of situations with incongruent combinations. They arise when a person has several rows in the timevar table. For example, one person from the table above was in Medicaid only for 153 days of the year and the rest of their time was split between KCHA (59 days) and SHA (153 days). Because of the sorting, Non-PHA was selected above SHA to break the tie at 153 days. They were in a hard unit property for all their time at KCHA and SHA (212 days total), hence why that was returned for the pha_subsidy field.

Due to the complexity of trying to resolve such combinations, and the fact that relatively few people are affected by this, no changes are planned for the claims_elig function. I'll add a note to the details section of the function.

alastairmatheson commented 4 years ago

Noted here: https://github.com/PHSKC-APDE/claims_data/commit/c631f4c019a945ac77ce28812da23696510d8841