Open-source package
AdminLineageAI
AI-assisted administrative crosswalks for districts, subdistricts, states, and countries across datasets that come from different sources or time periods.
Experimental utility, review required
Treat AdminLineageAI outputs as assistive crosswalks, not final truth. The package is designed to reduce manual work while keeping a clear review trail, especially for important administrative matches.
Install
pip install adminlineage
Grounding
Gemini + Google Search
Artifacts
CSV, Parquet, JSONL
What it helps with
- Match scheme datasets to standard administrative lists such as census tables.
- Handle spelling variants and language-specific forms like Paschimi Singhbhum and West Singhbhum.
- Reason over administrative splits, mergers, transfers, and renames where clean public evolution lists are missing.
- Create new evolution crosswalks between periods, while preserving review artifacts for manual checking.
Core workflow
- 01Load two administrative-unit tables.
- 02Choose the name columns, IDs, years, country, and optional exact-match scopes.
- 03Generate candidate matches and ask Gemini to adjudicate the hard cases.
- 04Review the evolution key and flagged rows before using the crosswalk downstream.
Important features
- Candidate generation before LLM calls, with exact string matching and pruning to control token cost.
- Hierarchical matching within exact scopes such as country, state, or district.
- Grounded Gemini adjudication with strict JSON output and resumable artifacts.
- Optional replay so repeated semantic requests can reuse completed LLM work.
Python API quick start
import pandas as pd
import adminlineage
df_from = pd.read_csv("from_units.csv")
df_to = pd.read_csv("to_units.csv")
crosswalk_df, metadata = adminlineage.build_evolution_key(
df_from,
df_to,
country="India",
year_from=1951,
year_to=2001,
map_col_from="district",
map_col_to="district",
exact_match=["state"],
relationship="auto",
model="gemini-3.1-flash-lite",
replay_enabled=True,
)Outputs to review
evolution_key.csv
evolution_key.parquet
review_queue.csv
run_metadata.json
links_raw.jsonl
Where this fits in the guide
Many Indian datasets are useful only after their geography is made comparable across time. AdminLineageAI sits alongside this guide as a tool for building and auditing those administrative crosswalks, while this website helps researchers discover source datasets, variables, access conditions, and documentation.