Last Updated: 2020-01-08

This codelab implements a solution to access and visualize clinical data aggregated in BigQuery using Looker. It illustrates data exploration of large healthcare datasets using Looker. Looker seamlessly integrates with Google Cloud BigQuery, which makes it quick and simple to start building population and patient level dashboards on Google Cloud.

In this code lab you will learn to:

What do you need to run this codelab?

In this section, you will submit a registration form to get access to a Looker instance. Once you are registered with Looker and get access, you can log in and build reports and dashboards in Looker.

User Registration

  1. Fill out this form to register for a new Looker account. Once you SUBMIT the form, you will receive an email to activate your account, set a password, and finish the registration.

  1. Once you receive the welcome email from Looker, Activate Your Account.

  1. Next, you are taken to the Activation form. Complete the Activation form to set the password and activate your account. Then, you are taken to the Home screen of Looker.

Login to Looker

Use this link to log into Looker.

  1. In Looker, navigate to the Develop dropdown. Select the existing bqlooker_codelab LookML project to start exploring. The Look ML Project's Model and View files window is displayed.

  1. Click Validate Again to check for errors. A green "No LookML Issues" indicates success!

  1. Click the Explore dropdown to see all existing explores. Explores are basic SQL query building blocks for your reports (Looks).

Add customized dimensions and measures by modifying LookML xxx.view files

  1. Click the Develop dropdown.
  2. Slide the purple Development Mode button to turn it on.

  1. Click the Explore dropdown and select Patients with Conditions and Medications.
  2. Click the ‘wheel' symbol next to Count and select Go to LookML to open "patients_with_conditions_and_medications.view".

  1. This view can also be accessed from Develop>bqlooker_codelab>Expand the view.
  2. Include the following code snippet in the "patients_with_conditions_and_medications.view" file to add "number_of_patients" as a new measure.
  measure: number_of_patients {
    type: count
    drill_fields: [lastname]
  }

The following screen shot shows the code snippet in the file: patients_with_conditions_and_medications.view

  1. Click Save. Go back to the Explore -> Patients with Conditions and Medications window and refresh the screen to verify a new measure "Number of Patients" was added.

  1. Click the Explore dropdown and select the Patient Vital Info.
  2. Click the ‘wheel' symbol next to the Count field and select "Go to LookML" to open "patient_vital_info.view".
  3. Include the following code snippet in the ‘patient_vital_info.view' file to add ‘RoundedValue' as a dimension, and ‘DIA' and ‘SYS' as measures.
dimension: RoundedValue {
    type: number
    sql: round(${value},2);;
  }

  measure: DIA {
    type: average
    sql:
     CASE
       WHEN ${patient_vital_info.measurement} like "%Diastolic%"
       THEN round(${value},0)
     END;;
  }

  measure: SYS {
    type: average
    sql:
     CASE
       WHEN ${patient_vital_info.measurement} like "%Systolic%"
       THEN round(${value},0)
     END;;
  }

The following screen shot shows the code snippet in the file:

  1. Click Save. Go back to the Explore -> Parent Vital Info window and refresh the screen to verify the new fields were added.

