Skip to main content

Production-ready Python SDK for the OHDSI Athena Concepts API

Project description

athena-client

SBOM

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:

  1. Constructor arguments
  2. Environment variables
  3. A .env file
  4. 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.py is 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


Download files

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

Source Distribution

athena_client-1.0.4.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

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

athena_client-1.0.4-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

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

Hashes for athena_client-1.0.4.tar.gz
Algorithm Hash digest
SHA256 a8ead6dd4565ed42a0b3f1ecc3f71a1d719e1a53fcf8d4d4a43d190cb64229e2
MD5 abd6aaf97c530dac6cb040cb308d4a5a
BLAKE2b-256 70f1908fedb1ca885934e6709e7f8fa86e841b0a133d3f8a0e3b874e7b2c2a75

See more details on using hashes here.

Provenance

The following attestation bundles were made for athena_client-1.0.4.tar.gz:

Publisher: publish.yml on aandresalvarez/athena_client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for athena_client-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d783b6e889cae5cadc6159a2a72235225bd65f05a9381f56c746d3ea02f70dfc
MD5 1884f3c34d5df9216c121c05b97b5b62
BLAKE2b-256 1d27ed40ee74edc1694d29a503c8c8a7e9b7fe714882ea7402b061a5d9f3d6dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for athena_client-1.0.4-py3-none-any.whl:

Publisher: publish.yml on aandresalvarez/athena_client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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