MIT-LCP / MIT-LCP/mimic-code

Error running constraint.sql on MIMIC-IV version 3.0

Open
#1,787 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
3.4k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

Prerequisites
Description

I've tried in buide a local mimic on a MacOs system with the MIMIC-IV version 3.0. At the step of running constraint.sql, there's an error...

psql:mimic-iv/buildmimic/postgres/constraint.sql:207: 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".

I've checked the shasum256 of the downloaded mimic files.
Upon inspection, there is no subject_id=11404231 in the patients.csv file but it is present in the diagnoses_icd.csv file.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the constraint.sql failure at mimic-iv/buildmimic/postgres/constraint.sql:207 and compare subject_id 11404231 across diagnoses_icd.csv and patients.csv. Trace how these CSVs are loaded, then verify the import completes without the foreign-key violation and that the affected records are consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.