Create Folder structure to organize Looks

  1. Click Browse -> Select your Personal Folder (e.g. Codelab User's folder)
  2. Click the New button and select Folder

  1. Provide the folder name: ‘Population Management' and click the Create folder button

  1. Repeat steps 1, 2 and 3 to create another folder by name ‘Patient Level Visualization' under your personal folder.
  2. You should have two folders under your personal folder.

Build Looks for Population Management

In Looker, click the Explore dropdown, then select Patients with Conditions and Medications to build reports and views (also known as Looks).

Build a Patients list by conditions and number of medications Look with the following steps:

  1. Click the FILTER button next to "Condition Desc" and "Med Count" dimensions to add filtering criteria. In this codelab, we filter data by the following two criteria:

  1. Select the "Patient ID", "Med Count", and "Condition Desc" dimensions by highlighting each field to add "Patient ID", "Med Count" and "Condition Desc" data elements in the RESULTS section.

  1. Click the "Table" icon in the Visualization tab to add "Patient ID", "Med Count" and "Condition Desc" data elements to the view.

  1. Click Run to get the results.

  1. Click the EDIT "down arrow" in the Visualization tab to add and update information in the view. Place cursor in each textbox and type the desired text to overwrite the default text.

  1. Click the "wheel" symbol next to the Run button and select "Save as a Look".

  1. Select the ‘Population Management' folder.
  2. Provide the Title and Description.

  1. Click the Save & View Look or Save button to save the Look.

Build the Total number of patients by conditions Look with the following steps:

  1. Click the FILTER button next to the "Condition Desc" and "Med Count" dimensions to add filtering criteria. In this codelab, we filter data by following two criteria:
  1. Select the "Number of Patients" measure by highlighting the field to add the ‘number of patients' data element in the RESULTS section.
  2. Click the "Single Value" icon in the Visualization tab to add the ‘Number of patients' data element to the view.
  3. Click Run to get the results.

  1. Click the EDIT "down arrow" in the Visualization tab to add and update information in the view. Place cursor in each textbox and type the desired text to overwrite the default text.
  2. Click the "wheel" symbol next to the Run button and select "Save as a Look".
  3. Select the ‘Population Management' folder. Provide the name and description.
  4. Click the Save & View Look or Save button to save the Look.

Build Patient count by number of medications Look with the following steps:

  1. Click the FILTER button next to the "Condition Desc" and "Med Count" dimensions to add filtering criteria. In this codelab, we filter data by following two criteria:
  1. Select the "Med Count" dimension and the "Number of Patients" measure by highlighting each field to add "Med Count" and "Number of Patients" data elements in the RESULTS section.
  2. Click the "Column" icon in the Visualization tab to add "Med Count" and "Number of Patients" data elements to the view.
  3. Click Run to get the results.


  1. Click the EDIT "down arrow" in the Visualization tab to add and update information in the view. Place cursor in each textbox and type the desired text to overwrite the default text.
  2. Click the "wheel" symbol next to the Run button, and select "Save as a Look".
  3. Select ‘Population Management' folder. Provide name and description.
  4. Click Save & View Look or Save button to save the Look.

Build Patient count by conditions Look with the following steps:

  1. Click the FILTER button next to the "Condition Desc" and "Med Count" dimensions to add filtering criteria. In this codelab, we filter data by following two criteria:
  1. Select the "Condition Desc" dimension and the "Number of Patients" measure by highlighting each field to add "Condition Desc" and "Number of Patients" data elements in the RESULTS section.
  2. Click the "Pie" icon in the Visualization tab to add "Condition Desc" and "Number of Patients" data elements to the view.
  3. Click Run to get the results.

  1. Click the EDIT "down arrow" in the Visualization tab to add and update information in the view.
  2. Click the "wheel" symbol next to the Run button, and select "Save as a Look".
  3. Select ‘Population Management' folder. Provide Title and Description.
  4. Click Save & View Look or Save button to save the Look.

Patients population reports summary

In Looker, click the Browse dropdown, select <<Personal Folder>>, then select "Population Management" folder to verify that four reports (also known as Looks) were created.

Build Looks to show Patient's Vital Information

In Looker, click the Explore dropdown, then select Patient Vital Info to build reports and views (also known as Looks).

Build Patient's Blood Pressure measurement Look with the following steps:

  1. Click the FILTER button next to the "Dateofmeasurement Date", "Measurement" and "Patient ID" dimensions to add the filtering criteria. In this codelab, we filter data by following three criteria:

  1. Select the "Dateofmeasurement Date" dimension, and "Dia" (Diastolic) and "Sys" (Systolic) measures by highlighting each field to add the "Dateofmeasurement Date", "Dia" (Diastolic) and "Sys" (Systolic) data elements in the RESULTS section.

  1. Click the "Line" icon in the Visualization tab to add the "Dateofmeasurement Date", "Dia" (Diastolic) and "Sys" (Systolic) data elements to the view.

  1. Click Run to get the results.

  1. Click the EDIT "down arrow" in the Visualization tab to add or update information in the view. Place the cursor in each textbox and type the desired text to overwrite the default text.

  1. Change the filter criteria Dateofmeasurement Date so it is in the range of 2015-04-02 until (before) 2015-08-02 to expand the cluster of Blood Pressure measurements.

  1. Click the "wheel" symbol next to the Run button and select "Save as a Look".
  2. Select the ‘Patient Level Visualization' folder. Provide the Title and Description.

  1. Click the Save & View Look or Save button to save the Look.

Build Patient's Body Mass Index measurement Look with the following steps:

  1. Click the FILTER button next to the "Dateofmeasurement Date", "Measurement" and "Patient ID" dimensions to add filtering criteria. In this codelab, we filter data by following three criteria:
  1. Select the "Roundedvalue", "Dateofmeasurement Date", and "Measurement" dimensions by highlighting each field to add "Roundedvalue", "Dateofmeasurement Date", and "Measurement" data elements in the RESULTS section.
  2. Click the "Line" icon in the Visualization tab to add "Roundedvalue", "Dateofmeasurement Date", and "Measurement" data elements to the view.
  3. Click Run to get the results.

  1. Click the EDIT "down arrow" in the Visualization tab to add and update information in the view.
  2. Click the "wheel" symbol next to the Run button, and select "Save as a Look".
  3. Select ‘Patient Level Visualization' folder. Provide Title and Description.
  4. Click Save & View Look or Save button to save the Look.

Build Patient's Hemoglobin A1c measurement Look with the following steps:

  1. Click the FILTER button next to "Dateofmeasurement Date", "Measurement" and "Patient ID" dimensions to add filtering criteria. In this codelab, we filter data by following three criteria:
  1. Select the "Roundedvalue", "Dateofmeasurement Date", and "Measurement" dimensions by highlighting each field to add "Roundedvalue", "Dateofmeasurement Date", and "Measurement" data elements in the RESULTS section.
  2. Click the "Line" icon in the Visualization tab to add "Roundedvalue", "Dateofmeasurement Date", and "Measurement" data elements to the view.
  3. Click Run to get the results.

  1. Click the EDIT "down arrow" in the Visualization tab to add or update information in the view.
  2. Click the "wheel" symbol next to the Run button, and select "Save as a Look".
  3. Select ‘Patient Level Visualization' folder. Provide Title and Description.
  4. Click Save & View Look or Save button to save the Look.

Build Patient's Measurements Table Look with the following steps:

  1. Click the FILTER button next to "Dateofmeasurement Date" and "Patient ID" dimensions to add filtering criteria. In this codelab, we filter data by following two criteria:
  1. Select the "Dateofmeasurement Date", "Measurement", "Roundedvalue", and "Unit" dimensions by highlighting each field to add "Dateofmeasurement Date", "Measurement", "Roundedvalue", and "Unit" data elements in the RESULTS section.
  2. Click the "Table" icon in the Visualization tab to add "Dateofmeasurement Date", "Measurement", "Roundedvalue", and "Unit" data elements to the view.
  3. Click Run to get the results.

  1. Click the EDIT "down arrow" in the Visualization tab to add and update information in the view.
  2. Click the "wheel" symbol next to the Run button, and select "Save as a Look".
  3. Select ‘Patient Level Visualization' folder. Provide Title and Description.
  4. Click Save & View Look or Save button to save the Look.

Patient's Vital Information reports summary

In Looker, click the Browse dropdown, select <<Personal Folder>>, then select "Patient Level Visualization" folder to verify that four reports (also known as Looks) were created.

There are several ways to create a dashboard in Looker:

This codelab will show you how to create a Dashboard from a saved Look.

Build Population Dashboard

  1. Browse to your personal folder or subfolder (for example, Population Management) where the Looks are located.
  2. Select the Look to open (for example, Patients list by conditions and number of medications).
  3. Click the "wheel" symbol, select "Save to Dashboard" or click "Add To Dashboard" link to add the Look to a dashboard.

  1. Click the New Dashboard button. Provide a dashboard name, then click OK. Or select an existing dashboard.
  2. Click the Add Look to Dashboard or Save to Dashboard button. Either choice will add the Look into the dashboard.
  1. If the Add Look to Dashboard button is clicked, the Dashboard link will appear in the "On Dashboards" section of the Look view. This symbol also appears in the Folder view.

  1. If the Save to Dashboard button is clicked, ‘No' will appear in the "On Dashboards" section of the Look view.

  1. Repeat steps 1 through 5 to add more Looks onto the dashboard.
  2. Click Browse dropdown, select <<Personal Folder>>, then select "Population Management" folder. Verify all four Looks were added to the new "Population Dashboard".

  1. Click "Population Dashboard" to open it.
  2. Click the Edit button to rearrange the tiles as desired.
  3. Add Filters to the Population Dashboard by clicking the Filters menu.
  1. Click the New Filter button.
  2. Provide a filter name (for example, Numbers of Medications Taken), then select the type (for example, Field).
  3. In the ‘Select a field to link to this filter' section, choose Model (for example, Bqlooker Codelab), choose Explore (for example, Patients with Conditions and Medications), and choose Field (for example, Med Count).
  4. Set the default value (For example, Med Count >= 13).
  5. Select the dashboard tiles to update when this filter changes by clicking All button or slide the purple button for each tile.
  6. Click Save.

  1. Click Done Editing, then Run the dashboard again to ensure all filters are working as expected.

Build Patient Dashboard

  1. Browse to your personal folder or subfolder (for example, Patient Level Visualization) where the Looks are located.
  2. At the upper right corner, click the New button, select Dashboard, and provide a name (for example, Patient Dashboard).

  1. Click the Create Dashboard button.

  1. Option 1: Click New Tile, select an Explore, and start building a Tile, which is the same as a Look.
  2. Option 2: Click the Add Looks link, click +Add button to add a Look (or Remove to remove a look), and click Update Dashboard button. This Codelab used Option 2.

  1. The Patient Dashboard is displayed in the Edit mode. Rearrange the tiles as desired.
  2. Add the Patient and Date filters to the Patient Dashboard by clicking the Filters menu.
  1. Click the New Filter button.
  2. Provide a filter name (for example, Patient), then select the type (for example, Field).
  3. In the ‘Select a field to link to this filter' section, choose Model (for example, Bqlooker Codelab), choose Explore (for example, Patient Vital Info), and choose Field (for example, Patient ID).
  4. Set the default value (for example, Patient ID = 287b4723-9c8d-495a-9915-54386d8dcc31).
  5. Select the dashboard tiles to update when this filter changes by clicking All button or slide the purple button for each tile.
  6. Click Save.
  1. Repeat step 5 to add the Date filter (with choose Field = Dateofmeasurement Date, default value is in the past 10 years).

  1. Click Done Editing, then Run the dashboard again to ensure all filters are working as expected.

  1. Change the Date filter so that it is in the range 2015-04-02 until (before) 2015-08-02 to expand the ‘cluster' of blood pressure measurements.
  2. Click Done Editing, then Run the dashboard again to ensure all filters are working as expected.

  1. Click the Browse dropdown, select <<Personal Folder>>, then select "Patient Level Visualization" folder, verify all 4 Looks were added to the new "Patient Dashboard".

In this codelab, we create a link from the Population Dashboard to the Patient Dashboard by following these steps:

  1. Click the Browse dropdown, select <<Personal Folder>>, then select "Patient Level Visualization" folder.
  2. Open the ‘Patient Dashboard', and copy the URL (for example, https://googlecodelabs.gw1.cloud.looker.com/dashboards/9?Patient).

  1. Click the Develop dropdown, slide the purple button to turn on Development Mode, then select bqlooker_codelab LookML Project.

  1. Select to open "patients_with_conditions_and_medications.view" in your personal branch and add the following code snippet inside the dimension: patient_id{} to create a link from the Population Dashboard to the Patient Dashboard.
 link: {
     label: "View key vitals"
     url: "https://googlecodelabs.gw1.cloud.looker.com/dashboards/9?Patient={{value}}"
 }

The following screen shot shows the code snippet in the file:

  1. Click the Save button at the upper right corner.
  2. Browse and open the Population Dashboard.
  3. Click on the "..." symbol next to a Patient ID.
  4. Select "View key vitals" to open the Patient Dashboard.

  1. Navigate to the Develop dropdown and slide the purple button to turn off Development Mode.
  2. Browse to your dashboards and select a dashboard.
  3. Click the "3 vertical dots" symbol and select Add Schedule.

  1. Fill out all the information.
  2. Select options as desired.
  3. Add email addresses (click Add).
  4. Click Save All.
  5. Click the Send Test button to test the delivery of the dashboards. In this example, an email is sent every 5 minutes from 6 AM-6 PM.

  1. Check your mailbox for emails sent from Looker with the dashboard attached as a PDF file.

  1. Click the "3 vertical dots" symbol and select Edit Schedule at anytime to edit schedule.

  1. Apply a similar mechanism (step 1 through 10) for scheduling Looks to be sent out.

Looker account

Your account in Looker may get deleted in about 10 days.

Congratulations, you've successfully completed the code lab to access, query, and visualize FHIR formatted clinical data using Looker.

You accessed a public BigQuery dataset in GCP.

You explored an existing LookML Project in a pre-provisioned Looker instance.

You created Looks and Dashboards in Looker.

You linked dashboards together.

You scheduled to send Looks and Dashboards via email with PDF attachment.

You now know the key steps required to start your Healthcare Data Analytics journey with BigQuery and Looker.

©Google, Inc. or its affiliates. All rights reserved. Do not distribute.