From 6e54a7459c708aeb60e5ed64efac4e3d902e777a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20L=2E=20Dom=C3=ADnguez-Olmedo?= <62712019+Juan-L-Dominguez@users.noreply.github.com> Date: Mon, 11 Dec 2023 10:56:40 +0100 Subject: [PATCH 1/2] Create nsaid.sql --- mimic-iv/concepts/medication/nsaid.sql | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 mimic-iv/concepts/medication/nsaid.sql diff --git a/mimic-iv/concepts/medication/nsaid.sql b/mimic-iv/concepts/medication/nsaid.sql new file mode 100644 index 000000000..5069c680e --- /dev/null +++ b/mimic-iv/concepts/medication/nsaid.sql @@ -0,0 +1,43 @@ +WITH nsaid_drug AS ( + SELECT DISTINCT + drug + , CASE + WHEN UPPER(drug) LIKE '%ASPIRIN%' THEN 1 + WHEN UPPER(drug) LIKE '%BROMFENAC%' THEN 1 + WHEN UPPER(drug) LIKE '%CELECOXIB%' THEN 1 + WHEN UPPER(drug) LIKE '%DICLOFENAC%' THEN 1 + WHEN UPPER(drug) LIKE '%DIFLUNISAL%' THEN 1 + WHEN UPPER(drug) LIKE '%ETODOLAC%' THEN 1 + WHEN UPPER(drug) LIKE '%FENOPROFEN%' THEN 1 + WHEN UPPER(drug) LIKE '%FLURBIPROFEN%' THEN 1 + WHEN UPPER(drug) LIKE '%IBUPROFEN%' THEN 1 + WHEN UPPER(drug) LIKE '%INDOMETHACIN%' THEN 1 + WHEN UPPER(drug) LIKE '%KETOPROFEN%' THEN 1 + WHEN UPPER(drug) LIKE '%MEFENAMIC ACID%' THEN 1 + WHEN UPPER(drug) LIKE '%MELOXICAM%' THEN 1 + WHEN UPPER(drug) LIKE '%NABUMETONE%' THEN 1 + WHEN UPPER(drug) LIKE '%NAPROXEN%' THEN 1 + WHEN UPPER(drug) LIKE '%NEPAFENAC%' THEN 1 + WHEN UPPER(drug) LIKE '%OXAPROZIN%' THEN 1 + WHEN UPPER(drug) LIKE '%PIROXICAM%' THEN 1 + WHEN UPPER(drug) LIKE '%SULINDAC%' THEN 1 + WHEN UPPER(drug) LIKE '%TOLMETIN%' THEN 1 + ELSE 0 + END AS nsaid + FROM `physionet-data.mimiciv_hosp.prescriptions` +) + +SELECT + pr.subject_id + , pr.hadm_id + , pr.drug AS nsaid + , pr.starttime + , pr.stoptime +FROM + `physionet-data.mimiciv_hosp.prescriptions` pr + INNER JOIN nsaid_drug + ON + pr.drug = nsaid_drug.drug +WHERE + nsaid_drug.nsaid = 1 +; From 72ff87abfc7b21301f2bde459dfec07c7d637da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20L=2E=20Dom=C3=ADnguez-Olmedo?= <62712019+Juan-L-Dominguez@users.noreply.github.com> Date: Mon, 11 Dec 2023 10:57:29 +0100 Subject: [PATCH 2/2] Create acei.sql --- mimic-iv/concepts/medication/acei.sql | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 mimic-iv/concepts/medication/acei.sql diff --git a/mimic-iv/concepts/medication/acei.sql b/mimic-iv/concepts/medication/acei.sql new file mode 100644 index 000000000..5be4c109e --- /dev/null +++ b/mimic-iv/concepts/medication/acei.sql @@ -0,0 +1,33 @@ +WITH acei_drug AS ( + SELECT DISTINCT + drug + , CASE + WHEN UPPER(drug) LIKE '%BENAZEPRIL%' THEN 1 + WHEN UPPER(drug) LIKE '%CAPTOPRIL%' THEN 1 + WHEN UPPER(drug) LIKE '%ENALAPRIL%' THEN 1 + WHEN UPPER(drug) LIKE '%FOSINOPRIL%' THEN 1 + WHEN UPPER(drug) LIKE '%LISINOPRIL%' THEN 1 + WHEN UPPER(drug) LIKE '%MOEXIPRIL%' THEN 1 + WHEN UPPER(drug) LIKE '%PERINDOPRIL%' THEN 1 + WHEN UPPER(drug) LIKE '%QUINAPRIL%' THEN 1 + WHEN UPPER(drug) LIKE '%RAMIPRIL%' THEN 1 + WHEN UPPER(drug) LIKE '%TRANDOLAPRIL%' THEN 1 + ELSE 0 + END AS acei + FROM `physionet-data.mimiciv_hosp.prescriptions` +) + +SELECT + pr.subject_id + , pr.hadm_id + , pr.drug AS acei + , pr.starttime + , pr.stoptime +FROM + `physionet-data.mimiciv_hosp.prescriptions` pr + INNER JOIN acei_drug + ON + pr.drug = acei_drug.drug +WHERE + acei_drug.acei = 1 +;