OHDSI Home | Forums | Wiki | Github

Defining cohort with person id

Hi. Is there a way to define a cohort with only PERSON_ID and fixed COHORT_START/END_DATE? I have specific groups of people with known PERSON_ID, and I want to build a cohort out of this.

Particularly, in the Atlas, I want to write a sql code for the export-Oracle-sql. How can I go about this?
Thank you for your help ahead.

UPDATE:
I have studied a little bit about export-Oracle-sql, and I think I need to manipulate the following code.

DELETE FROM @target_database_schema.@target_cohort_table where cohort_definition_id = @target_cohort_id;
INSERT INTO @target_database_schema.@target_cohort_table (cohort_definition_id, subject_id, cohort_start_date, cohort_end_date)
SELECT @target_cohort_id as cohort_definition_id, person_id, start_date, end_date FROM @temp_database_schema.sue1g2nsfinal_cohort CO;

‘’’

So, I think, instead of @temp_database_schema.sue1g2nsfinal_cohort, I need to put my table, say named @CDM_2020_VIEW.my_cohort (the schema that I’m using is CDM_2020_VIEW) with the entity of cohort_definition_id, person_id, start_date, end_date.
However, I think @target_cohort_id is an automatic number defined by atlas. (Am I right?) And if so, then I need to careful about putting value in cohort_definition_id in @CDM_2020_VIEW.my_cohort table. How can I go about this?

UPDATE:
I just found out that I cannot manipulate the SQL code. I could only change Json code; but unfortunately, I don’t know how to use them. As @Chris_Knoll said, is there a way to upload csv file in the cohort definition tab?

It’s not possible to define a cohort based on a person_id. If you want to build a cohort table with pre-defiend person_id and start/end dates, just create a .csv file and upload it to your own cohort table.

If you’re just doing your own study (I assume you are since you have the PLP question here, just make up your own cohort table (in your case: my_cohort) and make up your own cohort_definition_ids (you will just need to remember which id means ‘target population’ and which cohort_id is the ‘outcome’ you are trying to predict.

The simplest way to run the anlaysis is to execute it in R, so I would review the PLP documentation where you can find examples on how to execute analyses.

@Chris_Knoll

Hi, Thank you for your answer, though I have some questions. What do you mean by I can create a .csv file and upload it to the atlas? in atlas cohort definition tab, I couldn’t find any tab that uploades .csv files other than concept sets. Please walk me through what you mean by it.

And you are right I can use PLP documentation. And for that, I can just define my_cohort table and use it in the PLP documentation. However, I would also like to use characterization tab in atlas. Hence I need to upload my cohort definition to atlas somehow. And that’s why I was studying import-export tab in cohort definition tab in atlas. Hope this clarifies my questions.

UPDATE:
I found out that I could not manipulate the SQL code; only JSON code was possible to manipulated. So, I need to figure out JSON code or as you mentioned earlier, to upload .csv file.

Not upload into atlas, I mean you can’t do it in atlas, so you will have to use a custom cohort table, and you can populate this with any person_id and start/end date you want. While you won’t be able to use this cohort in Atlas, you can use any cohort table in the other OHDSI tools such as PatientLevelPrediction (PLP).

@Chris_Knoll I see I got what you mean now. Thanks for the througth help. I hope someday, Ohdsi would update the cohort definition tab so that we can upload with person Id, hopefully…

t