MIT-LCP / MIT-LCP/mimic-code

Notes from years away from admissions

Open
#1,750 0 comments 0 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

Description of the issue, including:

  • what you have tried
  • references to similar issues
  • queries demonstrating your question (if applicable)

I have been working to associate notes with specific admissions. I expect to see some notes available days / weeks outside of the admissions recorded in the 'admissions' table, but I actually see 1000s of notes that are at least 100 days from any recorded admission. I have done some spot checking on about 10 of the rows identified using the below query, and have confirmed that the admissions recorded are far from the CHARTTIME recorded in the note. Could you help me to understand these notes? I see a mix of nursing notes, physician notes, radiology notes, and a handful of others.

WITH
  notes AS (
  SELECT
    ROW_ID,
    SUBJECT_ID,
    CHARTTIME,
    TEXT,
    CATEGORY,
    DESCRIPTION
  FROM
    `physionet-data.mimiciii_notes.noteevents`),
  admissions AS (
  SELECT
    SUBJECT_ID,
    ADMITTIME,
    DISCHTIME,
    EDREGTIME,
    EDOUTTIME,
    ADMISSION_TYPE,
    ADMISSION_LOCATION,
    DISCHARGE_LOCATION
  FROM
    `physionet-data.mimiciii_clinical.admissions`),
  joined AS (
  SELECT
    *
  FROM
    notes
  LEFT JOIN (
    SELECT
      *
    FROM
      admissions)
  USING
    (SUBJECT_ID)),
  inpatient_label AS (
  SELECT
    *,
    CHARTTIME >= ADMITTIME
    AND CHARTTIME <= DISCHTIME AS inpatient_note,
    ABS(DATETIME_DIFF(CHARTTIME, DISCHTIME, DAY)) AS days_from_discharge,
    ABS(DATETIME_DIFF(CHARTTIME, ADMITTIME, DAY)) AS days_from_admit
  FROM
    joined),
  summary AS (
  SELECT
    SUBJECT_ID,
    ROW_ID,
    CHARTTIME,
    CATEGORY,
    DESCRIPTION,
    MAX(inpatient_note) AS any_inpatient_encounter,
    MIN(days_from_discharge) AS min_time_to_discharge,
    MIN(days_from_admit) AS min_time_to_admit
  FROM
    inpatient_label
  WHERE
    CHARTTIME IS NOT NULL
  GROUP BY
    1,
    2,
    3,
    4,
    5)
SELECT
  *
FROM
  summary
WHERE
  NOT any_inpatient_encounter
  AND min_time_to_discharge > 100
  AND min_time_to_admit > 100
ORDER BY
  min_time_to_discharge DESC

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 with the SQL query in the issue and the noteevents and admissions tables it references. Check how the join and date filters associate CHARTTIME with ADMITTIME and DISCHTIME, then review the returned note categories and descriptions. Done means documenting an evidence-based explanation for notes more than 100 days from recorded admissions.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
data, databases
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.