No way to triage candidates before downloading: a cap keeps whatever the source lists first

Open
#87 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python

Research direction

Start by reading preview.py and expand_papers() in europepmc.py, then trace how each source gathers candidates and how europepmc --pmcid accepts IDs. The acceptance criteria call for writing capped candidate JSONL without downloading full text, offline ranking with recorded scores and model names, and fetching exactly the selected papers while recording their source workspace. This spans search, ranking, and download flows, so first map those entry points and their existing tests.

Written by the indexing model from the issue text.

Description

area:cli area:expansion area:fetch enhancement

Part of lanl/chatty#65.

Keywords become a Boolean title-and-abstract query: keywords are combined with OR, and keyword_groups with OR within a group and AND across groups ("term"[tiab] for PubMed Central). Everything that matches is a candidate, and nothing ranks the candidates:

  • A cap keeps the source's first papers. With --max-papers or max_results, the papers kept are the first ones in the source's default order. text-fetch sets no sort order for PubMed Central or Europe PMC, and sorts arXiv by submission date and ChemRxiv by creation date. A cap of 200 can keep the 200 newest matches rather than the 200 most relevant.
  • Expansion stops in the order it walks. Citation expansion stops at max_expansion in the order it walks the network (expand_papers() in europepmc.py), not by how strongly a paper is linked to the seeds.
  • The dry run shows only a sample. --dry-run --json reports counts and up to 10 sample papers (preview.py), so an agent can't see the candidates to choose among them.

So relevance is judged only after download and indexing, when chatty or LitKit searches the corpus.

Proposal: a candidate list between the search and the download.

  1. List every candidate: --dry-run --candidates candidates.jsonl writes every candidate, up to a stated cap such as 5,000. Each entry has its IDs (PMCID, PMID, DOI), title, abstract, year, journal, publication types and open-access status. Expansion candidates also say how many seeds cite them or are cited by them.
  2. Rank them: --rank-by "a paragraph describing the topic" orders candidates by how similar their title and abstract are to the description. SPECTER2, which LitKit already uses to embed papers, is built for comparing papers. Expansion candidates can also be ranked by how many seeds link to them.
  3. Fetch the chosen ones: --from-candidates chosen.jsonl, or --ids FILE, downloads exactly the chosen papers. europepmc --pmcid already takes IDs given one at a time. This takes a file and works for every source.

An agent can then do what a careful person does: search broadly, read the ranked titles and abstracts, keep what is relevant, and download only that. On a large topic this also saves most of the download and conversion time. The one-command corpus builder proposed in lanl/chatty#80 would use it.

Acceptance criteria:

  • A dry run can write the full candidate list, up to a stated cap, with abstracts and without downloading full text.
  • Ranking works offline once the model is cached. Each candidate's score and the model that produced it are recorded.
  • A fetch from a candidate file downloads exactly those papers and records in the workspace where the selection came from.
Dominant language
Python
Stars
1
Forks
0
Avg merge
1h 1m
Merged PRs (30d)
31

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lanl/text-fetch

All issues in lanl/text-fetch

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.