Skip to content

WP-2.2: merge discovered works (DOI, PMCID, title+year), newest first - #92

Merged
APReddy-AutoBotz merged 10 commits into
mainfrom
feat/wp-2.2-discovery-merge
Dec 6, 2026
Merged

APReddy-AutoBotz merged 10 commits into
mainfrom
feat/wp-2.2-discovery-merge

Conversation

@APReddy-AutoBotz

Copy link
Copy Markdown
Owner

WP-2.2 (NR-F03, F04), fixtures only. Branched from main.

What

  • discovery/merge.py:
    • merge() keeps each work once, merging by DOI (case-insensitive), then PMCID, then normalised title plus year.
    • Title normalisation: NFKD, markup stripped, punctuation folded. A title needs at least 24 characters after normalisation, so "Editorial" or "Reply to…" never merge on title.
    • Records with different DOIs or PMCIDs never merge. A transitive join that would put two DOIs in one group is refused.
    • newest_first() orders works newest first inside the year range (stable within a year). Works outside the range, and undated ones when a range is set, are returned as excluded rather than dropped silently.
  • OpenAccessOrchestrator._discover_all now uses merge + newest_first. Before, it merged on shared DOI/PMCID in source order.

Tests

  • test_discovery_merge.py: 6 passed. A 9-record, three-source overlapping fixture yields 5 works ordered by date. Also covers conflicting identifiers, the refused transitive join, the range and undated handling, and title normalisation.
  • Container run with test_openaccess_multisource.py, test_openaccess_orchestrator.py, test_review_regressions.py and test_europepmc_live.py: 112 passed.
  • mypy strict clean (548 files); ruff clean; validate_docs PASS.
  • Full backend suite not run locally; CI runs it.

Not in this PR

  • The durable job path (discovery/service.py, fixture-only).
  • New sources.
  • No live traffic was used.

🤖 Generated with Claude Code

APReddy-AutoBotz and others added 10 commits December 5, 2026 23:50
… first

Records with different DOIs or PMCIDs never merge, also transitively. Short
titles never merge on title. All-sources discovery uses the merge and orders
works newest first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-merge

# Conflicts:
#	CHANGELOG.md
#	docs/22-implementation-status.md
…-merge

# Conflicts:
#	CHANGELOG.md
#	docs/22-implementation-status.md
…-merge

# Conflicts:
#	docs/22-implementation-status.md
…-merge

# Conflicts:
#	CHANGELOG.md
#	docs/22-implementation-status.md
…-merge

# Conflicts:
#	CHANGELOG.md
#	docs/22-implementation-status.md
…-merge

# Conflicts:
#	CHANGELOG.md
#	docs/22-implementation-status.md
…-merge

# Conflicts:
#	CHANGELOG.md
#	docs/22-implementation-status.md
@APReddy-AutoBotz
APReddy-AutoBotz marked this pull request as ready for review December 6, 2026 07:58
@APReddy-AutoBotz
APReddy-AutoBotz merged commit 120fd4d into main Dec 6, 2026
14 checks passed
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.

1 participant