Google Health

Google Health is Google’s platform for health and fitness data. It replaces the legacy Fitbit Web API, so data from Fitbit and Pixel Watch devices now reaches Avicenna through Google Health. Google combines the data from all devices connected to a participant’s Google account into a single stream. Avicenna collects this data from Google’s servers, so participants don’t need to export or upload anything themselves.

[!important] Google Health Replaces Fitbit
The legacy Fitbit data sources can no longer be added to new studies. Data already collected through them stays available for export. To keep collecting data from Fitbit devices, add the Google Health data sources to your study, and ask your participants to grant access to Google Health. Participants must grant access again even if they had already granted access to Fitbit. See the Moving from Fitbit section for details.

Supported Google Health Metrics in Avicenna

In this section, we list the Google Health metrics that Avicenna supports. Each metric is a separate data source, so you can add only the ones your study needs.

Most metrics include these two fields, which describe where the record came from:

  • Platform: The platform that uploaded the data, as reported by Google. Internally stored as platform. Possible values:

    • PLATFORM_UNSPECIFIED: The platform is unspecified.
    • FITBIT: Data uploaded from Fitbit.
    • HEALTH_CONNECT: Data uploaded from Android Health Connect.
    • HEALTH_KIT: Data uploaded from Apple HealthKit.
    • FIT: Data uploaded from Google Fit.
    • FITBIT_WEB_API: Data uploaded through the legacy Fitbit Web API.
    • NEST: Data uploaded from Nest devices.
    • GOOGLE_WEB_API: Data uploaded through the Google Health API.
    • GOOGLE_PARTNER_INTEGRATION: Data uploaded through Google Partner Integrations.
  • Recording Method: How the data was recorded. Internally stored as recording_method. Possible values:

    • RECORDING_METHOD_UNSPECIFIED: The recording method is unspecified.
    • MANUAL: Data manually entered by the user.
    • PASSIVELY_MEASURED: Data measured automatically by a device.
    • DERIVED: Data calculated from other data, for example, by a backend algorithm.
    • ACTIVELY_MEASURED: Data measured through an actively initiated measurement.
    • UNKNOWN: The recording method is unknown, typically because a third-party app did not provide this information.

These values are defined in Google’s Google Health API reference. Google may add new values over time.

Google Health Heart Rate

Download Sample Data

Provides the participant’s heart rate measurements. It is stored internally as google_health_heart_rate and includes the following fields:

  • Record Time: The time the heart rate was measured. Internally stored as record_time.
  • Heart Rate: The heart rate, in beats per minute (BPM). Internally stored as heart_rate.
  • Platform and Recording Method: See above.

Google Health Steps

Download Sample Data

Provides the number of steps the participant took. Google reports steps in short intervals (usually one minute). Each record covers one interval. It is stored internally as google_health_steps and includes the following fields:

  • Record Time: The start time of the interval. Internally stored as record_time.
  • Steps: The number of steps taken during the interval. Internally stored as steps.
  • Platform and Recording Method: See above.

Google Health Distance

Download Sample Data

Provides the distance the participant traveled. Each record covers one interval. It is stored internally as google_health_distance and includes the following fields:

  • Record Time: The start time of the interval. Internally stored as record_time.
  • Distance: The distance traveled during the interval, in meters. Internally stored as distance.
  • Platform and Recording Method: See above.

Google Health Floors

Download Sample Data

Provides the number of floors the participant climbed, as one total per day. It is stored internally as google_health_floors and includes the following fields:

  • Record Time: The day the total belongs to, recorded as midnight UTC of that day. The day itself is the participant’s local calendar day. For example, floors climbed on March 5 in the participant’s own time zone are recorded as March 5, 00:00 UTC. Internally stored as record_time.
  • Floors: The number of floors climbed during the day. Internally stored as floors.

[!note]
Google provides floors only as a daily total, with no information about the recording device. So this data source has no Platform or Recording Method fields. Days with no floors climbed have no record.

Google Health Activity Level

Download Sample Data

