An intravenous drug that is not continuous appears to be in the inputevents_mv table but not in the inputevents_cv table. Is it right? How can I work with the full dosage of medication?
-
1Please could you state which medication you are looking for?– tompDec 23, 2015 at 8:44
-
Hi! for example, furosemide. In the input_mv, I can see several times 20mg starting 20:00h and ending 20:01, so I suppose it was made, but I can not find this in the input_cv table. How can I access the dosage per day of furosemide received? Best– alexandreliborioDec 26, 2015 at 1:08
2 Answers
Two different ICU data management systems were in operation over the period of data collection: Philips Carevue (pre ~2008) and IMDSoft Metavision (post ~2008). The structure of the data collected by these systems is fairly different, so we have provided two separate tables rather than a single merged one.
The tables are inputevents_cv (Carevue) and inputevents_mv (Metavision). For an overview of how to work with these tables, please see the MIMIC-III documentation: http://mimic.physionet.org/mimicdata/io/#inputs
How can I access the dosage per day of furosemide received?
The principle is similar for both the inputevents_cv and inputevents_mv tables, though the inputevents_mv table provides more detail (e.g. start and stop times). Your question specifically mentions difficulty in finding data in the inputevents_cv table, so I will use this as an example.
First you need to find the appropriate itemids using the d_items table. Concepts have not yet been mapped between systems, so a single concept may be associated with multiple itemids. Using the example of furosemide/Lasix:
select itemid, label, dbsource, linksto
from d_items
where lower(label) like '%lasix%'
itemid | label | dbsource | linksto
--------+----------------------------+------------+----------------
3439 | Furosemide/Lasix | carevue | chartevents
4888 | lasix | carevue | chartevents
6120 | IV Lasix | carevue | chartevents
4219 | Lasix | carevue | chartevents
7780 | LASIX | carevue | chartevents
30123 | Lasix | carevue | inputevents_cv
228340 | Furosemide (Lasix) 500/100 | metavision | inputevents_mv
221794 | Furosemide (Lasix) | metavision | inputevents_mv
So for inputevents_cv the itemid of interest is 30123. We can search for data for a sample patient using the query below:
select subject_id, icustay_id, charttime,
amount, amountuom, rate, rateuom
from inputevents_cv
where itemid = 30123
and subject_id = 4587
order by charttime
limit 10;
subject_id | icustay_id | charttime | amount | amountuom | rate | rateuom
------------+------------+------------------+--------+-----------+------+---------
4587 | 213218 | 2249-11-20 14:30 | | | 20 | mghr
4587 | 213218 | 2249-11-20 15:00 | 20 | mg | |
4587 | 213218 | 2249-11-20 15:00 | | | 20 | mghr
4587 | 213218 | 2249-11-20 15:30 | | | 20 | mghr
4587 | 213218 | 2249-11-20 16:00 | | | 20 | mghr
4587 | 213218 | 2249-11-20 16:00 | 20 | mg | |
4587 | 213218 | 2249-11-20 17:00 | 20 | mg | |
4587 | 213218 | 2249-11-20 17:00 | | | 20 | mghr
4587 | 213218 | 2249-11-20 18:00 | 20 | mg | |
4587 | 213218 | 2249-11-20 19:00 | 20 | mg | |
The rate column indicates when the rate of delivery was set or updated, so in this case the rate remained at 20mg/hr throughout the period. The amount column indicates the quantity of medication that had been received by the associated charttime. For rates, the charttime corresponds to a start time (when the drug was set to that rate). For amounts, the charttime corresponds to an end time.
Summing the amount gives the total amount delivered over the time period (in the above example, 20mg * 5 = 100mg). While no start time is available in the Carevue data, the start time can often be inferred from the rate. In this case, given that the rate of delivery is indicated to be 20mg/hr at 2.30pm and the amount delivered at 3pm was 20mg, it would be reasonable to assume that delivery began at 2pm.
I got this figured for any IV medication. Any IV medication administration is charted both in inputevents_cv and inputevents_mv.
This is what I got for norepinephrine. First run this code
Select *
from mimiciii.D_ITEMS as ItemIDs
where ItemIDs.CATEGORY ILIKE '%norepinephrine%'
or ItemIDs.LABEL ILIKE '%norepinephrine%'
or ItemIDs.ABBREVIATION ILIKE '%norepinephrine%'
or
ItemIDs.CATEGORY ILIKE '%levoph%'
or ItemIDs.LABEL ILIKE '%levoph%'
or ItemIDs.ABBREVIATION ILIKE '%levoph%'
This way you will get appropriate item_ID for norepinephrine (generic) and levophed (trade name). For your needs you will need furosemide (generic) and lasix (trade name)
From the list of Item_IDs you will need to choose these, which are linked to inputevents_cv and inputevents_mv
This should return you separate Item_IDs, I don't know if I can list them though here.
Than you pull out your data separately.
1) For inputevents_cv:
DROP TABLE IF EXISTS mimiciii.LK_NorEpinephrine_cv;
create table mimiciii.LK_NorEpinephrine_cv as
select subject_id, icustay_id, extract (epoch from charttime) as ep_charttime, itemid, amount, amountuom, originalroute
from mimiciii.inputevents_cv as events
where
amount is not null
and amount > 0
and icustay_id is not NULL
and
(events.ITEMID = ... <- itemid from previous code referring to CV
or events.ITEMID = ... <- itemid from previous code referring to CV)
order by extract (epoch from charttime) ;
COPY mimiciii.LK_NorEpinephrine_cv(subject_id, icustay_id, ep_charttime, itemid, amount, amountuom, originalroute )
TO 'C:\mimic3\LK_NorEpinephrine_cv.csv' DELIMITER ',' CSV HEADER;
This way you will the the csv file with the time (in epoch), doses and subject ID etc.
2) for inputevents_mv
create table mimiciii.LK_NorEpinephrine_mv as
select subject_id, icustay_id, extract (epoch from starttime) as ep_starttime, extract (epoch from endtime) as ep_endtime, itemid, amount, amountuom, ordercategoryname, secondaryordercategoryname
from mimiciii.inputevents_mv as events
where amount is not null
and amount > 0
and icustay_id is not NULL
and events.ITEMID = ... <- itemid from previous code referring to MV
order by extract (epoch from endtime) ;
COPY mimiciii.LK_NorEpinephrine_mv(subject_id, icustay_id, ep_starttime, ep_endtime, itemid, amount, amountuom, ordercategoryname, secondaryordercategoryname )
TO 'C:\mimic3\LK_NorEpinephrine_mv.csv' DELIMITER ',' CSV HEADER;
DROP TABLE IF EXISTS mimiciii.LK_NorEpinephrine_mvICU;
create table mimiciii.LK_NorEpinephrine_mvICU as
select LK_NorEpinephrine_mv.subject_id, LK_NorEpinephrine_mv.icustay_id, ep_starttime, ep_endtime,
CASE
WHEN amountuom = 'mcg'
THEN
amount/1000
WHEN amountuom = 'mg'
THEN
amount
ELSE 99999999999
END AS amount_nzd
from mimiciii.LK_NorEpinephrine_mv
left join mimiciii.LK_icustaysdata on mimiciii.LK_icustaysdata.ICUSTAY_ID= mimiciii.LK_NorEpinephrine_mv.ICUSTAY_ID;
COPY mimiciii.LK_NorEpinephrine_mvICU(subject_id, icustay_id, ep_starttime, ep_endtime, amount_nzd)
TO 'C:\mimic3\LK_NorEpinephrine_mvICU.csv' DELIMITER ',' CSV HEADER;
This way you will the the csv file with the time (in epoch), doses and subject ID etc.
As you can see the 2) code has dose conversion, which you may need to do depending on med.
I usually review in R project the csv files generated as avoce and see, if there is other dosing than mg. Some may have viols, some may have gm, some may have mg. I will leave it to you how you handle this. In my code I converted gm to mg, and discarded any other doses.