Crunch Time: Embrace the Cookie Monster Within!

We use cookies to enhance your browsing experience and analyse our traffic. Nothing beyond essential cookies runs until you choose. You can change your mind any time in our Cookie Policy.

  • Unified API
  • Mobile SDK
  • Connection Widget
  • Streaming
  • Lab Reports API
  • Graph API
  • Health Scores
  • Health Rewards
  • Workouts & Routes
  • Predictions
  • Lab Testing
  • DNA Testing
  • AI Interface
  • Enterprise
  • Insurance
  • Integrations
  • Research
  • Podcast
  • Blog
  • Reports
  • Events
  • Documentation
  • Community
  • Example apps
  • Wearable Data
  • About
  • Customers
  • Partners
  • Startup Accelerator
  • Careers
  • Support
  • Pricing
Terra
Pricing
Become an integrationGet started


zap

Latest

zap

Popular

API

Unified API

SDK

Phone SDK

Authentication

Widget

Streaming

Streaming

Graph API

Graph API

Why is there duplicate data in daily payloads

All

RivalBasilisk31 months ago

I have noticed that for each user, I get multiple daily payloads every day and each one contains readings since the beginning of the day. What is the reasoning behind this and what is the best practice in deduplicating this data?

terra

Matthewadmin31 months ago

Hello there

The primary reason why Terra daily, body, nutrition and menstruation payloads contain all readings from the beginning of the day is to account for updates to readings that a provider may perform after the reading is taken, for example: Garmin may update scores after a period of activity. Additionally, this reflects how most data appears users in the app or web-portal provided by the device manufacturer (split by day).

In order to deduplicate Terra payloads:

  • Identify the start_time found in the metadata object in each data item and overrite the file or record in your database or bucket, with the new payload (or override if you wish to keep older payloads). If you make a REST request that spans several days, data will be chunked by date (one data object per day)
  • For activity and sleep payloads, deduplication and chunking is different as a sleep/workout session can span across days. Each data item for a sleep/activity payload records one event i.e a nap, sleep, workout, run, exercise, match etc. To deduplicate these, use the summary_id property available in the metadata object to consolodate the same events.