Skip to content

Data loader: Deduplicate kind 0 profiles by pubkey when loading from DynamoDB#73

Merged
alejandro-runner merged 2 commits intomainfrom
fix/69-data-loader-dedup-kind0
Feb 3, 2026
Merged

Data loader: Deduplicate kind 0 profiles by pubkey when loading from DynamoDB#73
alejandro-runner merged 2 commits intomainfrom
fix/69-data-loader-dedup-kind0

Conversation

@alejandro-runner
Copy link
Member

Summary

Even after the Lambda fix (#68), DynamoDB may still contain legacy duplicate kind 0 rows. The MCP server should only expose one profile per pubkey so search_food_establishments does not return duplicate establishments (same @id).

Changes

  • In loadProfileDataFromDynamoDB, after filtering for food-establishment profiles, deduplicate by pubkey: keep only the event with the largest created_at per pubkey.
  • Extracted deduplicateKind0ByPubkey(events) and exported it for testing.
  • Added src/data-loader-dedup.test.ts with 3 unit tests (latest per pubkey, one per distinct pubkey, empty input).

Closes #69

- After filtering food establishment profiles, deduplicate by pubkey
  keeping the event with the latest created_at (replaceable per NIP-01)
- Export deduplicateKind0ByPubkey() for testing; add unit tests

Closes #69

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel
Copy link

vercel bot commented Feb 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mcp-server Ready Ready Preview, Comment Feb 3, 2026 10:05pm

…t TS

Co-authored-by: Cursor <cursoragent@cursor.com>
@alejandro-runner alejandro-runner merged commit 4580ef6 into main Feb 3, 2026
5 checks passed
@alejandro-runner alejandro-runner deleted the fix/69-data-loader-dedup-kind0 branch February 3, 2026 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data loader: Deduplicate kind 0 profiles by pubkey when loading from DynamoDB

1 participant