Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nsaid & acei medication #1680

Merged
merged 2 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
;
Loading