gov-doc-parser
Parse and extract structured data from UK government documents — GOV.UK, Hansard, ICO, FCA, BAILII, and ATRS. Research and governance analysis toolkit.
Install
pip install gov-doc-parser
Zero external dependencies — pure Python stdlib.
Quick start
from gov_doc_parser import GovDocParser
parser = GovDocParser()
# Parse any UK gov source
doc = parser.parse(html_text, source="ico")
print(doc.title, doc.date, doc.metadata)
# Auto-detect from URL
doc = parser.parse(html, source="auto", url="https://ico.org.uk/...")
# Extract AI references with sentiment
result = parser.parse_full(html, source="govuk")
for ref in result.ai_references:
print(f"[{ref.sentiment}] {ref.term}: {ref.context[:100]}")
# [regulatory] algorithm: ...automated decision-making must comply with UK GDPR...
# [negative] artificial intelligence: ...AI found to be unlawful under Equality Act...
# Parse ATRS record
doc, atrs = parser.parse_atrs(atrs_html)
print(atrs.system_name, atrs.governance_score) # 0-100 transparency score
print(atrs.dpia_completed, atrs.human_review, atrs.legal_basis)
# Batch
results = parser.batch_parse([
{"html": govuk_html, "source": "govuk"},
{"html": ico_html, "source": "ico"},
])
Supported sources
| Source | Extracts |
|---|---|
| GOV.UK | Title, date, department, document type, sections |
| Hansard | Date, house, speaker, debate text, AI mentions |
| ICO | Enforcement type, penalty amount, decision text |
| FCA | Document type (Dear CEO/PS/CP), FCA reference |
| BAILII | Citation, court, judge, judgment text |
| ATRS | System name, risk tier, DPIA status, governance score |
CLI
gov-doc-parser document.html --source ico
gov-doc-parser document.html --source govuk --ai-refs
gov-doc-parser atrs_record.html --atrs
gov-doc-parser document.html --json
Release files for gov-doc-parser 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gov_doc_parser-1.0.0.tar.gz | 15.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gov_doc_parser-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.8 kB
Release files / gov_doc_parser-1.0.0.tar.gz
| Download URL | gov_doc_parser-1.0.0.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a18cc746240de3f5255acd7ed20692847701c595b0d1b720cf99fcde9d8eab92
|
|
BLAKE2b-256 checksum How to use checksums |
97b24616d780524e3f49e6bebd9d4e414064adffe6778d09918af6868aaf224b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.
Transparency logRelease files / gov_doc_parser-1.0.0-py3-none-any.whl
| Download URL | gov_doc_parser-1.0.0-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a80572e03acc48e5dd1b0a856459fdd6dd8ec830e17f63e2ab731b00c0db5c8d
|
|
BLAKE2b-256 checksum How to use checksums |
260481fb1d8a1e06441f9e9e542d23ad3413b60efc647e5c810105adb4185ad3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.
Transparency log