Build structured datasets from academic papers...
Build datasets by extracting structured data from academic papers and traversing citation graphs.
Use this skill when the user wants to:
[!IMPORTANT] Use subagents for PDF download, relevance checking, data extraction, and citation traversal to keep the main context clean.
From user's description, generate project assets. User should provide:
Create project directory with these files:
projects/<project_name>/
āāā prompt.txt # Data extraction instructions
āāā relevance_prompt.txt # Relevance criteria for papers
āāā search_query.txt # OpenAlex search terms
āāā bfs_queue.json # BFS queue state (see assets)
āāā pdfs/ # Downloaded PDFs
āāā data/ # Extracted JSON files
Generate assets by creating:
prompt.txt: Detailed instructions for extracting data from PDFs
relevance_prompt.txt: Criteria for filtering papers
{title} and {abstract} placeholderssearch_query.txt: OpenAlex search query
Search OpenAlex to populate the BFS queue:
GET https://api.openalex.org/works?search=<query>&per-page=25&mailto=email
Extract OpenAlex IDs (e.g., W2741809807) from results and add to bfs_queue.json.
Options:
curl -LsSf https://astral.sh/uv/install.sh | sh) and use Python directlySee bfs_queue.py for queue implementation reference.
Pop paper ID from queue and process with subagents:
Download PDF for OpenAlex ID: <id>
Save to: projects/<name>/pdfs/<id>.pdf
Return: success/failure
If failed ā mark as failed: no_pdf in queue, continue to next paper from queue.
Given title and abstract from OpenAlex metadata,
evaluate using: [relevance_prompt.txt]
Return: {is_relevant: bool, reason: string}
If not relevant ā mark as skipped: <reason> in queue, continue to next paper from queue.
Read PDF: projects/<name>/pdfs/<id>.pdf
Extract data following: [prompt.txt]
Return: structured JSON
Save result to projects/<name>/data/<id>.json.
For OpenAlex ID: <id>
Fetch: referenced_works, related_works, citing works
Return: list of new paper IDs
Add new IDs to queue (skip already processed/skipped/failed).
Mark current paper as processed.
Repeat Step 3 until:
Use bfs_queue.json for stop/resume:
{
"queue": ["W123", "W456"],
"processed": ["W789"],
"skipped": {"W111": "review article, no experimental data"},
"failed": {"W222": "pdf not available"}
}