• Unified API
  • Mobile SDK
  • Connection Widget
  • Streaming
  • Lab Reports API
  • Graph API
  • Health Scores
  • Health Rewards
  • Planned Workouts
  • Lab Testing
  • AI Interface
  • Enterprise
  • Insurance
  • Integrations
  • Research
  • Podcast
  • Blog
  • Reports
  • Events
  • Documentation
  • Community
  • Example apps
  • Wearable Data
  • About
  • Customers
  • Partners
  • Careers
  • Support
  • Pricing
Terra
Pricing
Become an integrationGet started
All examples
Product
Lab Reports API
Platform
Web app
Repository
tryterra/terra-examples

In this example:

  • 01Overview
  • 02What's inside
  • 03Run it locally
  • 04Next steps
  • 05More examples
All examples

Lab Reports API

Terra Panel

Put lab results and wearable data side by side. Turn a lab report PDF into standardised biomarkers and see how each one lines up with the patient's sleep, heart rate and training.

Terminal
npx @tryterra/cli examples clone lab-reports-web-app
View on GitHubDocumentation
Terra Panel patient view for Marcus Reid with an AI intelligence brief and flagged lab values for cholesterol, glucose and vitamin D, on a lavender background

Overview

Panel is a clinician-facing dashboard that joins lab results to wearable data. Upload a lab report PDF and the Lab Reports API returns standardised biomarkers with ranges, flags and provenance, which Panel charts against the same patient's sleep, resting heart rate and training. Without credentials it runs in demo mode on synthetic data: four patients, three years of lab history and 18 months of wearable data.

What's inside

  1. Report standardisation: PDF in, canonical biomarkers out, each with its range, flag and provenance.
  2. Cross-report trends: markers matched by biomarker key, so they chart across labs, languages and formats.
  3. Labs meet wearables: results joined to wearable data by reference ID, the one key they share.
  4. Health timeline: lab draws plotted over resting heart rate, HRV, sleep and training.
  5. Pre-draw context: recent exertion and short sleep shown next to each report, since both skew results.
  6. Explainable scoring: deterministic domain scores against each patient's own baseline, kept apart from the AI layer.
  7. AI insights: schema-validated structured output, cached by input.

Run it locally

You need the Terra CLI and Node.js 20 or later. Demo mode needs nothing else. For live data, you need a dev ID and API key with Lab Reports enabled, plus the wearable data types you want.

1. Start in demo mode

Terminal
terra examples clone lab-reports-web-app my-appcd my-appnpm installnpm run dev

Open localhost:5173. Demo mode serves the same read path as live mode from a local cache, with changes disabled behind a banner.

2. Go live

Terminal
cp .env.example .env# TERRA_DEV_ID=# TERRA_API_KEY=npm run seed

Fill in both keys, then seed four patients. The script prints their reference IDs.

3. Upload reports

Upload the PDFs in sample-reports/, oldest first so trends build up, or use your own. Results appear by panel with range bars, flags and changes since the previous report.

4. Add wearable data

Terminal
npm run seed:wearables -- <referenceId>

Or use the Connect wearable button in the app. Lab draws then appear as markers over daily metrics.

Add an ANTHROPIC_API_KEY to turn on the Intelligence Brief, chat and wearable insights on flagged values. Everything else works without it.

Next steps

Start with src/server/lib/lab-reports.ts. Lab sessions never change once they finish, so the app caches completed payloads and refetches anything still processing. The scoring registry in src/server/lib/analysis/ is declarative, so adding a domain or adjusting a guideline band is a data change rather than new code.

PreviousTerra DispatchNextTerra Grip

More examples

  • Terra Grip phone screen streaming a live heart rate of 70 bpm and an R-R interval of 624 ms, each with a trend line, on a dark background

    Streaming API

    Terra Grip

    A React Native reference app for the Streaming API: pair a wearable, stream live biometrics to Terra, and render them on screen. No backend, no keys on the device.

  • Terra Basecamp health dashboard with an ask-about-your-health prompt, AI insights and daily sleep and stress scores, on a red background

    Unified API

    Terra Basecamp

    A complete Unified API integration: wearable connections, webhook ingestion, multi-device deduplication, a live dashboard, and an AI health assistant.

  • Terra Pulse streaming dashboard with a live heart-rate chart over the last 60 seconds and sparkline cards for acceleration, distance, floors, gyroscope, speed and steps, on a blue background

    Streaming API

    Terra Pulse

    A React web app for the Streaming API: connect to Terra as a consumer, receive live biometrics over a WebSocket, and render them on a real-time dashboard.

next ventures
pioneer fund
samsung next
y combinator
general catalyst

The world's best health apps run on Terra data

Get started
ProductsIntegrationsAI InterfaceAuthenticationMobile DevelopmentDocumentationGraphAPI
DocumentationAPISDKQuickstartExample Apps
CommunityBlogResearchCommunityPodcastAuthorsGithub
CompanyAboutCareersCustomersBecome an IntegrationCookies PolicyGDPRPrivacy PolicyTerms of Purchase
© Terra API. 2026 — All rights reserved.

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