Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

there is some errors in mimic-code-2.5.0\mimic-iv\buildmimic\postgres\constraint.sql #1792

Open
huangzhuohua opened this issue Aug 31, 2024 · 1 comment

Comments

@huangzhuohua
Copy link

there is many errors in mimic-code-2.5.0\mimic-iv\buildmimic\postgres\constraint.sql

here is one of them, the others is similar.

ALTER TABLE mimiciv_hosp.diagnoses_icd DROP CONSTRAINT IF EXISTS diagnoses_icd_patients_fk; ALTER TABLE mimiciv_hosp.diagnoses_icd ADD CONSTRAINT diagnoses_icd_patients_fk FOREIGN KEY (subject_id) REFERENCES mimiciv_hosp.patients (subject_id);

error is there is no subject_id = 11404231 in the table of patients, so
ERROR: insert or update on table "diagnoses_icd" violates foreign key constraint "diagnoses_icd_patients_fk" DETAIL: Key (subject_id)=(11404231) is not present in table "patients".

@huangzhuohua
Copy link
Author

huangzhuohua commented Aug 31, 2024

error Is also see blow code
`-- diagnoses_icd

ALTER TABLE mimiciv_hosp.diagnoses_icd DROP CONSTRAINT IF EXISTS diagnoses_icd_patients_fk;
ALTER TABLE mimiciv_hosp.diagnoses_icd
ADD CONSTRAINT diagnoses_icd_patients_fk
FOREIGN KEY (subject_id)
REFERENCES mimiciv_hosp.patients (subject_id);

ALTER TABLE mimiciv_hosp.diagnoses_icd DROP CONSTRAINT IF EXISTS diagnoses_icd_admissions_fk;
ALTER TABLE mimiciv_hosp.diagnoses_icd
ADD CONSTRAINT diagnoses_icd_admissions_fk
FOREIGN KEY (hadm_id)
REFERENCES mimiciv_hosp.admissions (hadm_id);

-- drgcodes

ALTER TABLE mimiciv_hosp.drgcodes DROP CONSTRAINT IF EXISTS drgcodes_patients_fk;
ALTER TABLE mimiciv_hosp.drgcodes
ADD CONSTRAINT drgcodes_patients_fk
FOREIGN KEY (subject_id)
REFERENCES mimiciv_hosp.patients (subject_id);

ALTER TABLE mimiciv_hosp.drgcodes DROP CONSTRAINT IF EXISTS drgcodes_admissions_fk;
ALTER TABLE mimiciv_hosp.drgcodes
ADD CONSTRAINT drgcodes_admissions_fk
FOREIGN KEY (hadm_id)
REFERENCES mimiciv_hosp.admissions (hadm_id);
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant