In [2]:
import reader
import pandas as pd
import os

Usage of this connection code:

  1. Download 'connect_to_drive.py' and 'reader.py' from Github.

  2. Download 'drive-python-quickstart.json' from google drive 'Intermediate data' folder and put it the same folder with the codes.

  3. Upload the (processed) file (to use) into folder 'Intermediate data' in drive.

  4. Fill up the 'Processing log'. Make a record of what's being updated.

  5. Add/modify the file name in reader.py

  6. Use the path of your local data when calling reader. e.g. data = reader.Data('Your Path'). Leaving path blank will lead to the defult path, i.e a 'data' folder under 'reader.py' directory.


In [4]:
# data = reader.Date(os.getcwd()+'/ICO_data/')
# use default path instead
data = reader.Data()


Local data read/write folder path:
	Default path: /Users/Dan/Desktop/data/

Data: systemic_disease_list 
File: systemic_disease_list.pickle
File already exists.

Data: SNOMED_problem_list 
File: SNOMED_problem_list.pickle
File already exists.

Data: macula_findings_for_Enc 
File: macula_findings_for_Enc.pickle
File already exists.

Data: SL_Lens_for_Enc 
File: SL_Lens_for_Enc.pickle
File already exists.

Data: family_hist_list 
File: family_hist_list.pickle
File already exists.

Data: systemic_disease_for_Enc 
File: systemic_disease_for_Enc.pickle
File already exists.

Data: family_hist_for_Enc 
File: family_hist_for_Enc.pickle
File already exists.

Data: all_encounter_data 
File: all_encounter_data.pickle
File already exists.

Data: encounters 
File: encounters.pickle
File already exists.

Data: demographics 
File: demographics_processed_Dan_20170304.pickle
File does not exist. Searching from drive...
	Got the file id. Print metadata:
		Title: demographics_processed_Dan_20170304.pickle
		MIME type: application/octet-stream
	Download Progress: 31%
	Download Progress: 63%
	Download Progress: 95%
	Download Progress: 100%
	Download Complete

Data: ICD_for_Enc 
File: ICD_for_Enc_processed_Dan_20170304.pickle
File already exists.

In [7]:
data['demographics'].head()


Out[7]:
Person_ID Person_Nbr DOB Gender Race Ethnicity Zip Age_Censored
14132 18405351-AC64-46A2-A003-8F7889351A13 33 1948-10-15 F Black/African American (Not Hispanic) Declined to specify 60616 None
8747 4ACD51E8-4A9B-4AA6-B635-166ADA5EF02E 89 1955-09-04 M Declined to specify Declined to specify 60652 None
2129 DF25CE0F-E45A-44D2-BE43-F49FE4F5E280 112 1932-11-19 F NaN NaN 60637 None
6591 7027DD58-6465-496C-880A-A6E825C155A8 146 1948-12-19 F Declined to specify Declined to specify 60615 None
16909 395DD5E7-45F9-456E-A127-9AB929E872F7 196 1955-02-21 F Declined to specify Declined to specify 60615 None

In [8]:
data['ICD_for_Enc'].head()


Out[8]:
Person_ID Person_Nbr Enc_ID Enc_Nbr Enc_Timestamp Diagnosis_Code_ID Description System
194529 80d3df88-dddf-5ad3-7cc1-b7b1ac6151fa 33 97825c51-4462-eade-1c1d-2baa3400c033 123227 2014-12-18 14:00:00 367.4 Presbyopia icd9
194530 80d3df88-dddf-5ad3-7cc1-b7b1ac6151fa 33 97825c51-4462-eade-1c1d-2baa3400c033 123227 2014-12-18 14:00:00 373.00 Blepharitis unspecified icd9
194531 80d3df88-dddf-5ad3-7cc1-b7b1ac6151fa 33 97825c51-4462-eade-1c1d-2baa3400c033 123227 2014-12-18 14:00:00 250.00 Diabetes mellitus without mention of complicat... icd9
136763 adca6fa4-e7d4-d7f8-cf41-27056662d84b 89 a6d9d991-4ff4-79b5-304d-f1b2bff9d6d0 12870648 2012-10-16 03:45:00 365.02 Anatomical narrow angle borderline glaucoma icd9
136764 adca6fa4-e7d4-d7f8-cf41-27056662d84b 89 a6d9d991-4ff4-79b5-304d-f1b2bff9d6d0 12870648 2012-10-16 03:45:00 250.00 Diabetes Mellitus Type 2 Uncomplicated icd9

In [ ]: