abstract_fallback
zocrates.discovery.abstract_fallback ¶
Opportunistic 3-tier abstract backfill cascade for scholarly candidates.
NCBI_EFETCH_URL
module-attribute
¶
NCBI_ESEARCH_URL
module-attribute
¶
SEMANTIC_SCHOLAR_URL
module-attribute
¶
AbstractFallback ¶
Manages 3-tier opportunistic fallback for paper abstracts
- Tier 1: Direct OpenAlex abstract (present in CandidatePaper).
- Tier 2: Semantic Scholar REST API (and NCBI PubMed E-utilities for biomedical papers) with 2.0s timeout.
- Tier 3: Clean fallback to OpenAlex keywords and primary topic.
Initialize the abstract fallback resolver.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email
|
str
|
Contact email used for respectful API polite-pool headers. |
DEFAULT_POLITE_EMAIL
|
timeout
|
float
|
HTTP request timeout in seconds. |
2.0
|
Source code in zocrates/discovery/abstract_fallback.py
backfill_abstract
async
¶
Backfill missing abstract and TLDR on a candidate paper using opportunistic fallbacks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidate
|
CandidatePaper
|
CandidatePaper instance. |
required |
Returns:
| Type | Description |
|---|---|
CandidatePaper
|
CandidatePaper with abstract/tldr backfilled if resolved. |
Source code in zocrates/discovery/abstract_fallback.py
backfill_batch
async
¶
Backfill missing abstracts concurrently across a batch of candidates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidates
|
list[CandidatePaper]
|
List of CandidatePaper instances. |
required |
Returns:
| Type | Description |
|---|---|
list[CandidatePaper]
|
List of updated CandidatePaper instances. |
Source code in zocrates/discovery/abstract_fallback.py
CandidatePaper
dataclass
¶
CandidatePaper(candidate_id, title, authors=list(), year=None, venue=None, doi=None, arxiv_id=None, openalex_id='', abstract=None, tldr=None, is_oa=False, oa_pdf_url=None, oa_pdf_urls=list(), citation_count=0, primary_topic=None, keywords=list(), in_library=False)
Represents a discovered scholarly paper candidate.
from_dict
classmethod
¶
Deserialize CandidatePaper from a dictionary.
Source code in zocrates/discovery/models.py
to_dict ¶
Serialize CandidatePaper to a plain dictionary.
Source code in zocrates/discovery/models.py
make_user_agent ¶
Build a respectful User-Agent header string adhering to API etiquette.
Source code in zocrates/discovery/providers/base.py
normalize_arxiv_id ¶
Normalize an arXiv identifier by stripping URL prefixes, 'arxiv:' tags, and version suffixes.
Source code in zocrates/rag/zotero_db.py
normalize_doi ¶
Normalize DOI by stripping standard URI and resolver prefixes and lowercasing.