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] 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 +;