Production-ready Python SDK for the OHDSI Athena Concepts API
Project description
athena-client
A production-ready Python SDK for the OHDSI Athena Concepts API.
Installation
pip install athena-client
With optional dependencies:
pip install athena-client[cli] # Command-line interface
pip install athena-client[async] # Async client
pip install athena-client[pandas] # DataFrame output support
pip install athena-client[yaml] # YAML output format
pip install athena-client[crypto] # HMAC authentication
pip install athena-client[all] # All optional dependencies
Quick Start
from athena_client import Athena
# Create a client with default settings (public Athena server)
athena = Athena()
# Search for concepts
results = athena.search("aspirin")
# Various output formats
concepts = results.all() # List of Pydantic models
top_three = results.top(3) # First three results
as_dict = results.to_list() # List of dictionaries
as_json = results.to_json() # JSON string
as_df = results.to_df() # pandas DataFrame
# Get details for a specific concept
details = athena.details(concept_id=1127433)
# Get relationships
rels = athena.relationships(concept_id=1127433)
# Get graph
graph = athena.graph(concept_id=1127433, depth=5)
# Get comprehensive summary
summary = athena.summary(concept_id=1127433)
CLI Usage
# Install CLI dependencies
pip install "athena-client[cli]"
# Search for concepts
athena search "aspirin"
# Get details for a specific concept
athena details 1127433
# Get a summary with various output formats
athena summary 1127433 --output yaml
Configuration
The client can be configured through:
- Constructor arguments
- Environment variables
- A
.envfile - Default values
# Explicit configuration
athena = Athena(
base_url="https://custom.athena.server/api/v1",
token="your-bearer-token",
timeout=15,
max_retries=5
)
Or use environment variables:
ATHENA_BASE_URL=https://custom.athena.server/api/v1
ATHENA_TOKEN=your-bearer-token
ATHENA_TIMEOUT_SECONDS=15
ATHENA_MAX_RETRIES=5
Advanced Query DSL
For complex queries, use the Query DSL:
from athena_client.query import Q
# Build complex queries
q = (Q.term("diabetes") & Q.term("type 2")) | Q.exact('"diabetic nephropathy"')
# Use with search
results = athena.search(q)
Property-Based Tests
We use Hypothesis for edge-case discovery. New core utilities or parsers must include at least one Hypothesis scenario.
Modern Installation & Packaging
This project uses the modern Python packaging standard with pyproject.toml for build and dependency management. You do not need to use setup.py for installation or development. Instead, use the following commands:
Install with pip (recommended)
pip install .
Or, for development (editable install with dev dependencies):
Note: For editable installs with extras, make sure you have recent versions of pip and setuptools:
pip install --upgrade pip setuptools
pip install -e '.[dev]'
Why pyproject.toml?
- All build, dependency, and metadata configuration is in
pyproject.toml. - Compatible with modern Python tooling (pip, build, poetry, etc).
setup.pyis only needed for legacy or advanced customizations.
For more details, see Packaging Python Projects.
Documentation
For complete documentation, visit: https://athena-client.readthedocs.io
License
MIT
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 athena_client-1.0.4.tar.gz.
File metadata
- Download URL: athena_client-1.0.4.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8ead6dd4565ed42a0b3f1ecc3f71a1d719e1a53fcf8d4d4a43d190cb64229e2
|
|
| MD5 |
abd6aaf97c530dac6cb040cb308d4a5a
|
|
| BLAKE2b-256 |
70f1908fedb1ca885934e6709e7f8fa86e841b0a133d3f8a0e3b874e7b2c2a75
|
Provenance
The following attestation bundles were made for athena_client-1.0.4.tar.gz:
Publisher:
publish.yml on aandresalvarez/athena_client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
athena_client-1.0.4.tar.gz -
Subject digest:
a8ead6dd4565ed42a0b3f1ecc3f71a1d719e1a53fcf8d4d4a43d190cb64229e2 - Sigstore transparency entry: 243565281
- Sigstore integration time:
-
Permalink:
aandresalvarez/athena_client@b36a50e26444817f74c4e6ba755b6b0d67f6bac8 -
Branch / Tag:
refs/tags/v1.0.4 - Owner: https://github.com/aandresalvarez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b36a50e26444817f74c4e6ba755b6b0d67f6bac8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file athena_client-1.0.4-py3-none-any.whl.
File metadata
- Download URL: athena_client-1.0.4-py3-none-any.whl
- Upload date:
- Size: 23.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d783b6e889cae5cadc6159a2a72235225bd65f05a9381f56c746d3ea02f70dfc
|
|
| MD5 |
1884f3c34d5df9216c121c05b97b5b62
|
|
| BLAKE2b-256 |
1d27ed40ee74edc1694d29a503c8c8a7e9b7fe714882ea7402b061a5d9f3d6dc
|
Provenance
The following attestation bundles were made for athena_client-1.0.4-py3-none-any.whl:
Publisher:
publish.yml on aandresalvarez/athena_client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
athena_client-1.0.4-py3-none-any.whl -
Subject digest:
d783b6e889cae5cadc6159a2a72235225bd65f05a9381f56c746d3ea02f70dfc - Sigstore transparency entry: 243565283
- Sigstore integration time:
-
Permalink:
aandresalvarez/athena_client@b36a50e26444817f74c4e6ba755b6b0d67f6bac8 -
Branch / Tag:
refs/tags/v1.0.4 - Owner: https://github.com/aandresalvarez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b36a50e26444817f74c4e6ba755b6b0d67f6bac8 -
Trigger Event:
push
-
Statement type: