Add Semantic Scholar article enrichment, citation graph, and recommendations#223
Merged
Add Semantic Scholar article enrichment, citation graph, and recommendations#223
Conversation
S2 API uses `citedPaper.*` field prefix in the /references endpoint, but the implementation used the wrong `referencedPaper.*` prefix, causing HTTP 400 errors on all article references requests. Fixed both the field constants string and the serde rename on the struct field.
This heading has repeated live-network timeout history in GitHub Actions (60s budget). Per the existing Makefile smoke-lane policy, move it to the deselect list so provider latency does not block unrelated PRs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
S2_API_KEYenvironment variableget articleoutput includes aSemantic Scholarsection with TLDR, influential citation count, reference count, and open-access PDF metadataarticlesubcommands:citations,references, andrecommendations— all requireS2_API_KEYand exit with a clear error when absentarticle recommendations <id1> <id2> --negative <id3>get articleworks fully without the key; S2 section is simply omitteddocs/reference/data-sources.md,docs/getting-started/api-keys.md, andRUN.mdexplain the optional key and what it unlocksscripts/contract-smoke.shprobes S2 when key is present; skips cleanly when absentChanges
New source client:
src/sources/semantic_scholar.rs— typed API client for citations, references, recommendations, and paper detail endpoints with 1 req/sec rate limit.Article enrichment:
src/entities/article.rs—get articleenriches the result with asemantic_scholarblock whenS2_API_KEYis set; silently skips otherwise.New CLI commands:
src/cli/mod.rs—article citations,article references,article recommendationsas explicit S2-only navigation commands.Rendering:
src/render/markdown.rs— citation/reference/recommendation tables with context snippets, intents, and influential flag.Docs and smoke:
RUN.md,docs/reference/data-sources.md,docs/getting-started/api-keys.md,scripts/contract-smoke.sh, and spec coverage for all new S2 paths.Behavior without S2_API_KEY
Test plan
make check(clippy + fmt) passescargo test— 647 unit tests passmake test-contracts— contract tests passspec/06-article.mdspec — 16/16 pass including new S2 testsget article <pmid> tldrshows Semantic Scholar section with key presentarticle citations <pmid> --limit 3returns citation table with contextsarticle references <pmid> --limit 3returns reference tablearticle recommendations <pmid> --limit 3returns recommendations