Shows how active the participant was over time. Google classifies each short interval (usually one minute) into one activity level. It is stored internally as google_health_activity_level and includes the following fields:

  • Record Time: The start time of the interval. Internally stored as record_time.
  • Activity Level: The activity level for the interval. Internally stored as activity_level. Possible values:
    • SEDENTARY
    • LIGHTLY_ACTIVE
    • FAIRLY_ACTIVE
    • VERY_ACTIVE
  • Duration: The length of the interval, in seconds. Internally stored as duration_sec.
  • Platform and Recording Method: See above.

[!tip]
To get the total time spent at each activity level in a day (similar to the Sedentary Duration, Lightly Active Duration, and other fields of the legacy Fitbit data sources), add up the Duration of all records with the same activity level in that day.

Google Health Active Zone Minutes

Provides the active zone minutes the participant earned in elevated heart rate zones. It is stored internally as google_health_active_zone_minutes and includes the following fields:

  • Record Time: The start time of the interval. Internally stored as record_time.
  • Zone: The heart rate zone, defined by Google for each participant based on their age and resting heart rate. Internally stored as zone. Possible values:
    • FAT_BURN: Moderate intensity, the lowest of the three zones.
    • CARDIO: Vigorous intensity.
    • PEAK: The highest intensity zone.
  • Minutes: The active zone minutes earned in this zone during the interval, as reported by Google. Internally stored as minutes.
  • Platform and Recording Method: See above.

[!note] Cardio and Peak Minutes Count Double
Like Fitbit, Google counts each minute in the FAT_BURN zone as one Active Zone Minute and each minute in the CARDIO or PEAK zone as two. Swimming is an exception: each minute counts as one Active Zone Minute, regardless of the heart rate zone. Therefore, minutes represents the credited Active Zone Minutes, not necessarily the time spent in the zone.

Google Health Sleep

Download Sample Data

Provides a summary of each sleep session. It is stored internally as google_health_sleep and includes the following fields:

  • Record Time: The start time of the sleep session. Internally stored as record_time.
  • Start Time: The start time of the sleep session. Internally stored as start_time.
  • End Time: The end time of the sleep session. Internally stored as end_time.
  • Log Type: The type of sleep data Google has for this session. Internally stored as log_type. Possible values:
    • STAGES: The session has sleep stages (light, deep, REM).
    • CLASSIC: The session has only asleep, awake, and restless periods. This is common for short sessions, or when the device could not measure stages.
  • Duration: The total length of the session, in seconds. Internally stored as duration_sec.
  • Efficiency: The percentage of time in bed that the participant was asleep, from 0 to 100. Internally stored as efficiency.
  • Main Sleep: true for a main sleep session, and false for a nap. Internally stored as is_main_sleep.
  • After Wake Duration: The minutes the participant stayed in bed after waking up. Internally stored as minutes_after_wakeup.
  • Asleep Duration: The total minutes the participant was asleep. Internally stored as minutes_asleep.
  • Awake Duration: The total minutes the participant was awake during the session. Internally stored as minutes_awake.
  • To Fall Asleep Duration: The minutes it took the participant to fall asleep. Internally stored as minutes_to_fall_sleep.
  • In-Bed Duration: The total minutes of the sleep period. Internally stored as minutes_in_bed.
  • Platform and Recording Method: See above.

[!note] Sleep Efficiency
Google does not provide a sleep efficiency value. Avicenna calculates it as Asleep Duration divided by In-Bed Duration. Values can be different from the efficiency the legacy Fitbit data source reported.

Google Health Sleep Level

Download Sample Data

Provides the sleep stages within each sleep session. Each record is one stage. It is stored internally as google_health_sleep_level and includes the following fields:

  • Record Time: The start time of the stage. Internally stored as record_time.
  • Level: The sleep stage. Internally stored as level. Possible values:
    • For STAGES sessions: AWAKE, LIGHT, DEEP, REM.
    • For CLASSIC sessions: ASLEEP, AWAKE, RESTLESS.
  • Duration: The length of the stage, in seconds. Internally stored as duration_sec.
  • Platform and Recording Method: See above.

Google Health Weight

Provides the participant’s weight measurements, from a connected smart scale or entered manually. It is stored internally as google_health_weight and includes the following fields:

  • Record Time: The time the weight was measured. Internally stored as record_time.
  • Weight: The weight, in kilograms. Internally stored as weight.
  • Platform and Recording Method: See above. Use Recording Method to tell scale readings from manual entries.

