I am looking for patients in MIMIC-III v1.3 who took stool softener drugs listed as "Senna, Dulcolax, docusate, milk of magnesia,Colace, MiraLAX, and bisacodyl" on their first ICU stay during the first hospital admission.

I found that the resulting number of people is disproportionately high. I wonder if someone can provide any insight into this issue. This is my code:

with first_admissions as (
    , row_number() over (partition by p.subject_id order by p.admittime ASC) as r
  FROM mimiciii.admissions p
first_icustays as (
      p.subject_id,p.hadm_id, p.icustay_id
    , row_number() over (partition by p.subject_id order by p.intime ASC) as rn
  FROM mimiciii.icustays p
first_stays as(
select a.subject_id,a.hadm_id,i.icustay_id 
from first_admissions a
 join first_icustays i on  a.subject_id = i.subject_id where r=1 and rn=1


SELECT distinct on (p.subject_id) p.subject_id
FROM firststays a, mimiciii.prescriptions p
where  a.subject_id = p.subject_id
and a.icustay_id = p.icustay_id
and a.hadm_id = p.hadm_id 
and p.drug @@ to_tsquery('senna | Dulcolax | docusate | magnesia | Colace | MiraLAX | bisacodyl')
order by p.subject_id;
  • Why do you say the number is disproportionately high? Jun 16, 2016 at 15:09
  • What is the rate you found? What are you comparing it to? Many hospitals have routine PRN (i.e. as needed) prescriptions for stool softeners as part of a standard order set, especially when anyone is receiving an opioid (e.g. fentanyl in the ICU). Are you comparing prescriptions or actual administrations? Apr 6, 2017 at 12:59


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.