This file contains hidden or 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
| -- Query Template: find synonyms between source strings and an OMOP terminology concept codes | |
| SELECT DISTINCT | |
| lower(source_string) AS source_code, | |
| lower(concept_synonym_name) AS source_name, | |
| "String" AS input_type, | |
| domain_id AS source_domain, | |
| "None" AS source_vocabulary | |
| FROM | |
| (SELECT DISTINCT |
This file contains hidden or 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
| SELECT | |
| DISTINCT CONCAT('"', c.concept_code, '"') AS standard_code, | |
| c.concept_name AS standard_name, | |
| c.domain_id AS standard_domain, | |
| c.vocabulary_id AS standard_vocabulary, | |
| COUNT(occ.{count_concept}_id) AS occ_count | |
| FROM | |
| {database}.concept c | |
| JOIN {database}.{count_concept} occ ON occ.{concept}_concept_id = c.concept_id | |
| WHERE |
This file contains hidden or 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
| WITH age_criteria_1 AS ( | |
| SELECT co.person_id, cohort.standard_code_set AS code_set | |
| FROM | |
| {database}.person p, | |
| {database}.condition_occurrence co, | |
| {database}.ADHD_COHORT_VARS cohort | |
| WHERE p.person_id = co.person_id | |
| AND co.condition_concept_id = CAST(cohort.standard_concept_id AS int64) | |
| AND cohort.phenotype_definition_number = 1 | |
| AND cohort.standard_code_set = {code_set_group} |
This file contains hidden or 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
| WITH dx_case_inclusion_criteria_1 AS ( | |
| SELECT co.person_id, cohort.standard_code_set AS code_set | |
| FROM | |
| {database}.condition_occurrence co, | |
| {database}.SICKLECELLDISEASE_COHORT_VARS cohort | |
| WHERE | |
| co.condition_concept_id = CAST(cohort.standard_concept_id AS int64) | |
| AND cohort.standard_code_set = {code_set_group} | |
| GROUP BY co.person_id, cohort.standard_code_set | |
| HAVING |
This file contains hidden or 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
| WITH dx_case_inclusion_criteria_1 AS ( | |
| SELECT co.person_id, cohort.standard_code_set AS code_set | |
| FROM | |
| {database}.condition_occurrence co, | |
| {database}.SLEEPAPNEA_COHORT_VARS cohort | |
| WHERE co.condition_concept_id = CAST(cohort.standard_concept_id AS int64) | |
| AND cohort.phenotype_definition_number = 1 | |
| AND cohort.standard_code_set = {code_set_group} | |
| GROUP BY | |
| co.person_id, code_set |
This file contains hidden or 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
| WITH dx_case_inclusion_criteria_1 AS ( | |
| SELECT co.person_id, cohort.standard_code_set AS code_set | |
| FROM | |
| {database}.condition_occurrence co, | |
| {database}.CROHNSDISEASE_COHORT_VARS cohort | |
| WHERE | |
| co.condition_concept_id = CAST(cohort.standard_concept_id AS int64) | |
| AND cohort.phenotype_definition_number = 1 | |
| AND cohort.standard_code_set = {code_set_group} | |
| GROUP BY |
This file contains hidden or 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
| WITH dx_case_inclusion_criteria_1 AS ( | |
| SELECT co.person_id, cohort.standard_code_set AS code_set | |
| FROM | |
| {database}.condition_occurrence co, | |
| {database}.APPENDICITIS_COHORT_VARS cohort | |
| WHERE | |
| co.condition_concept_id = CAST(cohort.standard_concept_id AS int64) | |
| AND cohort.phenotype_definition_number = 1 | |
| AND cohort.standard_code_set = {code_set_group} | |
| GROUP BY |
This file contains hidden or 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
| WITH dx_case_inclusion_criteria_1 AS ( | |
| SELECT co.person_id, cohort.standard_code_set AS code_set | |
| FROM | |
| {database}.condition_occurrence co, | |
| {database}.SYSTEMICLUPUSERYTHEMATOSUS_COHORT_VARS cohort | |
| WHERE co.condition_concept_id = CAST(cohort.standard_concept_id AS int64) | |
| AND cohort.phenotype_definition_number = 1 | |
| AND cohort.standard_code_set = {code_set_group} | |
| GROUP BY | |
| co.person_id, code_set |
This file contains hidden or 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
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| def xpath_soup(element): | |
| """ | |
| Generate xpath from BeautifulSoup4 element | |
| :param element: BeautifulSoup4 element. | |
| :type element: bs4.element.Tag or bs4.element.NavigableString | |
| :return: xpath as string |
This file contains hidden or 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
| WITH all_case_inclusion_criteria_1 AS ( | |
| SELECT person_id, {code_set_group} AS code_set FROM | |
| (SELECT co.person_id | |
| FROM | |
| {database}.condition_occurrence co, | |
| {database}.PEANUTALLERGY_COHORT_VARS cohort | |
| WHERE | |
| co.condition_concept_id = CAST(cohort.standard_concept_id AS int64) | |
| AND cohort.phenotype_definition_number = 1 | |
| AND cohort.standard_code_set = {code_set_group} |