MIT-LCP / MIT-LCP/mimic-code

Medication administration times

Open
#847 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Prerequisites
Description

I am currently working on a project where I would require (somewhat) accurate medication administration of loop diuretics. It is currently unclear which table should be used in order to get this - I would appreciate any help/input on how to reconcile this problem.

Here is what I have:
1 - a table with all diuretics administered based on icustay_id, and charttime/starttime pulled from inputevents_cv, inputevents_mv, and prescriptions table. There appears to be some repeated measured (albeit inconsistent) between the input tables and the prescription table, with the latter being less accurate re: times (as per the documentation) but with the advantage of capturing PO doses. I have not yet included the carevue data because I am not 100% clear how the medication administration (in terms of IV bolus, PO, etc.) is arranged.

How would I go about ensuring that I have the most accurate doses and times from loop diuretics?

Here is a sample:
with t1 as
(
select
icustay_id, startdate, enddate, drug_name_generic as drug, prod_strength as drugStr, dose_val_rx as dose, dose_unit_rx as units, route
, case
-- LD's
when lower(drug_name_generic) like '%furosem%' then 1
when lower(drug_name_generic) like '%bumetan%' then 1
when lower(drug_name_generic) like '%torse%' then 1
when lower(drug_name_generic) like '%ethacryn%' then 1
-- TZ
when lower(drug_name_generic) like '%thiazide%' then 1
when lower(drug_name_generic) like '%indapa%' then 1
when lower(drug_name_generic) like '%metolaz%' then 1
-- K-sparing
when lower(drug_name_generic) like '%amilori%' then 1
when lower(drug_name_generic) like '%epleren%' then 1
when lower(drug_name_generic) like '%spirono%' then 1
when lower(drug_name_generic) like '%triamt%' then 1
-- CARB ANH inh
when lower(drug_name_generic) like '%acetazo%' then 1
when lower(drug_name_generic) like '%methazo%' then 1
else 0
end as diuretic
, case when prod_strength like '%CAP%' and CAST(dose_val_rx as float64) < 10 then -- extract the caps into their actual doses
STRUCT((CAST(dose_val_rx as float64)*CAST(regexp_extract(prod_strength, r"[.0-9.]+") as float64)) as d1
, (CAST(dose_val_rx as float64)*CAST(regexp_extract(prod_strength, r"[.0-9.]+", regexp_instr(prod_strength, r"[/]")) as float64)) as d2)
else (null, null)
end as doseCorr
from physionet-data.mimiciii_clinical.prescriptions
)

, mv as
(
SELECT icustay_id, starttime, endtime, round(amount,1) as amount, amountuom, ordercategoryname
from physionet-data.mimiciii_clinical.inputevents_mv
where itemid = 221794 and lower(ordercategoryname) like "%bolus%" and icustay_id is not null and amount >1 and STATUSDESCRIPTION != "Rewritten"
order by icustay_id, starttime
)

select
icustay_id, timestamp(startdate) as startTime, timestamp(enddate) as endTime, drug, drugStr, dose, units, doseCorr.d1, doseCorr.d2, route
from t1
where diuretic = 1 and icustay_id is not null and route not like '%DRIP%' and dose is not null
UNION ALL
select
icustay_id, timestamp(starttime) as startTime, timestamp(endtime) as endTime, "Furosemide", null, cast(amount as string) as dose, amountuom as units, null,null, ordercategoryname as route
from mv
order by icustay_id, startTime, drug

This is joined to a furosemide infusion table that is generated mostly like the vasopressor infusions (did not include given the length of code and availability on the repository).

Here is a sample output for icustay_id 205385:
image

It can been seen that there are repeated doses (which are the additions of the prescription table and inputevents_mv). Any input would be greatly appreciated (I can provide further clarification if needed).

Joey

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 MIMIC documentation and compare the prescriptions, inputevents_cv, and inputevents_mv tables referenced in the issue, including the sample query. Determine how medication routes, doses, and administration times should be reconciled without duplicate records; done means the source tables and reconciliation approach are clearly documented for loop diuretics.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.