Terra
Integrations
Research

Integration

API
Unified API
SDK
SDK
Authentication
Authentication
Streaming
Streaming
Blood
Blood Report API
Planned Workouts
Planned Workouts
AI Interface
AI Interface

User engagement

Graph API
Graph API
Scores
Health Scores
Rewards
Health Rewards

Use cases

Enterprise
Enterprise
Insurance
Insurance

Developers

Wearable Data
Wearable Data
Community
Community
Documentation
Documentation

Learn

Blog
Blog
Podcast
Podcast
Events
Events
Reports
Reports

Company

Customers
Customers
Careers
Careers
Partners
Partners
Support
Support
Pricing
Become an integrationGet started
IntegrationsResearch
Unified APIUnified APISDKSDKAuthenticationAuthenticationStreamingStreamingGraph APIGraph APIScoresScoresRewardsRewardsBlood Report APIBloodAI InterfaceAI Interface
EnterpriseEnterpriseInsuranceInsuranceWearable DataWearable DataCommunityCommunityDocumentationDocumentationBlogBlogPodcastPodcastEventsEventsReportsReportsCustomersCustomersCareersCareersPartnersPartnersSupportSupport
Pricing
Get startedBecome an integration


Cookie Preferences

Essential CookiesAlways On
Advertisement Cookies
Analytics Cookies

Crunch Time: Embrace the Cookie Monster Within!

We use cookies to enhance your browsing experience and analyse our traffic. By clicking “Accept All”, you consent to our use of cookies according to our Cookie Policy. You can change your mind any time by visiting out cookie policy.

Cookies Policy
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

RivalBasilisk26 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

Matthewadmin26 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.