MIT-LCP / mimic-omop

Mapping the MIMIC-III database to the OMOP schema
MIT License
128 stars 48 forks source link

ERROR: duplicate key value violates unique constraint "xpk_drug_exposure" #48

Closed smondet closed 6 years ago

smondet commented 6 years ago

Has anyone run into this?

At the step psql "$MIMIC" -f "etl/etl.sql"

....
Time: 734.509 ms
INSERT 0 2082294
Time: 113601.293 ms
INSERT 0 1063525
Time: 69457.080 ms
INSERT 0 716595
Time: 26671.288 ms
psql:etl/StandardizedClinicalDataTables/DRUG_EXPOSURE/etl.sql:112: ERROR:  duplicate key value violates unique constraint "xpk_drug_exposure"
DETAIL:  Key (drug_exposure_id)=(394992270) already exists.
Time: 133169.830 ms
parisni commented 6 years ago

Hi Sebastian

Indeed this is a bug. Let us explore what happened with drugs and fix it.

Thanks for reporting

parisni commented 6 years ago

bug spotted:

select label, count(1) from 
mimic.gcpt_prescriptions_ndcisnullzero_to_concept group by 1 having count(1) > 1;
            label             | count 
------------------------------+-------
 Advair Diskus 100/50MCG      |     2
 Meperidine HCl 100MG/2ML AMP |     2
 desvenlafaxine 100 mg        |     2