DS = 'Lilambd/world-science' REVISION = 'hf-main@2026-11-03 (OpenAlex snapshot 2026-10-14)' LICENSE = 'CC0 1.0' SH = 'World Science dataset (OpenAlex counts)' STR = {'papers_by_country_year.csv': ['country_code'], 'countries.csv': ['country_code'], 'rising_subfield_country_2025.csv': ['country_code']} KEYS = {'papers_by_country_year.csv': ['year', 'country_code', 'country'], 'papers_by_field_year.csv': ['year', 'field'], 'rising_subfield_country_2025.csv': ['subfield_id', 'country_code'], 'subfields.csv': ['subfield_id', 'subfield'], 'countries.csv': ['country_code', 'country']} COL = {'papers': 'how many papers', 'preprints': 'how many preprints', 'datasets': 'how many dataset records', 'papers_oa': 'how many open-access papers', 'citations_of_papers': 'how many citations to its papers'} def build(B): s = B.store p = s['papers_by_country_year.csv'] pr = p[(p.year >= 1990) & p.papers.notna() & (p.papers > 50)] for r in pr.loc[B.sample(pr.index, 70)].itertuples(): col = B.rng.choice(['papers', 'papers', 'papers_oa', 'preprints', 'citations_of_papers']) if getattr(r, col) != getattr(r, col): # NaN continue B.add('lookup', f'In the {SH}, {COL[col]} are counted for {r.country} in {r.year}?', {'op': 'lookup', 'file': 'papers_by_country_year.csv', 'where': [['country_code', '==', r.country_code], ['year', '==', int(r.year)]], 'col': col}, tol={'rel': 0.001}, skills=['table_lookup', 'temporal']) for _ in range(25): yr = B.rng.randint(1950, 2025) cont = B.rng.choice(sorted(p.continent.dropna().unique())) B.add('rank', f'In the {SH}, which country in {cont} had the most papers in {yr}?', {'op': 'argmax', 'file': 'papers_by_country_year.csv', 'where': [['year', '==', yr], ['continent', '==', cont]], 'col': 'papers', 'return': 'country'}, difficulty=2, skills=['ranking', 'group_filter']) for yr in B.sample(range(1980, 2026), 10): B.add('rank', f'In the {SH}, list the top 3 countries by number of papers in {yr}, most first.', {'op': 'topk', 'k': 3, 'file': 'papers_by_country_year.csv', 'where': [['year', '==', yr]], 'col': 'papers', 'return': 'country'}, difficulty=2, skills=['ranking'], answer_format='JSON list of country names') big = sorted(p[(p.year == 2024) & (p.papers > 5000)].country_code) for cc in B.sample(big, 22): y1 = B.rng.randint(2000, 2014) y2 = B.rng.randint(2015, 2024) nm = p[p.country_code == cc].country.iloc[0] B.add('temporal', f'In the {SH}, by what factor did the paper count of {nm} grow from {y1} to {y2} (papers {y2} divided by papers {y1})?', {'op': 'ratio', 'parts': [ {'op': 'lookup', 'file': 'papers_by_country_year.csv', 'where': [['country_code', '==', cc], ['year', '==', y2]], 'col': 'papers'}, {'op': 'lookup', 'file': 'papers_by_country_year.csv', 'where': [['country_code', '==', cc], ['year', '==', y1]], 'col': 'papers'}]}, tol={'rel': 0.01}, difficulty=2, skills=['arithmetic', 'temporal']) B.add('derived', f'In the {SH}, what share of the papers counted for {nm} in {y2} were open access (papers_oa / papers)?', {'op': 'ratio', 'parts': [ {'op': 'lookup', 'file': 'papers_by_country_year.csv', 'where': [['country_code', '==', cc], ['year', '==', y2]], 'col': 'papers_oa'}, {'op': 'lookup', 'file': 'papers_by_country_year.csv', 'where': [['country_code', '==', cc], ['year', '==', y2]], 'col': 'papers'}]}, tol={'rel': 0.01}, difficulty=2, skills=['arithmetic']) for _ in range(18): a, b = B.sample(big, 2) yr = B.rng.randint(2000, 2024) na, nb = (p[p.country_code == x].country.iloc[0] for x in (a, b)) B.add('compare', f'In the {SH}, which country had more papers in {yr}: {na} or {nb}?', {'op': 'compare', 'labels': [na, nb], 'parts': [ {'op': 'lookup', 'file': 'papers_by_country_year.csv', 'where': [['country_code', '==', a], ['year', '==', yr]], 'col': 'papers'}, {'op': 'lookup', 'file': 'papers_by_country_year.csv', 'where': [['country_code', '==', b], ['year', '==', yr]], 'col': 'papers'}]}, difficulty=2, skills=['comparison']) for cc in B.sample(big, 12): nm = p[p.country_code == cc].country.iloc[0] B.add('aggregate', f'In the {SH}, how many papers in total are counted for {nm} over the years 2020 to 2024?', {'op': 'sum', 'file': 'papers_by_country_year.csv', 'where': [['country_code', '==', cc], ['year', '>=', 2020], ['year', '<=', 2024]], 'col': 'papers'}, tol={'rel': 0.001}, difficulty=2, skills=['aggregation', 'temporal']) for yr in B.sample(range(2000, 2025), 8): B.add('count', f'In the {SH}, how many countries had more than 10,000 papers in {yr}?', {'op': 'count', 'file': 'papers_by_country_year.csv', 'where': [['year', '==', yr], ['papers', '>', 10000]]}, difficulty=2, skills=['filter', 'count']) for cc in B.sample(big, 10): nm = p[p.country_code == cc].country.iloc[0] yr = B.rng.choice([2027, 2028, 2030]) B.add('unanswerable', f'In the {SH}, how many papers are counted for {nm} in {yr}? If the dataset has no such year, answer null.', {'op': 'absent', 'file': 'papers_by_country_year.csv', 'where': [['country_code', '==', cc], ['year', '==', yr]]}, skills=['abstention', 'temporal']) f = s['papers_by_field_year.csv'] for r in f[f.year >= 1950].pipe(lambda d: d.loc[B.sample(d.index, 30)]).itertuples(): B.add('lookup', f'In the {SH}, how many papers in the field "{r.field}" are counted for {r.year}?', {'op': 'lookup', 'file': 'papers_by_field_year.csv', 'where': [['field', '==', r.field], ['year', '==', int(r.year)]], 'col': 'papers'}, tol={'rel': 0.001}, skills=['table_lookup']) for yr in B.sample(range(1950, 2026), 12): B.add('rank', f'In the {SH}, which field had the most papers in {yr}?', {'op': 'argmax', 'file': 'papers_by_field_year.csv', 'where': [['year', '==', yr]], 'col': 'papers', 'return': 'field'}, difficulty=2, skills=['ranking']) dom = B.rng.choice(sorted(f.domain.dropna().unique())) B.add('aggregate', f'In the {SH}, how many papers in total are counted for all fields of the domain "{dom}" in {yr}?', {'op': 'sum', 'file': 'papers_by_field_year.csv', 'where': [['year', '==', yr], ['domain', '==', dom]], 'col': 'papers'}, tol={'rel': 0.001}, difficulty=2, skills=['aggregation']) rs = s['rising_subfield_country_2025.csv'] for r in rs.loc[B.sample(rs.index, 25)].itertuples(): col = B.rng.choice(['papers_2025', 'index_2025_vs_base100']) t = (f'In the {SH} rising-subfield table, how many 2025 papers in "{r.subfield}" are counted for {r.country}?' if col == 'papers_2025' else f'In the {SH} rising-subfield table, what is the 2025 index (2020-2024 mean = 100) of "{r.subfield}" in {r.country}?') B.add('lookup', t, {'op': 'lookup', 'file': 'rising_subfield_country_2025.csv', 'where': [['subfield_id', '==', int(r.subfield_id)], ['country_code', '==', r.country_code]], 'col': col}, tol={'rel': 0.005}, skills=['table_lookup']) cc_r = rs.groupby('country').size() for c in B.sample(cc_r[cc_r >= 10].index, 15): B.add('rank', f'In the {SH} rising-subfield table, which subfield has the highest 2025 index (vs 2020-2024 = 100) for {c}?', {'op': 'argmax', 'file': 'rising_subfield_country_2025.csv', 'where': [['country', '==', c]], 'col': 'index_2025_vs_base100', 'return': 'subfield'}, difficulty=2, skills=['ranking', 'group_filter']) sf = s['subfields.csv'] for r in sf.loc[B.sample(sf.index, 15)].itertuples(): B.add('lookup', f'In the {SH} taxonomy, which field does the subfield "{r.subfield}" belong to?', {'op': 'lookup', 'file': 'subfields.csv', 'where': [['subfield_id', '==', int(r.subfield_id)]], 'col': 'field'}, skills=['taxonomy']) for fld in B.sample(sorted(sf.field.unique()), 10): B.add('count', f'In the {SH} taxonomy, how many subfields does the field "{fld}" have?', {'op': 'count', 'file': 'subfields.csv', 'where': [['field', '==', fld]]}, skills=['taxonomy', 'count']) co = s['countries.csv'] for r in co.loc[B.sample(co.index, 8)].itertuples(): B.add('lookup', f'In the {SH} country list, is {r.country} flagged as Global South (true/false)?', {'op': 'lookup', 'file': 'countries.csv', 'where': [['country_code', '==', r.country_code]], 'col': 'is_global_south'}, skills=['table_lookup']) for r in sf.loc[B.sample(sf.index, 10)].itertuples(): B.add('multi_hop', f'In the {SH}, how many 2025 papers in the subfield with id {r.subfield_id} are counted for the country with the most such papers? (Use rising_subfield_country_2025.)', {'op': 'max', 'file': 'rising_subfield_country_2025.csv', 'where': [['subfield_id', '==', int(r.subfield_id)]], 'col': 'papers_2025'}, tol={'abs': 0}, difficulty=3, skills=['id_lookup', 'aggregation'])