You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
privacykit/notebooks/data-preparation.ipynb

3.1 KiB

None <html lang="en"> <head> </head>
In [6]:
"""
    This notebook is designed to generate SQL syntax all the quasi-identifiers for the patients in the database
    The resulting SQL will be run against bigquery to produce a table with every record mapping to a patient
    
"""

from risk import *
ihandle = UtilHandler(path='/home/steve/dev/google-cloud-sdk/accounts/curation-prod.json',dataset='combined20180822',key_field='person_id',key_table='person',filter=['person','observation'])
r = ihandle.migrate_tables()
len(r)
 skiping ...
 skiping ...
 skiping ...
 skiping ...
 skiping ...
 skiping ...
 skiping ...
Out[6]:
2
In [11]:
ihandle = UtilHandler(path='/home/steve/dev/google-cloud-sdk/accounts/curation-test.json',dataset='deid_image',key_field='person_id',key_table='person',filter=['person','basic_observation'])
ihandle.create_table().replace('\n',' ')
Out[11]:
u'              SELECT person.person_id , person.year_of_birth , person.month_of_birth , person.day_of_birth , person.birth_datetime , person.race_concept_id , person.ethnicity_concept_id , person.location_id , person.care_site_id , person.person_source_value , person.gender_source_value , person.gender_source_concept_id , person.race_source_value , person.ethnicity_source_value , basic_observation.sex_at_birth AS sex_at_birth1 , basic_observation.birth_date AS birth_date1 , basic_observation.race AS race1 , basic_observation.zip AS zip1 , basic_observation.city AS city1 , basic_observation.state AS state1 , basic_observation.gender AS gender1              FROM                                 (select * from deid_image.person ) as person                                   INNER JOIN                   (select * from deid_image.basic_observation ) as basic_observation              ON basic_observation.person_id = person.person_id                 '
In [ ]:

</html>