Convert a range of formats of Union Lists for India Office Records maps into a single data model.
Work commissioned by Huw Rowlands (HR) 01/2026. Harry Lloyd (HL) worked on 02/2026 - 08/2026.
├── LICENSE <- MIT License
├── README.md <- The top-level README for developers using this project.
├── data
│ ├── interim <- Intermediate data that has been transformed.
│ ├── processed <- The final data sets.
│ └── raw <- The original, immutable data dump.
│
├── pyproject.toml <- Project configuration file with package metadata for
│ emp and configuration for tools like black
│
├── uv.lock <- The uv lock file for reproducing the analysis environment
|
├── main.py <- Run code from reformat_union_lists.py once you've run extract_from_doc.py and extract_from_xlsx.py
|
├── tests <- pytest tests for the repository `uv run pytest tests/`
│
└── src <- Source code for use in this project.
└── union_lists
├── __init__.py <- Makes union_lists a Python module
│
├── config.py <- Store useful variables and configuration
|
└── dataset
│
├── __init__.py <- Makes dataset a Python module
|
├── extract_from_doc.py <- Extract references from docx files
├── extract_from_xlsx.py <- Extract references from xlsx files
└── reformat_union_lists.py <- Reformat references into new data model data from docx files
Copy the repository with git clone, then create the environment.
uv will sync the environment for you the first time you try to run code using
$ uv run python <example.py>
however you can use uv sync if you want to set the environment up before you run it.
You can get a copy of the raw data from the Sharepoint site maintained by Huw Rowlands. This should include the Quarter Inch, Half Inch and One Inch raw maps made up of both .doc and .xlsx files. There are .pdf files as well but we didn't work with these.
Use notebooks/02-HL-reformat_union_lists.ipynb to convert raw .doc files into .docx files and remove heinous pre-2010 Word SmartTags which mess up extraction from Doc XML. Takes a few minutes and outputs .docx files to interim folders
Run extract_from_doc.py and extract_from_xlsx.py from the root folder (I just ran from within VSCode) to extract references to interim .csv formats in interim folders
Run main.py across the three map scales, One Inch/Half Inch/Quarter Inch, to output to a processed folder. I haven't regularised the output name so it's likely hardcoded as v0.1.2_One_Inch_References.xlsx
Outputs will go to data/processed/<map scale>, and consist of 3 xlsx files, one for each map scale. Consult the data model in the Sharepoint folder for more info.
uv run pytest tests/ will run the test suite. Coverage is reasonable, but declines for output validation, and validate_output() in union_lists.dataset.reformat_union_lists definitely needs more work.
Code was developed by Harry Lloyd, Research Software Engineer, British Library. Contact harry.lloyd [at] bl.uk.