Skip to content

Source ID & Revisions

Source IDs are deterministic hashes generated by Nexus:

source_id = sha256_hex(event_type + ":" + provider + ":" + provider_native_id)
  • Idempotent — Same input always produces the same ID. Safe for re-fetch and replay.
  • Collision-free — Scoped by event type and provider.
  • Opaque — Does not leak provider internals to consumers.

The raw provider ID is always preserved in provider_ref for debugging and provider API lookups.

For a Fitbit activity with provider ID "12345":

sha256_hex("activity:fitbit:12345")
// → "a1b2c3d4e5f6..."

The revision field on data items signals whether a delivery is a first observation or a correction:

revisionMeaning
1First delivery of this data point.
2+Provider retroactively corrected or updated the data. Consumers should upsert by source_id.

Nexus determines revisions by comparing the incoming normalized payload against the previously stored version for the same source_id. If the payload differs, revision increments.

During replay or backfill:

  • The source_id remains the same (deterministic from the same underlying data).
  • The event_id on the envelope is new (unique per emission).
  • The sources array is empty [] (no notification triggered the event).
  • Consumers should use source_id + revision for deduplication, not event_id.