OHDSI Home | Forums | Wiki | Github

Claims conundrum: all NULLs in VISIT_OCCURRENCE_ID in drug exposure table

Hi All - We’re trying to leverage the drug_exposure table and the visit_occurrence tables to categorize drug exposure by specific concept IDs. We bought these data in the OMOP CDM v5 from a major third party claims vendor and did not convert these ourselves.

Our query looks something like this:
select count(*)
FROM omop_claims.DRUG_EXPOSURE de
JOIN omop_claims.VISIT_OCCURRENCE V on de.visit_occurrence_id = V.visit_occurrence_id and de.person_id = V.person_id
and V.visit_concept_id in (42898160,9201,9202,9203)
where de.drug_concept_id in (36247192,
36247191,
44815763,
44815761)

We really care about allowing a user to filter on the visit_concept associated to the drug exposure, if it exists at all. The output of this query was 0. When we investigated, we found that the culprit was NULLs in the VISIT_OCCURRENCE_ID.

I was digging around and found this chain from Visit_concept_id for pharmacy claim data:

I totally get that NULLs can occur for legitimate reasons but I’m confused a bit by all NULLs. I found my other claims data set also had all NULLs for VISIT_OCCURRENCE_ID. I would expect that a large amount of values may be null but I’m slightly confused that there couldn’t be some triangulation to have 9202 to denote outpatient visits where RX values are derived from an outpatient services table.

So let me reframe the question, is there another way that I could use fields between drug_exposure and visit_occurrence to see this exposure stratification? Is there a way to creatively use the TYPE field to do this? (Bias: I think some of the TYPEs are a little tricky to use effectively.) Or am I simply asking OMOP transformed medical and pharmacy claims a question it can’t answer?

Best,
Kristin

@krfeeney:

No. The visit_occurrence_id is exactly for that purpose. If it’s always NULL in your case, then this is between your data provider and your ETL shop. Fix either one or both (I can make recommendations, but that would mean taking my OHDSI hat off, which I won’t. :slight_smile: )

But on a second thought: The situation with prescription drugs is this: There is the prescription event, and the filling event. They are right now not connected. So, we have a visit where the doc prescribes something, and a couple days later the patient shows up in the pharmacy. The latter could be a pharmacy visit, but we don’t have that right now. We have a similar situaiton in the hospital setting, where we have an order, and a dispensing. In this Forum, this debate is flaring up every now and then to link them up, but so far it hasn’t been tackled. If you want to do that and make a proposal to the WG, please do.

You can always try joining to the visit_occurrence table where
visit.person_id= drug.person_id and drug_exposure_start_date between visit
start and end date. This will give you an idea if there should have been
some visit_occurrence_id for the drug exposure records.

Thanks @Christian_Reich and @DTorok! Appreciate the sanity check.

Not sure I’m ready for that WG proposal but we’ll see. :slight_smile: :smile:

Linking these threads together.

If pharmacy dispensation is a visit with visit_occurrence_id with a not null value, then we can capture the pharmacy on care_site table.

1 Like
t