Production-ready Python SDK for the OHDSI Athena Concepts API
Project description
athena-client
A production-ready Python SDK for interacting with the OHDSI Athena Concepts API. Easily search, explore, and analyze medical concepts without any additional setup.
Looking for advanced concept exploration, mapping, and best practices? See the Concept Exploration Guide for a comprehensive tutorial on robust usage, advanced workflows, and real-world examples.
Installation
Basic Installation (Recommended)
For standard use, install with:
pip install athena-client
This provides essential Athena API functionalities like concept search and exploration without database integration.
Alternatively, explicitly specify:
pip install "athena-client[core]"
Both methods offer the same functionality.
Quick Start
from athena_client import Athena
# Initialize Athena client (uses public Athena API by default)
athena = Athena()
# Search for concepts
results = athena.search("aspirin")
# Different ways to handle results
concept_list = results.all()
top_three = results.top(3)
as_json = results.to_json()
as_df = results.to_df()
# Detailed information for a specific concept
details = athena.details(concept_id=1127433)
# Concept relationships
relationships = athena.relationships(concept_id=1127433)
# Concept graph
graph = athena.graph(concept_id=1127433, depth=3)
# Comprehensive summary
summary = athena.summary(concept_id=1127433)
CLI Quick Start
Athena CLI allows rapid concept search and exploration:
athena search "aspirin" --limit 3 --output json
athena details 1127433
athena relationships 1127433
athena graph 1127433 --depth 3
athena summary 1127433
Optional Extras
Additional functionalities can be installed separately:
pip install athena-client[cli] # Command-line interface
pip install athena-client[async] # Async client support
pip install athena-client[pandas] # pandas DataFrame support
pip install athena-client[yaml] # YAML format support
pip install athena-client[crypto] # HMAC authentication
pip install athena-client[all] # All optional dependencies
Experimental: Database Integration (Advanced Users)
Warning: Database integration features are experimental, subject to change, and may encounter errors.
Experimental database integration allows validation and concept set generation against your local OMOP database. Use these features cautiously.
Installation for Database Support
For specific database integrations:
-
PostgreSQL:
pip install "athena-client[postgres]"
-
Google BigQuery:
pip install "athena-client[bigquery]"
Reducing Dependency Conflicts (Advanced)
To minimize dependency issues:
- Use specific extras when installing.
- For BigQuery integration, use Python 3.9 and SQLAlchemy < 1.5.0.
Database Usage Example
import asyncio
from athena_client import Athena
DB_CONNECTION_STRING = "postgresql://user:pass@localhost/omop_cdm"
async def main():
athena = Athena()
concept_set = await athena.generate_concept_set(
query="Type 2 Diabetes",
db_connection_string=DB_CONNECTION_STRING
)
print(concept_set)
asyncio.run(main())
Experimental CLI Database Example
export OMOP_DB_CONNECTION="postgresql://user:pass@localhost/omop"
athena generate-set "Type 2 Diabetes" --output json
Troubleshooting Common Issues
- Dependency installation problems: Ensure Python version compatibility and correct extras.
- PostgreSQL build errors: Install PostgreSQL development tools (
brew install postgresqlon macOS). - BigQuery SQLAlchemy conflicts: Only use Python 3.9 with BigQuery integration.
Version Compatibility
- Python: >= 3.9, < 3.13
- SQLAlchemy: >= 1.4.0 (BigQuery limited to <1.5.0)
- pandas: >= 1.3.0, < 3.0.0
- pydantic: >= 2.0.0
- httpx: >= 0.18.0
- cryptography: >= 36.0.0
This README provides clarity on basic use, separates experimental features, and outlines recommended practices clearly.
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.15.tar.gz.
File metadata
- Download URL: athena_client-1.0.15.tar.gz
- Upload date:
- Size: 69.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
691a8c656a35d7ef5b2891db6ca00aff0c1fd9c4dc4ad0ac3e86768fabb37108
|
|
| MD5 |
60256578b8e72470f29171901e190728
|
|
| BLAKE2b-256 |
31efe188cd6c3176de07ae794604d4f34d289ecea25a5ab82322d0156dca2ca1
|
Provenance
The following attestation bundles were made for athena_client-1.0.15.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.15.tar.gz -
Subject digest:
691a8c656a35d7ef5b2891db6ca00aff0c1fd9c4dc4ad0ac3e86768fabb37108 - Sigstore transparency entry: 257199739
- Sigstore integration time:
-
Permalink:
aandresalvarez/athena_client@3a616f50ada358b6903bcb0976d87f275f180e88 -
Branch / Tag:
refs/tags/v1.0.15 - Owner: https://github.com/aandresalvarez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3a616f50ada358b6903bcb0976d87f275f180e88 -
Trigger Event:
push
-
Statement type:
File details
Details for the file athena_client-1.0.15-py3-none-any.whl.
File metadata
- Download URL: athena_client-1.0.15-py3-none-any.whl
- Upload date:
- Size: 45.5 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 |
c5f23222597b5492142501669102506bc3c782624cd7a4c9495a5baa44b4eac4
|
|
| MD5 |
8f082455b8c701a405806c5a5d23a9d2
|
|
| BLAKE2b-256 |
c8d7afe0cb76e78369ce0146b71ec5820788a8eb1b9f5337c064712d22fc1d45
|
Provenance
The following attestation bundles were made for athena_client-1.0.15-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.15-py3-none-any.whl -
Subject digest:
c5f23222597b5492142501669102506bc3c782624cd7a4c9495a5baa44b4eac4 - Sigstore transparency entry: 257199740
- Sigstore integration time:
-
Permalink:
aandresalvarez/athena_client@3a616f50ada358b6903bcb0976d87f275f180e88 -
Branch / Tag:
refs/tags/v1.0.15 - Owner: https://github.com/aandresalvarez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3a616f50ada358b6903bcb0976d87f275f180e88 -
Trigger Event:
push
-
Statement type: