GoogleCloudPlatform / healthcare

https://cloud.google.com/solutions/healthcare-life-sciences/
Apache License 2.0
373 stars 167 forks source link

`mimic_eicu/tutorials/BigQuery_ML.ipynb` notebook needs some changes #515

Open amygdala opened 2 years ago

amygdala commented 2 years ago

In this notebook: https://github.com/GoogleCloudPlatform/healthcare/blob/master/datathon/mimic_eicu/tutorials/BigQuery_ML.ipynb

I believe that this snippet:

# Set up the substitution preprocessing injection
if bigquery.magics._run_query.func_name != 'format_and_run_query':
  original_run_query = bigquery.magics._run_query

needs to be modified in 2 ways:

bigquery.magics._run_query --> bigquery.magics.magics._run_query
In py3 (which I'm assuming everyone is using now), func_name --> __name__

amygdala commented 2 years ago

Even with the above changes, I'm not sure that the substitutions are working, however-- I see this output from that setup cell:

custom %%bigquery magic substitutions:
  {admissions_table} → physionet-data.mimiciii_clinical.admissions
  {d_icd_diagnoses_table} → physionet-data.mimiciii_clinical.d_icd_diagnoses
  {diagnoses_icd_table} → physionet-data.mimiciii_clinical.diagnoses_icd
  {patients_table} → physionet-data.mimiciii_clinical.patients

but running a cell like this:

%%bigquery
SELECT
  COUNT(*) as total,
  SUM(HOSPITAL_EXPIRE_FLAG) as died
FROM
  `{admissions_table}`

gives this error:

ERROR:
 400 Table "{admissions_table}" must be qualified with a dataset (e.g. dataset.table).