Skip to main content

Query UK GP practices (surgeries) via NHS ODS Data Search & Export CSV reports.

Project description

uk-gp-practices

Query UK GP practices ("surgeries") locally using NHS ODS Data Search & Export (DSE) CSV reports. Now includes Scottish surgeries.

This package downloads a predefined ODS report (default: epraccur), stores it in a local SQLite database, and provides a simple Python API + CLI to query it quickly.

Note: On first use the package will automatically download the latest report from the NHS ODS endpoint. Subsequent queries use the local cache (refreshed daily by default).

Install

pip install uk-gp-practices

For fuzzy name matching (optional):

pip install uk-gp-practices[fuzzy]

Python API

from uk_gp_practices import PracticeIndex

# Auto-download the latest data (cached for 24 h)
idx = PracticeIndex.auto_update()

# Look up a single practice by ODS code
practice = idx.get("A81001")
print(practice.name, practice.postcode)

# Search by name / postcode / town / status
results = idx.search(name="castle", status="ACTIVE", limit=10)
for r in results:
    print(r.organisation_code, r.name, r.postcode)

# Context-manager usage
with PracticeIndex.auto_update() as idx:
    print(idx.get("A81001"))

CLI

# Update the local database
uk-gp update

# Get a single practice (JSON output)
uk-gp get A81001

# Search practices
uk-gp search --name "castle" --status ACTIVE --limit 5
uk-gp search --postcode "SW1A 1AA"
uk-gp search --town "Swansea"

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uk_gp_practices-0.2.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uk_gp_practices-0.2.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file uk_gp_practices-0.2.0.tar.gz.

File metadata

  • Download URL: uk_gp_practices-0.2.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for uk_gp_practices-0.2.0.tar.gz
Algorithm Hash digest
SHA256 20ad0298bffd824b04031d07d20be8619dc372e3c512dafe5575458a68156602
MD5 a170039ea5f19d8585d4fd8066e64d90
BLAKE2b-256 cb7020a632e211c80ff68038c837c3ce211ad74609de91a22939917fbee3efc8

See more details on using hashes here.

File details

Details for the file uk_gp_practices-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for uk_gp_practices-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ad43bd629c07ef2db6abb5ef9458a86641fcfb8626fe9b0fe8251a4a1bd47ed
MD5 9bc95bd8d9cd791aa63a91ebc7f0f40b
BLAKE2b-256 d4ee31e8a199e81b6452e8f85fe682ac875afe8159b7953cc8b70381e60cc086

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page