{"slug": "deduplicating-event-feeds-name-and-start-time-are-not-an-event-id", "title": "Deduplicating event feeds: name and start time are not an event ID", "summary": "A developer building the 3BetLab tournament finder outlined an ingestion pattern for deduplicating event feeds that relies on a provider's occurrence ID scoped to its namespace rather than a title-and-start-time key, since a rescheduled event would otherwise appear as new. The approach uses a separate monotonically increasing revision to order updates via a conditional upsert, retains cancellation states instead of deleting rows, and flags same-revision conflicts, with the developer warning that normalized titles and time windows should only suggest matches, not merge them automatically.", "body_md": "*Disclosure: The draft and sample SQL were generated with AI.*\n\nA calendar lists “Daily Turbo” at 18:00. An hour later the provider shifts it to 18:20. If your key is `(title, start_time)`, the update looks like a new event. If you drop the time from the key, tomorrow’s “Daily Turbo” may overwrite today’s.\n\nA reliable identifier is the provider’s occurrence ID, scoped to the namespace where it is unique. A recurring-series ID identifies a template, not one running of the tournament. If the provider has no reliable occurrence ID, don’t silently pretend a name and a clock time can supply one.\n\nUse a separate revision to decide whether an update is newer. Receipt time tells you when you saw a message, not whether it supersedes another one. If the provider documents a monotonically increasing revision per occurrence, an upsert can enforce that ordering:\n\n```\nINSERT INTO event_occurrence\n  (source_namespace, source_occurrence_id, revision, title, starts_at, state)\nVALUES\n  ($1, $2, $3, $4, $5, $6)\nON CONFLICT (source_namespace, source_occurrence_id)\nDO UPDATE SET\n  revision = EXCLUDED.revision,\n  title = EXCLUDED.title,\n  starts_at = EXCLUDED.starts_at,\n  state = EXCLUDED.state\nWHERE EXCLUDED.revision > event_occurrence.revision;\n```\n\nImport revision 12 twice and you still have one row. Import revision 11 after 12 and a reschedule cannot roll back. If revision 13 cancels the event, retain that cancellation state instead of deleting the row: otherwise, a late revision 12 could insert the event again. If two messages carry the same revision but different content, flag the conflict.\n\nA public calendar and a live lobby may use different IDs for the same occurrence. Store both identities and map them to a canonical listing only when you have an explicit cross-reference or have verified the match. A normalized title and a narrow time window can suggest a candidate, but shouldn’t merge it automatically.\n\nTest a duplicate, a late older revision, a moved start time, two distinct events with the same title and time, and a cancellation followed by a retry. Also check that a partial page doesn’t cancel an event simply by omitting it.\n\nI develop the [3BetLab tournament finder](https://3betlab.com/tools/en/tournaments-now/), where tournament cards link back to published sources. The SQL illustrates an ingestion pattern, not the production schema.", "url": "https://wpnews.pro/news/deduplicating-event-feeds-name-and-start-time-are-not-an-event-id", "canonical_source": "https://dev.to/3betlab/deduplicating-event-feeds-name-and-start-time-are-not-an-event-id-587h", "published_at": "2026-12-03 08:40:54+00:00", "updated_at": "2026-12-03 08:47:07.429759+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["3BetLab"], "also_reported_by": [], "takeaway": "Key event deduplication on the provider's occurrence ID scoped to its namespace and order updates with a conditional upsert on a monotonic revision, retaining cancellation states so late older revisions cannot resurrect or roll back an event.", "recommendation": {"advice": "Key event feeds on provider occurrence IDs and guard upserts with a revision comparison, then test duplicates, late older revisions, moved start times, same-title collisions and cancellation retries.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/deduplicating-event-feeds-name-and-start-time-are-not-an-event-id", "markdown": "https://wpnews.pro/news/deduplicating-event-feeds-name-and-start-time-are-not-an-event-id.md", "text": "https://wpnews.pro/news/deduplicating-event-feeds-name-and-start-time-are-not-an-event-id.txt", "jsonld": "https://wpnews.pro/news/deduplicating-event-feeds-name-and-start-time-are-not-an-event-id.jsonld"}}