Skip to content

Commit

Permalink
Merge pull request #1680 from Juan-L-Dominguez/main
Browse files Browse the repository at this point in the history
nsaid & acei medication
  • Loading branch information
alistairewj authored Dec 17, 2023
2 parents 014936b + 72ff87a commit 8cb6028
Show file tree
Hide file tree
Showing 2 changed files with 76 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
;
43 changes: 43 additions & 0 deletions mimic-iv/concepts/medication/nsaid.sql
Original file line number Diff line number Diff line change
@@ -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
;

0 comments on commit 8cb6028

Please sign in to comment.