OHDSI Home | Forums | Wiki | Github

Vocab files - Non procedure concepts - Constraints issue

Hello,

I am trying to upload recent July vocab files to our OMOP CDM instance.

I already referred post, post and post for help.

I removed all constraints first and then tried uploading the data as per the suggestion from posts above.

But when I try to apply the constraints after data upload, I get foreign key constraint error for non-procedure related concepts.

While I did download CPT4 concept file as well but I didn’t run the jar file yet. (because we don’t have procedure data).

Since I didn’t run concept_cpt4.csv file, I thought that errors if any should only be for procedure related concepts. But based on below error, the concept ids throwing error doesn’t belong to procedure domain

ERROR: insert or update on table “concept_synonym” violates foreign key constraint “fpk_concept_synonym_concept”
DETAIL: Key (concept_id)=(40228952) is not present in table “concept”.
SQL state: 23503

ERROR: insert or update on table “concept_relationship” violates foreign key constraint “fpk_concept_relationship_c_1”
DETAIL: Key (concept_id_1)=(36211782) is not present in table “concept”.
SQL state: 23503

ERROR: insert or update on table “concept_relationship” violates foreign key constraint “fpk_concept_relationship_c_2”
DETAIL: Key (concept_id_2)=(19069023) is not present in table “concept”.
SQL state: 23503

ERROR: insert or update on table “concept_ancestor” violates foreign key constraint “fpk_concept_ancestor_concept_1”
DETAIL: Key (ancestor_concept_id)=(700299) is not present in table “concept”.
SQL state: 23503

ERROR: insert or update on table “drug_strength” violates foreign key constraint “fpk_drug_strength_concept_1”
DETAIL: Key (drug_concept_id)=(44069147) is not present in table “concept”.
SQL state: 23503

As you can see all the concepts referred in the error message belong to drug domain.

May I know why is this happening and am I doing anything incorrect?

How do you address such issues?

I think simplest approach is to drop all constraints, load the individual tables, and then re-apply constraints.

@Chris_Knoll - Yes, I tried doing the same as you suggested.

I dropped all constraints, uploaded the vocab files and then tried re-applying the constraints.

All these errors shown above happen when I try to re-apply the constraints after data upload.

Ok, I thought that it had something to do with order of data loading. I don’t think it matters which domain the concept is in, just that the concept exists in the concept table, so if you take this error:

It is saying that there’s a concept in concept_synonym that is not found in concept. Looking at athena, the concept does exist, and has a synonym to 326240868. So, can you query your concept table and check if 40228952 is actually in your concept table?

@Chris_Knoll - Yes, correct it’s not in concept. I am wondering why the concept file doesn’t have it

I downloaded the latest July version and upload successfully (by removing constraints).

Could there be any issues with the Concept.csv file? I don’t know why they are missing in concept.csv.

That seems to be the problem. You are missing records in CONCEPT. I think. Try running it and see what happens.

The missing concept from his error report isn’t a CPT vocabulary (It is a RxNorm concept) so I don’t think loading CPT will help in this case.

@Christian_Reich - Yes, I also think the same as @Chris_Knoll.

t