Google Health Body Fat

Provides the participant’s body fat measurements, from a connected smart scale or entered manually. It is stored internally as google_health_body_fat and includes the following fields:

  • Record Time: The time the body fat was measured. Internally stored as record_time.
  • Body Fat: The body fat percentage, from 0 to 100. Internally stored as body_fat.
  • Platform and Recording Method: See above.

Google Health Nutrition Log

Provides the foods the participant logged. Each record is one logged food item. It is stored internally as google_health_nutrition_log and includes the following fields:

  • Record Time: The time the food was logged for. Internally stored as record_time.
  • Meal Type: The meal or eating occasion the food belongs to. Internally stored as meal_type. Possible values:
    • BEFORE_BREAKFAST: Food consumed before breakfast.
    • BREAKFAST: Breakfast.
    • BEFORE_LUNCH: Food consumed between breakfast and lunch, such as a morning snack.
    • LUNCH: Lunch.
    • BEFORE_DINNER: Food consumed between lunch and dinner, such as an afternoon snack.
    • DINNER: Dinner.
    • AFTER_DINNER: Food consumed after dinner, such as an evening snack.
    • SNACK: A snack not associated with a specific meal.
    • ANYTIME: Food not tied to a specific meal or time.
    • MEAL_TYPE_UNSPECIFIED: The meal type is unspecified.
  • Food ID: The unique ID of this food log entry. Internally stored as food_id.
  • Food Name: The name of the food, as shown to the participant. Internally stored as food_display_name.
  • Serving Amount: The number of servings eaten. Internally stored as serving_amount.
  • Serving Unit ID: The ID of the serving unit, for example a cup or a slice. Internally stored as serving_unit_id.
  • Energy: The energy of the food, in kilocalories (kcal). Internally stored as energy_kcal.
  • Energy From Fat: The energy that comes from fat, in kcal. Internally stored as energy_from_fat_kcal.
  • Carbohydrate: The total carbohydrate, in grams. Internally stored as carbohydrate_grams.
  • Fat: The total fat, in grams. Internally stored as fat_grams.
  • Platform and Recording Method: See above.

Fields the participant did not provide, such as the meal type or the fat content of a custom food, are left empty.

Google Health Hydration Log

Provides the water intake the participant logged. Each record is one log entry. It is stored internally as google_health_hydration_log and includes the following fields:

  • Record Time: The time the water intake was logged for. Internally stored as record_time.
  • Entry ID: The unique ID of this log entry. Two entries can have the same Record Time, so use this field to tell them apart. Internally stored as entry_id.
  • Amount: The amount of water consumed, in milliliters. Internally stored as amount_ml.
  • Platform and Recording Method: See above.

[!info] What Is Not Collected
Avicenna currently does not collect these Google Health data types:

  • Active energy burned and total calories burned.
  • Micronutrients (vitamins, minerals, and similar) in nutrition logs. Only the fields listed above are stored.
  • Location, electrocardiogram (ECG), and irregular rhythm notifications.
  • Oxygen saturation (SpO2), respiratory rate, skin temperature, heart rate variability, and cardio fitness.

Data Collection Behavior

The participant’s device syncs its data to the participant’s Google account, usually through the Fitbit app on their phone. When new data arrives, Google notifies Avicenna, and Avicenna then downloads the new data from Google’s servers. Nothing is collected directly from the device by the Avicenna app. This means:

  • Data appears in Avicenna only after the device has synced with Google. If the participant does not open the Fitbit app or their phone is offline, the data arrives later, in a batch. Once Google has the data, it usually appears in Avicenna within a few minutes.
  • Avicenna only stores records whose time is within the participant’s participation period in a study that includes the data source. Records from before the participant joined, or after their participation period ended, are not stored.
  • Avicenna does not import historical data when a participant grants access. Collection starts from the moment of the grant.
  • If a participant is enrolled in more than one study that collects the same Google Health data source, each study receives its own copy of the records.
  • If Google is temporarily unavailable or limits the number of requests, Avicenna retries later. In this case, data can take several hours to appear.
  • If the participant edits a record in the Fitbit app, the new version is collected.

All times are stored in UTC.

Adding Google Health As a Data Source

