Example of an OHDSI database for training
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
--Queries written against PostGreSQL; queries should be adaptable to other SQL DIALECTS | |
--OPTIONAL: indicates that query uses additional data stored in OHDSI | |
--ADVANCED: indicates uses PostGreSQL specific syntax/functions which would need to be rewritten | |
--Author: Janos Hajagos | |
--Set the search path | |
set search_path to sbm_covid19_documents, sbm_covid19_hi_cdm_build; | |
--Get the count of notes |
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
import pandas as pd | |
df = pd.DataFrame([{ "trajectory_number" : '1' , "trajectory_type" : "AKI" , "crossing_time_in_seconds" : 150 }, | |
{ "trajectory_number" : '2' , "trajectory_type" : "AKI" , "crossing_time_in_seconds" : 800 }, | |
{ "trajectory_number" : '3' , "trajectory_type" : "AKI" , "crossing_time_in_seconds" : 500 }, | |
{ "trajectory_number" : '4' , "trajectory_type" : "Sepsis" , "crossing_time_in_seconds" : 1000 }, | |
{ "trajectory_number" : '5' , "trajectory_type" : "Sepsis" , "crossing_time_in_seconds" : 1243 }, | |
{ "trajectory_number" : '6' , "trajectory_type" : "Sepsis" , "crossing_time_in_seconds" : 1300 }, | |
{ "trajectory_number" : '7' , "trajectory_type" : "Pneumonia" , "crossing_time_in_seconds" : 2304 }, | |
{ "trajectory_number" : '8' , "trajectory_type" : "Pneumonia" , "crossing_time_in_seconds" : 2305 } | |
]) |
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
import argparse | |
import csv | |
import json | |
import pathlib | |
import sqlalchemy as sa | |
def write_delimited_file(cursor, file_name, delimiter): | |
if delimiter == ",": | |
file_name = str(file_name) + ".csv" |
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
import argparse | |
import csv | |
import json | |
import pathlib | |
import sqlalchemy as sa | |
def write_delimited_file(cursor, file_name, delimiter): | |
if delimiter == ",": | |
file_name = str(file_name) + ".csv" |
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
age | sex_mf | resting_blood_pressure | serum_cholesterol_mg_dl | maximum_heart_rate_achieved | oldpeak_st_depression_induced_relative_to_rest | slope_of_peak_exercise_st_segment | number_of_major_vessels_colored_by_fluoroscopy | chest_pain_type | fasting_blood_sugar_gt_120_mg_dl_yn | exercise_induced_angina_yn | thal | absence_or_presence_heart_disease_yn | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
70 | M | 130 | 322 | 109 | 2.4 | 2 | 3 | asymptomatic | N | N | normal | Y | |
67 | F | 115 | 564 | 160 | 1.6 | 2 | 0 | non-anginal pain | N | N | reversible defect | N | |
57 | M | 124 | 261 | 141 | 0.3 | 1 | 0 | atypical angina | N | N | reversible defect | Y | |
64 | M | 128 | 263 | 105 | 0.2 | 2 | 1 | asymptomatic | N | Y | reversible defect | N | |
74 | F | 120 | 269 | 121 | 0.2 | 1 | 1 | atypical angina | N | Y | normal | N | |
65 | M | 120 | 177 | 140 | 0.4 | 1 | 0 | asymptomatic | N | N | reversible defect | N | |
56 | M | 130 | 256 | 142 | 0.6 | 2 | 1 | non-anginal pain | Y | Y | fixed defect | Y | |
59 | M | 110 | 239 | 142 | 1.2 | 2 | 1 | asymptomatic | N | Y | reversible defect | Y | |
60 | M | 140 | 293 | 170 | 1.2 | 2 | 2 | asymptomatic | N | N | reversible defect | Y |
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
words = ["best","guest","crest","question","yesterday","now","people","use","water", "way"] | |
import random | |
import itertools | |
def randomize_word(word): | |
x = list(itertools.permutations(word)) | |
w = x[random.randint(0,len(x)-1)] | |
return "".join(w) | |
def randomize_words_and_order(words): |