Dianel555/DSkills / skills/literature-searcher
literature-searcher
VerifiedSearch CrossRef, OpenAlex, PubMed, Semantic Scholar, and optional Scopus; deduplicate results, download open-access PDFs by DOI, classify papers, monitor new results, and analyze coverage. Use when asked to search literature, monitor a topic, download an open-access paper, classify papers, or analyze literature gaps.
| File | Kind | Size |
|---|---|---|
| .env.example | other | 743 B |
| README.md | markdown | 3.7 KB |
| SKILL.md | skill md | 2.9 KB |
| literature_searcher/__init__.py | script | 3.1 KB |
| literature_searcher/classifier.py | script | 11.2 KB |
| literature_searcher/crossref_searcher.py | script | 2.8 KB |
| literature_searcher/downloader.py | script | 5.3 KB |
| literature_searcher/insight.py | script | 6.0 KB |
| literature_searcher/monitor.py | script | 14.3 KB |
| literature_searcher/openalex_searcher.py | script | 3.0 KB |
| literature_searcher/pubmed_searcher.py | script | 6.1 KB |
| literature_searcher/scopus_searcher.py | script | 2.1 KB |
| literature_searcher/searcher.py | script | 3.4 KB |
| literature_searcher/semantic_scholar_searcher.py | script | 3.7 KB |
| monitor_config.json.template | other | 443 B |
| tests/test_literature_searcher.py | script | 9.7 KB |
| tests/test_retry_budget.py | script | 898 B |
literature_searcher/__init__.py
View on GitHub"""Shared types and configuration for the literature searcher package."""
from __future__ import annotations
import os
import random
import re
from dataclasses import dataclass, field
from pathlib import Path
from typing import Dict, List, Optional
SKILL_DIR = Path(__file__).resolve().parent.parent
SKILL_DATA_DIR = SKILL_DIR / "data"
def _load_dotenv(path: Path) -> None:
"""Load simple KEY=VALUE entries without overriding the process environment."""
try:
lines = path.read_text(encoding="utf-8").splitlines()
except OSError:
return
for raw_line in lines:
line = raw_line.strip()
if not line or line.startswith("#") or "=" not in line:
continue
key, value = line.split("=", 1)
key = key.strip()
if not re.fullmatch(r"[A-Za-z_][A-Za-z0-9_]*", key):
continue
value = value.strip()
if len(value) >= 2 and value[0] == value[-1] and value[0] in {"'", '"'}:
value = value[1:-1]
os.environ.setdefault(key, value)
_load_dotenv(SKILL_DIR / ".env")
CROSSREF_API = "https://api.crossref.org"
OPENALEX_API = "https://api.openalex.org"
SCOPUS_API = "https://api.elsevier.com/content/search/scopus"
SEMANTIC_SCHOLAR_API = "https://api.semanticscholar.org/graph/v1"
UNPAYWALL_URL = "https://api.unpaywall.org/v2"
USER_AGENT = "LiteratureSearcher/1.0"
UVX_FALLBACK_CMD = ["uvx", "scihub-cli"]
LITERATURE_EMAIL = os.getenv("LITERATURE_EMAIL", "")
OPENALEX_EMAIL = os.getenv("OPENALEX_EMAIL", "")
OPENALEX_API_KEY = os.getenv("OPENALEX_API_KEY", "")
SEMANTIC_SCHOLAR_API_KEY = os.getenv("SEMANTIC_SCHOLAR_API_KEY", "")
ELSEVIER_API_KEY = os.getenv("ELSEVIER_API_KEY", "")
SCOPUS_API_KEY = os.getenv("SCOPUS_API_KEY", "")
@dataclass
class Paper:
title: str
abstract: str = ""
authors: List[str] = field(default_factory=list)
doi: str = ""
year: Optional[int] = None
citations: int = 0
journal: str = ""
source_platform: str = ""
url: str = ""
is_oa: bool = False
pdf_url: str = ""
issn: Optional[str] = None
def generate_random_email() -> str:
return f"literature-searcher-{random.randint(100000, 999999)}@example.com"
def safe_int(value: str) -> int:
try:
return int(value)
except (TypeError, ValueError):
return 0
def reconstruct_abstract(inverted_index: Optional[Dict[str, List[int]]]) -> str:
if not inverted_index:
return ""
positions = {
position: word
for word, word_positions in inverted_index.items()
for position in word_positions
}
return " ".join(positions[position] for position in sorted(positions))
def safe_filename(value: str, fallback: str) -> str:
cleaned = re.sub(r'[<>:"/\\|?*]+', "_", value).strip("._ ")
return cleaned[:120] or fallback
def unique_path(path: Path) -> Path:
if not path.exists():
return path
for index in range(1, 10_000):
candidate = path.with_name(f"{path.stem}_{index}{path.suffix}")
if not candidate.exists():
return candidate
raise RuntimeError(f"Could not create a unique path for {path}")
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |