Python SDK for the Mayo Clinic HOUSES API
Project description
houses-client
Python SDK for the Mayo Clinic HOUSES API.
Requirements
Python 3.11+
Installation
pip install houses-client
Usage
Synchronous lookup (small batches up to 25 addresses)
from houses_client import HousesClient
client = HousesClient(
api_endpoint="https://houses.konfidential.io",
client_id="my oidc client id",
client_secret="my oidc client secret",
)
result = client.lookup(
addresses=[
{"id": "1", "address": "123 Main St", "city": "Rochester", "state": "MN", "zip": "55905"},
{"id": "2", "address": "456 Main St Anytown NY 55555"},
],
year=2021,
)
print(result["results"])
Async batch (any size, file-based)
client.batch(
input_path="myinput.csv",
output_path="myoutput.csv",
year=2021,
delimiter=",",
)
Index metadata
client.metadata() # available years and index versions
Self-hosted mode (no auth)
client = HousesClient(api_endpoint="http://localhost:9002", self_hosted=True)
Errors
The SDK raises typed exceptions you can catch:
| Exception | Raised when |
|---|---|
ConfigurationError |
Missing required constructor arguments |
AuthenticationError |
OIDC login or token refresh fails |
APIError |
The API returns a non-2xx status (status_code, body) |
TaskError |
An async batch task reports ERROR status |
HousesError |
Base class for all of the above |
from houses_client import HousesClient, APIError, TaskError
try:
client.batch(input_path="in.csv", output_path="out.csv", year=2021)
except APIError as e:
print(f"API failed: status={e.status_code}, body={e.body}")
except TaskError as e:
print(f"Task failed: {e}")
Constructor options
| Property | Type | Default | Description |
|---|---|---|---|
api_endpoint |
str | required | HOUSES API base URL |
client_id |
str | None | OIDC Client ID (required unless self_hosted=True) |
client_secret |
str | None | OIDC Client Secret (required unless self_hosted) |
self_hosted |
bool | False |
Skip OIDC; uses anonymous auth |
log_level |
str | "INFO" |
One of DEBUG, INFO, WARNING, ERROR |
timeout |
float | 60.0 |
Per-request HTTP timeout in seconds |
CLI
After installing, the houses-client console script is available:
houses-client \
-e http://localhost:9002 \
-i sample1.csv \
-o sample1_output.csv \
-y 2021 \
-d , \
--selfhosted
Run houses-client --help for the full option list.
Input data schema
Single-string address
id,address,year
1,"123 main st anytown ny 5555",2019
2,"456 main st anytown ny 55555",2018
The address string should include at least one of: city+state, city, state, or zip.
The year column is optional and overrides the request-level year. Add a
referenceAddress column to override per-row.
Component address
id,address,secondary,city,state,zip,year
1,"123 main st","Apt 4B","Anytown","NY","55555",2019
Build
python3 -m pip install --upgrade build
python3 -m build
The version is read from houses_client.__version__. Bump it in
houses_client/__init__.py before building.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file houses_client-1.4.0.tar.gz.
File metadata
- Download URL: houses_client-1.4.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e47d294d8fca2934dbcb138d89c7a91d93d68cacd4d3405d82d6a09ae90d96c
|
|
| MD5 |
289bfbddcba5a9a8ef202b16e3b700a0
|
|
| BLAKE2b-256 |
cd85217bd7f3498e04fd6e7a7b272c4ad2d62822ebe526c3028956e7c4f80d01
|
File details
Details for the file houses_client-1.4.0-py3-none-any.whl.
File metadata
- Download URL: houses_client-1.4.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
430e90d7b81a130ef5446e58adbaee850c0d45c435d88582b5bf90c99e331312
|
|
| MD5 |
326b8745243079bfdf022b2f0b1d5650
|
|
| BLAKE2b-256 |
1c738cca80a67d519ecf0bddcee637f61fbe62791efd24f8f6f3f835f6867ea2
|