$npx -y skills add LeonChaoX/qinyan-academic-skills --skill openalex-databaseQuery and analyze scholarly literature using the OpenAlex database. This skill should be used when searching for academic papers, analyzing research trends, finding works by authors or institutions, tracking citations, discovering open access publications, or conducting bibliomet
| 1 | # OpenAlex Database |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | OpenAlex is a comprehensive open catalog of 240M+ scholarly works, authors, institutions, topics, sources, publishers, and funders. This skill provides tools and workflows for querying the OpenAlex API to search literature, analyze research output, track citations, and conduct bibliometric studies. |
| 6 | |
| 7 | ## Quick Start |
| 8 | |
| 9 | ### Basic Setup |
| 10 | |
| 11 | Always initialize the client with an email address to access the polite pool (10x rate limit boost): |
| 12 | |
| 13 | ```python |
| 14 | from scripts.openalex_client import OpenAlexClient |
| 15 | |
| 16 | client = OpenAlexClient(email="your-email@example.edu") |
| 17 | ``` |
| 18 | |
| 19 | ### Installation Requirements |
| 20 | |
| 21 | Install required package using uv: |
| 22 | |
| 23 | ```bash |
| 24 | uv pip install requests |
| 25 | ``` |
| 26 | |
| 27 | No API key required - OpenAlex is completely open. |
| 28 | |
| 29 | ## Core Capabilities |
| 30 | |
| 31 | ### 1. Search for Papers |
| 32 | |
| 33 | **Use for**: Finding papers by title, abstract, or topic |
| 34 | |
| 35 | ```python |
| 36 | # Simple search |
| 37 | results = client.search_works( |
| 38 | search="machine learning", |
| 39 | per_page=100 |
| 40 | ) |
| 41 | |
| 42 | # Search with filters |
| 43 | results = client.search_works( |
| 44 | search="CRISPR gene editing", |
| 45 | filter_params={ |
| 46 | "publication_year": ">2020", |
| 47 | "is_oa": "true" |
| 48 | }, |
| 49 | sort="cited_by_count:desc" |
| 50 | ) |
| 51 | ``` |
| 52 | |
| 53 | ### 2. Find Works by Author |
| 54 | |
| 55 | **Use for**: Getting all publications by a specific researcher |
| 56 | |
| 57 | Use the two-step pattern (entity name → ID → works): |
| 58 | |
| 59 | ```python |
| 60 | from scripts.query_helpers import find_author_works |
| 61 | |
| 62 | works = find_author_works( |
| 63 | author_name="Jennifer Doudna", |
| 64 | client=client, |
| 65 | limit=100 |
| 66 | ) |
| 67 | ``` |
| 68 | |
| 69 | **Manual two-step approach**: |
| 70 | ```python |
| 71 | # Step 1: Get author ID |
| 72 | author_response = client._make_request( |
| 73 | '/authors', |
| 74 | params={'search': 'Jennifer Doudna', 'per-page': 1} |
| 75 | ) |
| 76 | author_id = author_response['results'][0]['id'].split('/')[-1] |
| 77 | |
| 78 | # Step 2: Get works |
| 79 | works = client.search_works( |
| 80 | filter_params={"authorships.author.id": author_id} |
| 81 | ) |
| 82 | ``` |
| 83 | |
| 84 | ### 3. Find Works from Institution |
| 85 | |
| 86 | **Use for**: Analyzing research output from universities or organizations |
| 87 | |
| 88 | ```python |
| 89 | from scripts.query_helpers import find_institution_works |
| 90 | |
| 91 | works = find_institution_works( |
| 92 | institution_name="Stanford University", |
| 93 | client=client, |
| 94 | limit=200 |
| 95 | ) |
| 96 | ``` |
| 97 | |
| 98 | ### 4. Highly Cited Papers |
| 99 | |
| 100 | **Use for**: Finding influential papers in a field |
| 101 | |
| 102 | ```python |
| 103 | from scripts.query_helpers import find_highly_cited_recent_papers |
| 104 | |
| 105 | papers = find_highly_cited_recent_papers( |
| 106 | topic="quantum computing", |
| 107 | years=">2020", |
| 108 | client=client, |
| 109 | limit=100 |
| 110 | ) |
| 111 | ``` |
| 112 | |
| 113 | ### 5. Open Access Papers |
| 114 | |
| 115 | **Use for**: Finding freely available research |
| 116 | |
| 117 | ```python |
| 118 | from scripts.query_helpers import get_open_access_papers |
| 119 | |
| 120 | papers = get_open_access_papers( |
| 121 | search_term="climate change", |
| 122 | client=client, |
| 123 | oa_status="any", # or "gold", "green", "hybrid", "bronze" |
| 124 | limit=200 |
| 125 | ) |
| 126 | ``` |
| 127 | |
| 128 | ### 6. Publication Trends Analysis |
| 129 | |
| 130 | **Use for**: Tracking research output over time |
| 131 | |
| 132 | ```python |
| 133 | from scripts.query_helpers import get_publication_trends |
| 134 | |
| 135 | trends = get_publication_trends( |
| 136 | search_term="artificial intelligence", |
| 137 | filter_params={"is_oa": "true"}, |
| 138 | client=client |
| 139 | ) |
| 140 | |
| 141 | # Sort and display |
| 142 | for trend in sorted(trends, key=lambda x: x['key'])[-10:]: |
| 143 | print(f"{trend['key']}: {trend['count']} publications") |
| 144 | ``` |
| 145 | |
| 146 | ### 7. Research Output Analysis |
| 147 | |
| 148 | **Use for**: Comprehensive analysis of author or institution research |
| 149 | |
| 150 | ```python |
| 151 | from scripts.query_helpers import analyze_research_output |
| 152 | |
| 153 | analysis = analyze_research_output( |
| 154 | entity_type='institution', # or 'author' |
| 155 | entity_name='MIT', |
| 156 | client=client, |
| 157 | years='>2020' |
| 158 | ) |
| 159 | |
| 160 | print(f"Total works: {analysis['total_works']}") |
| 161 | print(f"Open access: {analysis['open_access_percentage']}%") |
| 162 | print(f"Top topics: {analysis['top_topics'][:5]}") |
| 163 | ``` |
| 164 | |
| 165 | ### 8. Batch Lookups |
| 166 | |
| 167 | **Use for**: Getting information for multiple DOIs, ORCIDs, or IDs efficiently |
| 168 | |
| 169 | ```python |
| 170 | dois = [ |
| 171 | "https://doi.org/10.1038/s41586-021-03819-2", |
| 172 | "https://doi.org/10.1126/science.abc1234", |
| 173 | # ... up to 50 DOIs |
| 174 | ] |
| 175 | |
| 176 | works = client.batch_lookup( |
| 177 | entity_type='works', |
| 178 | ids=dois, |
| 179 | id_field='doi' |
| 180 | ) |
| 181 | ``` |
| 182 | |
| 183 | ### 9. Random Sampling |
| 184 | |
| 185 | **Use for**: Getting representative samples for analysis |
| 186 | |
| 187 | ```python |
| 188 | # Small sample |
| 189 | works = client.sample_works( |
| 190 | sample_size=100, |
| 191 | seed=42, # For reproducibility |
| 192 | filter_params={"publication_year": "2023"} |
| 193 | ) |
| 194 | |
| 195 | # Large sample (>10k) - automatically handles multiple requests |
| 196 | works = client.sample_works( |
| 197 | sample_size=25000, |
| 198 | seed=42, |
| 199 | filter_params={"is_oa": "true"} |
| 200 | ) |
| 201 | ``` |
| 202 | |
| 203 | ### 10. Citation Analysis |
| 204 | |
| 205 | **Use for**: Finding papers that ci |