OHDSI Home | Forums | Wiki | Github

Link cohort table with visit_occurrence table

Hi everyone, I am working on finding the visit_start_date and visit_end_date (from the visit_occurrence table) for my desired cohort (from the cohort table). Generally, I want to map the desired visit dates with my cohort.

What I have done so far is to join the two tables by cohort.subject_id = visit_occurrence.person_id. However, this generates all visits by patients in my cohort, rather than the ones selected for an outcome / drug exposure. I than tried to also join my cohort.cohort_start_date and visit_occurrence.visit_start_date (heoretically, the visit start dates should also be the same day the cohort starts), but I feel like this is still not concrete enough. There is also a cohort_definition column in the cohort table that specifies my desired cohort. I wonder if there is a way to map this cohort_definiton column with the visit_occurrence table, maybe through a third table?

Thank you for any comments and suggestions!

Hello @Ruochong_Fan and welcome to OHDSI!

You should link the outcome/drug exposure to the visit table on the visit_occurrence_id. Every clinical event table has a FK/PK relationship with the Visit Occurrence table, if present in the data. This will give you visit information for the outcome of interest.

Thank you!

1 Like
t