See Adding Data Sources. In the list of available data sources, choose the Google Health metrics you need. Their names start with Google Health.

When a participant grants access, Google asks them to allow access to groups of data, not to each metric. The groups needed depend on the data sources in your study:

Google permission Needed for
Activity and Fitness Steps, Distance, Floors, Activity Level, Active Zone Minutes
Health Metrics and Measurements Weight, Body Fat
Both of the above Heart Rate
Sleep Sleep, Sleep Level
Nutrition Nutrition Log, Hydration Log

If you add a new Google Health data source after participants have joined, and it needs a permission they have not granted yet, those participants need to grant access again.

Monitoring and Exporting Google Health Data

You can export and download the collected Google Health data using the Data Export page. Exports are produced in CSV format.

[!note]
Google Health data is available through data export only. It is not indexed in Kibana.

Google Health Data Source in Participant App

After joining a study, participants must grant Avicenna access to their Google Health data. Before they start, they need a Google account with a Fitbit profile, with their device connected to it. Participants who still sign in to the Fitbit app with an old Fitbit account must first move it to a Google account in the Fitbit app.

  1. Open the Avicenna app and navigate to Settings > My Studies.
  2. Select the study that collects Google Health data.
  3. Tap on Data Sources. This page lists every data source the study collects.
  4. Find the Google Health data source and tap the Grant Access button next to it. The app first shows which data Avicenna will collect and that the data is shared with the research team.
  5. A Google sign-in page opens in the phone’s browser. The participant signs in with the Google account their device is connected to.
  6. Google shows the groups of data Avicenna asks for. The participant should allow all of them. If they leave out a group your study needs, the data source still shows as not granted, and the participant needs to grant access again.
  7. After the participant allows access, they return to the Avicenna app, and the Google Health data sources show as granted. Collection begins from that point onward.

One grant covers all the Google Health data sources of all the participant’s studies, and all the devices connected to their Google account.

[!note]
If the participant’s Google account has no Fitbit profile, the grant fails and the participant returns to the app without access. They need to sign up at fitbit.google.com with the same Google account, connect their device, and then grant access again.

Participants can stop sharing data at any time by returning to the Data Sources page for the study and tapping Revoke Access on the Google Health data source. Revoking removes Avicenna’s access to the participant’s Google Health data, for all their studies. Data collected before revocation is retained. Participants can also remove Avicenna’s access from their Google account settings.

Moving from Fitbit

Google is shutting down the legacy Fitbit Web API. Existing studies that collect the legacy Fitbit data sources should move to Google Health:

  1. Add the matching Google Health data sources to your study. The table below shows which Google Health data source replaces each Fitbit data source.
  2. Ask your participants to grant access to Google Health, as described in the Google Health Data Source in Participant App section above. When a participant grants access with the Google account that holds their Fitbit profile, Avicenna automatically stops collecting from their old Fitbit connection, so the same data is not collected twice.
Legacy Fitbit data source Google Health data source(s)
Fitbit Heart Rate Google Health Heart Rate
Fitbit Sleep Google Health Sleep
Fitbit Sleep Level Google Health Sleep Level
Fitbit Activity, Fitbit Activity Summary Google Health Steps, Google Health Distance, Google Health Floors, Google Health Activity Level
Fitbit Active Zone Google Health Active Zone Minutes
Fitbit Weight Log Google Health Weight, Google Health Body Fat
Fitbit Food Summary Google Health Nutrition Log, Google Health Hydration Log

[!warning] The Data Is Not Identical
Google Health data sources are new data sources with their own tables. Account for these differences when combining Fitbit and Google Health data in your analysis:

  • Activity: Fitbit provided steps, distance, floors, calories, and activity durations together, with per-minute and daily records. Google Health provides each metric as a separate data source. Floors are available only as daily totals, and calories are not collected.
  • Weight: Google Health Weight is always reported in kilograms. Body fat is available as a separate data source.
  • Sleep: Log Type uses different values (STAGES and CLASSIC instead of auto_detected and manual). Sleep stage names also differ, and Avicenna calculates Efficiency.
  • Nutrition: Fitbit Food Summary provided daily totals. Google Health Nutrition Log provides one record per logged food and does not include protein, fiber, or sodium. Water intake is available through the separate Google Health Hydration Log.