-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1680 from Juan-L-Dominguez/main
nsaid & acei medication
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
; |