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
#!/usr/bin/env python3.6.2 | |
# -*- coding: utf-8 -*- | |
# run script from command line via python3 keyword_search_github_repositories.py | |
import click | |
import datetime | |
import time | |
from github import Github |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# import needed libraries | |
import glob | |
import json | |
import os | |
import pickle | |
import random | |
import requests |
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
############ | |
## PURPOSE: Generate gene-centric edge lists for collaboration with PNNL | |
## Master Repo: https://github.com/callahantiff/PheKnowLator/wiki/v2.0.0 | |
## Edge Data: https://github.com/callahantiff/PheKnowLator/wiki/v2-Data-Sources | |
########### | |
# import needed libraries | |
import pandas | |
import pickle | |
import json |
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
-- Query 1: Search for specific patients using specific vocabulary codes | |
SELECT DISTINCT | |
CONCAT('"', CAST(c1.concept_id AS STRING), '"') AS OMOP_ID, | |
c1.concept_name AS OMOP_LABEL, | |
CONCAT('"', CAST(c.concept_code AS STRING), '"') AS CLINICAL_CODE, | |
CONCAT('"', CAST(c1.concept_code AS STRING), '"') AS SNOMED_CODE, | |
c.vocabulary_id AS VOCABULARY | |
FROM CHCO_DeID_Oct2018.concept c | |
JOIN CHCO_DeID_Oct2018.concept_relationship r ON r.concept_id_1 = c.concept_id |
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
SELECT * FROM | |
(SELECT patient_id, disease_group_label, disease_group_num, disease_group_abbreviation, condition_concept_id AS concept_id, visit_occurrence_id, visit_start_interval | |
FROM CHCO_DeID_Oct2018.Med2Mech_RareDisease_Conditions | |
WHERE visit_start_interval>0 AND visit_end_interval>0) | |
UNION ALL | |
(SELECT patient_id, disease_group_label, disease_group_num, disease_group_abbreviation, drug_concept_id AS concept_id, visit_occurrence_id, visit_start_interval | |
FROM CHCO_DeID_Oct2018.Med2Mech_RareDisease_Medications | |
WHERE visit_start_interval>0 AND visit_end_interval>0) |
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
-- get unique counts of source and standard codes for each phenotype | |
-- CHCO | |
SELECT standard_code_set, COUNT(DISTINCT source_code) AS source_code_count, COUNT(DISTINCT standard_code) AS standard_code_count | |
FROM CHCO_DeID_Oct2018.ADHD_COHORT_VARS | |
WHERE standard_code_set is NOT NULL | |
GROUP BY standard_code_set | |
SELECT standard_code_set, COUNT(DISTINCT source_code) AS source_code_count, COUNT(DISTINCT standard_code) AS standard_code_count | |
FROM CHCO_DeID_Oct2018.APPENDICITIS_COHORT_VARS |
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
WITH rx_case_inclusion_criteria_1 AS ( | |
SELECT de.person_id, cohort.standard_code_set AS code_set | |
FROM | |
{database}.drug_exposure de, | |
{database}.STEROIDINDUCEDOSTEONECROSIS_COHORT_VARS cohort | |
WHERE de.route_concept_id IN (4132161, 4171047, 4302612) | |
AND de.drug_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 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}.HYPOTHYROIDISM_COHORT_VARS cohort | |
WHERE | |
co.condition_concept_id = CAST(cohort.standard_concept_id AS int64) | |
AND cohort.phenotype_definition_number = 0 | |
AND cohort.standard_code_set = {code_set_group} | |
GROUP BY co.person_id, cohort.standard_code_set |
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
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} |
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
#!/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 |