Closed alastairmatheson closed 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.
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.
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:
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.