Skip to content

Commit

Permalink
Create acei.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan-L-Dominguez authored Dec 11, 2023
1 parent 6e54a74 commit 72ff87a
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions mimic-iv/concepts/medication/acei.sql
Original file line number Diff line number Diff line change
@@ -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
;

0 comments on commit 72ff87a

Please sign in to comment.