Navigation Menu

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

Medication administration times #847

Open
jomericer opened this issue Jan 7, 2021 · 0 comments
Open

Medication administration times #847

jomericer opened this issue Jan 7, 2021 · 0 comments

Comments

@jomericer
Copy link

jomericer commented Jan 7, 2021

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

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

No branches or pull requests

2 participants