Datasets:
File size: 7,138 Bytes
7f9a652 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | DS = 'Lilambd/world-ground'
REVISION = 'hf-main@2026-11-03 (data as of 2026-10-04)'
LICENSE = 'CC BY 4.0'
SH = 'World Ground Ledger'
STR = {'data/admin1_ground.csv': ['a1', 'iso_3166_2', 'adm0_a3'], 'data/features_long.csv': ['a1']}
KEYS = {'data/admin1_ground.csv': ['a1', 'name', 'country'], 'data/features_long.csv': ['a1', 'feature']}
COLS = {
'pop_volcano50_2020': ('how many people (GHSL 2020) live within 50 km of an erupting volcano', 'persons', {'rel': 0.01}),
'pop_coast10_2020': ('how many people (GHSL 2020) live within 10 km of the coast', 'persons', {'rel': 0.01}),
'pop_plate100_2020': ('how many people (GHSL 2020) live within 100 km of a plate boundary', 'persons', {'rel': 0.01}),
'coast_km_popw': ('what is the population-weighted distance to the coast, in km', 'km', {'rel': 0.01}),
'plate_km_popw': ('what is the population-weighted distance to a plate boundary, in km', 'km', {'rel': 0.01}),
'built_2025': ('how many km² are built up in 2025', 'km²', {'rel': 0.01}),
'soc_0_5': ('what is the soil organic carbon at 0-5 cm, in g/kg', 'g/kg', {'rel': 0.01}),
'ph_0_5': ('what is the soil pH at 0-5 cm', 'pH', {'abs': 0.01}),
'ocs_0_30': ('what is the soil organic carbon stock 0-30 cm, in kg/m²', 'kg/m2', {'rel': 0.01}),
}
def build(B):
g = B.store['data/admin1_ground.csv']
gu = g[~g.duplicated(['name', 'country'], keep=False)]
for col, (txt, u, tol) in COLS.items():
sub = gu[gu[col].notna()]
if col == 'pop_volcano50_2020':
sub = sub[sub[col] > 0]
for r in sub.loc[B.sample(sub.index, 14)].itertuples():
B.add('lookup', f'In the {SH}, for {r.name} ({r.country}): {txt}?', {'op': 'lookup', 'file': 'data/admin1_ground.csv', 'where': [['a1', '==', r.a1]], 'col': col}, unit=u, tol=tol, skills=['table_lookup'])
cs = g.groupby('country').size()
for c in B.sample(cs[cs >= 5].index, 40):
col = B.rng.choice(['pop_coast10_2020', 'pop_plate100_2020', 'built_2025', 'coast_km_popw', 'pop_volcano50_2020'])
txt = COLS[col][0].replace('how many people', 'the most people').replace('what is the ', 'the highest ').replace('how many km² are', 'the most km²')
B.add('rank', f'In the {SH}, which admin-1 region of {c} has {txt.replace(", in km", "")}?',
{'op': 'argmax', 'file': 'data/admin1_ground.csv', 'where': [['country', '==', c]], 'col': col, 'return': 'name'}, difficulty=2, skills=['ranking', 'group_filter'])
for c in B.sample(cs[cs >= 3].index, 30):
col = B.rng.choice(['pop_coast10_2020', 'pop_plate100_2020', 'pop_volcano50_2020'])
B.add('aggregate', f'In the {SH}, summing over all admin-1 regions of {c}, {COLS[col][0]}?',
{'op': 'sum', 'file': 'data/admin1_ground.csv', 'where': [['country', '==', c]], 'col': col}, unit='persons', difficulty=2, skills=['aggregation', 'group_filter'])
for c in B.sample(cs[cs >= 5].index, 20):
B.add('count', f'In the {SH}, how many admin-1 regions of {c} have anyone living within 50 km of an erupting volcano (pop_volcano50_2020 > 0)?',
{'op': 'count', 'file': 'data/admin1_ground.csv', 'where': [['country', '==', c], ['pop_volcano50_2020', '>', 0]]}, difficulty=2, skills=['filter', 'count'])
for k in (3, 5):
B.add('rank', f'In the {SH}, list the {k} admin-1 regions with the most people within 50 km of an erupting volcano, most first.',
{'op': 'topk', 'k': k, 'file': 'data/admin1_ground.csv', 'col': 'pop_volcano50_2020', 'return': 'name'}, difficulty=3, skills=['ranking', 'full_scan'], answer_format='JSON list of region names')
B.add('aggregate', f'In the {SH}, how many people in total live within 10 km of the coast (sum of pop_coast10_2020 over all regions)?', {'op': 'sum', 'file': 'data/admin1_ground.csv', 'col': 'pop_coast10_2020'}, unit='persons', difficulty=2, skills=['aggregation', 'full_scan'])
B.add('aggregate', f'In the {SH}, how many people in total live within 50 km of an erupting volcano?', {'op': 'sum', 'file': 'data/admin1_ground.csv', 'col': 'pop_volcano50_2020'}, unit='persons', difficulty=2, skills=['aggregation', 'full_scan'])
for _ in range(30):
a, b = gu.sample(2, random_state=B.rng.randint(0, 1 << 30)).to_dict('records')
col = B.rng.choice(['pop_coast10_2020', 'plate_km_popw', 'built_2025', 'ph_0_5'])
q = {'pop_coast10_2020': 'more people within 10 km of the coast', 'plate_km_popw': 'a larger population-weighted distance to a plate boundary', 'built_2025': 'more built-up km² in 2025', 'ph_0_5': 'a higher topsoil pH'}[col]
B.add('compare', f"In the {SH}, which region has {q}: {a['name']} ({a['country']}) or {b['name']} ({b['country']})?",
{'op': 'compare', 'labels': [a['name'], b['name']], 'parts': [
{'op': 'lookup', 'file': 'data/admin1_ground.csv', 'where': [['a1', '==', a['a1']]], 'col': col},
{'op': 'lookup', 'file': 'data/admin1_ground.csv', 'where': [['a1', '==', b['a1']]], 'col': col}]}, difficulty=2, skills=['comparison'])
gi = g[g.iso_3166_2.notna() & ~g.iso_3166_2.astype(str).str.contains('~') & ~g.duplicated(['iso_3166_2'], keep=False)]
for r in gi.loc[B.sample(gi.index, 25)].itertuples():
col = B.rng.choice(['pop_coast10_2020', 'pop_plate100_2020', 'coast_km_popw'])
B.add('multi_hop', f'In the {SH}, for the region with ISO 3166-2 code {r.iso_3166_2}: {COLS[col][0]}?',
{'op': 'lookup', 'file': 'data/admin1_ground.csv', 'where': [['iso_3166_2', '==', r.iso_3166_2]], 'col': col}, unit=COLS[col][1], difficulty=2, skills=['code_resolution'])
gw = g[g.wikidata.notna() & ~g.duplicated(['wikidata'], keep=False)]
for r in gw.loc[B.sample(gw.index, 15)].itertuples():
B.add('multi_hop', f'In the {SH}, how many people (GHSL 2020) live within 100 km of a plate boundary in the region with Wikidata id {r.wikidata}?',
{'op': 'lookup', 'file': 'data/admin1_ground.csv', 'where': [['wikidata', '==', r.wikidata]], 'col': 'pop_plate100_2020'}, unit='persons', difficulty=2, skills=['code_resolution'])
soil_na = gu[gu.soc_0_5.isna()]
for r in soil_na.loc[B.sample(soil_na.index, 12)].itertuples():
B.add('unanswerable', f'In the {SH}, what is the topsoil organic carbon (0-5 cm, g/kg) of {r.name} ({r.country})? If the ledger has no value, answer null.',
{'op': 'absent', 'file': 'data/admin1_ground.csv', 'where': [['a1', '==', r.a1], ['soc_0_5', 'notna', None]]}, difficulty=2, skills=['abstention'],
note='README: about 70 regions have a blank soil value because SoilGrids gave no value for their cells.')
fl = B.store['data/features_long.csv']
for r in fl.loc[B.sample(fl.index, 20)].itertuples():
B.add('lookup', f'In the {SH} long table, what is `{r.feature}` ({r.unit}) for region a1={r.a1}?', {'op': 'lookup', 'file': 'data/features_long.csv', 'where': [['a1', '==', r.a1], ['feature', '==', r.feature]], 'col': 'value'}, unit=r.unit, skills=['table_lookup', 'id_lookup'])
|