-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Excluded rules summary This adds a series of tables designed to help debug study configs by providing a list of rules that were excluded, but were considered potential candidates for exclusion. This adds a new study arg, debug, which is used to enable these tables. They are off by default. * PR feedback
- Loading branch information
1 parent
5a92728
commit e213e34
Showing
9 changed files
with
717 additions
and
361 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
130 changes: 130 additions & 0 deletions
130
cumulus_library_opioid/reference_sql/excluded_rules_builder.sql
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,130 @@ | ||
-- noqa: disable=all | ||
-- This sql was autogenerated as a reference example using the library | ||
-- CLI. Its format is tied to the specific database it was run against, | ||
-- and it may not be correct for all databases. Use the CLI's build | ||
-- option to derive the best SQL for your dataset. | ||
|
||
-- ########################################################### | ||
|
||
CREATE TABLE opioid__acep_excluded_rules AS | ||
SELECT | ||
rxcui1, | ||
rxcui2, | ||
tty1, | ||
tty2, | ||
rui, | ||
rel, | ||
rela, | ||
str1, | ||
str2, | ||
keyword | ||
FROM | ||
opioid__acep_potential_rules | ||
WHERE rui NOT IN (SELECT DISTINCT rui from opioid__acep_combined_ruleset) | ||
AND rxcui1 NOT IN (SELECT DISTINCT rxcui1 from opioid__acep_combined_ruleset) | ||
AND rxcui2 NOT IN (SELECT DISTINCT rxcui2 from opioid__acep_combined_ruleset) | ||
|
||
-- ########################################################### | ||
|
||
CREATE VIEW opioid__acep_excluded_tradename AS | ||
SELECT | ||
rxcui1, | ||
tty1, | ||
rel, | ||
rela, | ||
rxcui2, | ||
tty2, | ||
str2 | ||
FROM | ||
opioid__acep_excluded_rules | ||
WHERE rela IN ('has_tradename','tradename_of') | ||
|
||
-- ########################################################### | ||
|
||
CREATE VIEW opioid__acep_excluded_consists AS | ||
SELECT | ||
rxcui1, | ||
tty1, | ||
rel, | ||
rela, | ||
rxcui2, | ||
tty2, | ||
str2 | ||
FROM | ||
opioid__acep_excluded_rules | ||
WHERE rela IN ('consists_of','constitutes') | ||
|
||
-- ########################################################### | ||
|
||
CREATE VIEW opioid__acep_excluded_is_a AS | ||
SELECT | ||
rxcui1, | ||
tty1, | ||
rel, | ||
rela, | ||
rxcui2, | ||
tty2, | ||
str2 | ||
FROM | ||
opioid__acep_excluded_rules | ||
WHERE rela IN ('isa','inverse_isa') | ||
|
||
-- ########################################################### | ||
|
||
CREATE VIEW opioid__acep_excluded_ingredient AS | ||
SELECT | ||
rxcui1, | ||
tty1, | ||
rel, | ||
rela, | ||
rxcui2, | ||
tty2, | ||
str2 | ||
FROM | ||
opioid__acep_excluded_rules | ||
WHERE rela IN ('has_ingredient','ingredient_of','has_precise_ingredient','precise_ingredient_of','has_ingredients','ingredients_of') | ||
|
||
-- ########################################################### | ||
|
||
CREATE VIEW opioid__acep_excluded_dose_form AS | ||
SELECT | ||
rxcui1, | ||
tty1, | ||
rel, | ||
rela, | ||
rxcui2, | ||
tty2, | ||
str2 | ||
FROM | ||
opioid__acep_excluded_rules | ||
WHERE rela IN ('dose_form_of','has_dose_form','doseformgroup_of','has_doseformgroup') | ||
|
||
-- ########################################################### | ||
|
||
CREATE VIEW opioid__acep_excluded_form AS | ||
SELECT | ||
rxcui1, | ||
tty1, | ||
rel, | ||
rela, | ||
rxcui2, | ||
tty2, | ||
str2 | ||
FROM | ||
opioid__acep_excluded_rules | ||
WHERE rela IN ('form_of','has_form') | ||
|
||
-- ########################################################### | ||
|
||
CREATE VIEW opioid__acep_excluded_other AS | ||
SELECT | ||
rxcui1, | ||
tty1, | ||
rel, | ||
rela, | ||
rxcui2, | ||
tty2, | ||
str2 | ||
FROM | ||
opioid__acep_excluded_rules | ||
WHERE rela NOT IN ('has_tradename','tradename_of','consists_of','constitutes','isa','inverse_isa','has_ingredient','ingredient_of','has_precise_ingredient','precise_ingredient_of','has_ingredients','ingredients_of','dose_form_of','has_dose_form','doseformgroup_of','has_doseformgroup','form_of','has_form') |
Oops, something went wrong.