Two editions, not one folder with extras
The editions cannot be merged by “latest filename wins.” The case must pin an edition ID and source checksum before transformation begins.
The workbook is a static register, not a rules engine.
The mapping workbook contains 331 records: 164 policies/procedures, 140 forms/registers and smaller HR, residential, welcome-pack and business-information groups. It has no formulas. Category Q3.2 dominates the mapping, while identifiers and controlled vocabularies are inconsistent.
Human IDs are reused.
Rows need stable machine IDs separate from displayed document numbers.
Labels disagree.
Clinical/Non-clinical/Clinical-adjacent/N/No and Std/Standard values require normalisation.
Categories cross-contaminate.
Generic Category Q3.x labels are not sufficient for every current category question.
Mappings are indicative.
The workbook’s own legend requires confirmation against exact current forms.
A controlled generation job
- 1Pin inputs
Edition checksum, approved case revision, categories, jurisdiction and output request.
- 2Resolve inclusion
Use explicit register rules; never infer scope from filenames alone.
- 3Apply typed variables
Every replacement has a source, required state and unresolved-token behaviour.
- 4Transform structures
Handle runs, tables, headers, footers, workbooks and form fields without flattening content blindly.
- 5Emit review set
Comments/highlights and a gap report show unresolved or low-confidence material.
- 6Finalise mechanically
Remove review marks, scrub metadata and write an immutable output manifest and delta log.
Validation is part of generation.
Repository fit
python-docx is the closest primary library because it exposes Word document structure directly. openpyxl covers the mapping workbook and spreadsheets. pypdf is the first form-field probe. Pydantic defines generation jobs, variables, manifests and validator outputs.
Docling, OCRmyPDF, Gotenberg and qpdf remain optional workers introduced only when real files fail the core fixtures.
Open reconciliation before automation
- README counts and variable counts disagree.
- Input lists describe 31 versus 33 fields.
- Clinical labels and legacy codes are inconsistent.
- Some control artifacts are referenced but absent.
- macOS sidecar content appears inside supplied ZIPs.
- Internal source-guide absolutes need current official confirmation before becoming validators.