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.

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.1.0.tar.gz (8.5 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.1.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: uk_gp_practices-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 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.1.0.tar.gz
Algorithm Hash digest
SHA256 40cb85803f926d7b43da90afee3edd69408085354a01ab0b3d5acfab3ee49098
MD5 12d49c5d610af7901a6bdeb0d5b4d9f0
BLAKE2b-256 ae3e36cff82c67ebdcd50d9119780d68e48adc51948112b522998f0214a10445

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for uk_gp_practices-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59f186cd79dcdda50394da1ea9445359d376bf3b59681982aa3dbfb4afd75424
MD5 19444157d072395430bdae3afcfbb154
BLAKE2b-256 4f1c5fe93f3a3b469210b3c146b3106b37fcd03626e222dfbf5e82dc5a7bfbf4

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