tuva-health / tuva

Main repo including core data model, data marts, reference data, terminology, and the clinical concept library
https://thetuvaproject.com/
189 stars 49 forks source link

ED Improvements #242

Closed aneiderhiser closed 1 year ago

aneiderhiser commented 1 year ago

These are the improvements I think we need to make for ED visit analytics.

aneiderhiser commented 1 year ago

Encounter

Create an "emergency department" encounter_type and ED encounter grouper in claims preprocessing, similar to the acute inpatient encounter grouper.

Use institutional claims as the base. An ED encounter should not be made up of only professional claims. An ED encounter could be made up of only institutional claims, but in theory this shouldn't be possible.

Assume multiple ED visits per day cannot occur at the same facility i.e. group by patient_id, facility_npi, date. We can improve this over time by adding primary diagnosis code criteria.

Start and end dates should be 1 day apart at most.

Primary dx should come from the institutional claim, not professional.

Paid, allowed, and charges should be the sum across institutional and professional

aneiderhiser commented 1 year ago

ED Classification Summary Table

The grain of this table should be changed to encounter - it's currently claim. The left most column should be encounter_id.

Here are the key fields - remove other fields:

A lot of this stuff is in the summary table today. Main thing is changing the grain to encounter.

thutuva commented 1 year ago

@aneiderhiser - I have a couple issues to run by you.

Adding CCSRs to the ED Classification summary table means that a user can't disable the CCSR mart and still run ED Classification. If they do disable CCSR and keep ED enabled, dbt throws an error. We have a few options:

  1. Leave it the way it is. We had discussed moving away from the single-mart adoption path so turning off CCSR should not be needed.
  2. Remove the ability to disable the CCSR mart
  3. Build logic that runs the CCSR even though it's been turned off in the dbt_project.yml because ED Classification is still enabled.

Changing ED Classification to run-off encounters requires me to know the code type for the primary diagnosis. There are 46 diagnosis codes that overlap in the two systems. So the options here:

  1. Add primary_diagnosis_code_type to the core.encounter data model
  2. Hope we never run into a collision of these 46 diagnosis codes.
aneiderhiser commented 1 year ago

I feel like the error is fine (if the run ED class w/o CCSR). We just note it in the docs e.g. readme. Is this the simplest thing to implement? Seems like it is.

I think primary dx should only be billable - not problem or admitting. Does that work?

thutuva commented 1 year ago

@aneiderhiser - For primary dx I'm talking about the field that tells someone if it's icd 9 or icd 10. In ed classification, there's an icd 9 and icd 10 value set. I need to know the code type of the primary dx to know which seed file to use.

aneiderhiser commented 1 year ago

Ahh got it. So we need to add primary_diagnosis_code_type like you mentioned above. That makes sense.

I'm not sure what you mean by 46 collisions. Can you elaborate?

thutuva commented 1 year ago

By collisions I mean there are 46 diagnosis codes that are shared between icd 9 and icd 10. I ran this analysis to see if having the code type even mattered because if the two data sets were mutually exclusive we wouldn't need the code type.