OHDSI Home | Forums | Wiki | Github

Are visit_ids mandatory for CDM to work?


(Akshay Kumar) #1

Hello Everyone,

I would like to know the importance of visit ids.

  1. For example, we have survey data where patients were interviewed.

We are trying to convert this to OMOP CDM form. But it’s natural that we don’t have visit data/table for these patients (who come under survey data). What we have is interview date which I feel it syncs with “observation_date” column of “observation” table.

I understand that we can key in Zero for missing visit_ids but when the domain itself is missing, will that result in any problem if I leave the visit_table empty (which I am not able to foresee due to limited knowledge). I know some constraints might fail but how do we handle a scenario like this?

So, do I just key in zero in domain tables (wherever there is visit_occurrence id column)?

(Anna Karenina) #2

Hello @Akshay,

visit_occurrence_id fields are not mandatory in CDM event tables. If you don’t have an associated visit for a clinical event, set visit_occurrence_id to NULL. Note that it’s not a concept field, so you don’t have to set it to zero when missing — unless you have a Visit Occurrence record with visit_occurrence_id = 0, this would break foreign key constraints.

(Akshay Kumar) #3

And visit_occurrence table can be left untouched?

we rely on other domain tables to generate observation_period?

(Christian Reich) #4

Sorry, @rookie_crewkie. They are mandatory. If you write a Visit Occurrence you need to give it a counter.

If you don’t have information about a Visit you can just not write one. An survey interview is not really an interaction with the healthcare system. So, no worries. Most use cases will work without explicit Visit information.

(Anna Karenina) #5


By saying

I only meant the clinical event tables (Measurement, Procedure, etc), where visit_occurrence_id is a foreign key to Visit Occurrence. Of course this field is mandatory in Visit Occurrence itself. Apologies for the potentially misleading wording here.

(Christian Reich) #6

Ah, yes, correct.

(Akshay Kumar) #7


I have visit information like Visit_dates and Visit_types (In, Out, Emergency) but no visit id/visit_occurrence id.

So now I would like to make use of these visit info.

As I don’t have dates, should I key in zeros but get their corresponding lab, medications and conditions data through time columns?

(Christian Reich) #8


You have two options: 1) you infer the visit date (taking the first and last event, for example), or 2) you drop the visit and only write the events (lab, medications, conditions). Either one is legitimate from a CDM perspective. If you can do 1) with some level of precision I’d prefer that if I were you.