Skip to main content
Every source enters TechnicallyFit the same way. A source adapter turns one record of your source into the events the API already takes: observation events in the observation/1 format (see Observations) and logged_set events. Nothing else changes: the events go to POST /v1/teammates/{external_id}/events like any other, with the same consent, test and live modes, route limits and duplicate handling. An adapter is a mapping, not a connection. It does not call your source, store tokens or poll anything; moving the records is yours (or the SDK’s). It also builds toward no one provider: the contract, the kit and the examples here name no device or vendor.

The manifest

Each adapter declares what it maps in a manifest, source-adapter/2 (source-adapter/1 remains supported for existing adapters). The JSON Schema ships in @technicallyfit/source-adapters on npm as manifest.schema.json.

The rules

  • Registry quantities only. Map each reading to a quantity in the quantity registry, in a unit the registry converts. Do not invent a name or a unit for something the registry already has.
  • Unlisted quantities are declared, not hidden. A reading the registry does not list yet may be sent with its own lower-case name if the manifest marks it unregistered. The API stores it as not_interpreted (its kind is unknown), and when the registry later gains the quantity, stored readings inside the replay window are offered to the engine once.
  • Scores stay scores. A score your source computes (readiness, recovery, stress) is sent as the registry’s score quantity for it. It is carried and never acted on; do not map it to a measured quantity.
  • Summaries only. One observation is one number: never a list of samples or a stream. context stays under 2 KB and holds only text, numbers, true, false or null.
  • Unlike measures stay apart. A quantity with several measures (two kinds of heart rate variability, mean and peak bar speed) is sent once per measure, each with its measure. Two measures are never averaged into one observation.
  • Stable record ids. source.record_id is your source’s own id for the record, the same on every run, so a retry or a resend is answered duplicate. Two readings of one record get their own ids (for example the record id plus # and the quantity).
  • No more trust than declared. An event’s confidence is at most the record type’s default_confidence. The route’s own default caps it again when it is stored.
  • No vouching field. An adapter never sets vouching on an observation; TechnicallyFit assigns vouching at ingestion time.
  • Declared reducers for streams. A streaming record type reduces its samples into summaries (such as a mean, a peak, or time in a zone) using declared stream reducers before sending observations to the API. See Supported devices for the built-in starter adapters.
  • Provenance. Every observation names its adapter in context.adapter as name/version, so a later correction can tell which mapping produced it.
  • No teammate inside. An adapter’s events leave teammate out; the request path names the teammate.
  • Neutral names. Names, routes, record ids and device labels describe what the data is, never whose product made it.

Running the kit

Install the conformance kit from npm (npm install @technicallyfit/source-adapters), then give runConformance your adapter and a sample record for every record type:
Each check has a stable id: A report’s details name the sample, the event and the field; they never quote a value.

The live step

Pass a test key and a test-mode teammate to send the samples to the API twice:
It passes only when the first send is all accepted and the second all duplicate. The kit refuses a live key, so a conformance run never writes to a real teammate’s history. Use a fresh test teammate (or the sandbox) for each run, since a second run on the same teammate is all duplicate from the start.

Sending the mapped events

Once the kit passes, your own code moves the records: read a record from your source, map it with the adapter, and send the events it returns for the teammate the record belongs to.
1

Map one record

Call toEvents on your adapter with one record of your source. The morning_summary sample above becomes one observation per reading, each with its own record id and the adapter named in context.adapter. An adapter leaves teammate out of each event.
2

Send the events for the teammate

Send them to POST /v1/teammates/{external_id}/events with your organization key, which needs events:write. The request on this page sends the first two readings of the sample for member-1042.
3

Read the results

Each event gets its own result. A first send answers accepted; sending the same record again answers duplicate, because the record ids are stable.

Worked example: the TechnicallyFit app

TechnicallyFit’s own app is the reference adapter. It proves the path without a device: sets the teammate logged, and pain reports.
A pain report becomes:
Soreness is not mapped in this version: the app records it per muscle, and observations are per joint.