OHDSI Home | Forums | Wiki | Github

SQL Server CDM Create Script

I’m just getting started with the CDM on SQL Server. I noticed that the DDL script does not create the “_id” columns as identities (table location, as an example). Am I suppose to add that myself or is there another solution. Thanks.

“_id” columns are not always system generated (IDENTITY).
For example for CDM CPRD for LOCATION_ID used Region values from Practice table, for PROVIDER_ID used Staffid values from Staff table etc.

https://github.com/OHDSI/ETL-CDMBuilder/blob/master/man/CPRD/CPRD_ETL_CDM_V5.doc

Thank you for the reply. I’m sorry if I didnt make my self clear. I’m specifically looking at those tables that would be considered a “parent”.

For example: PERSON There is a person_id field which is defined as an INTEGER. The documentation indicates that this is “A unique identifier for each person.” If my source system uses a different data-type as it’s unique identifier, I can’t use the source-value (GUID for example). I was wondering if other people had added an “IDENTITY” to the column.

You’re free to make a local DDL change for your environment to set the person_id field as IDENTITY if you choose, but this is because you have a specific source need (your person_ids are GUIDs that you’ll need to map over to a bigint). But by default, the CDM schema makes no assumptions about the source data, so the column being non-IDENTITY is more compatible than having it with an identity.

As long as your tweaks to your cdm schema doesn’t break compatibility (such as changing column names, column types) you should feel free to make any modifications to suit your needs. An IDENTITY column is still a bigint, so there’s no compatibility issue there.

t