Quick Start

This page walks through a minimal example of using the SDK.

Installation

# PyPI release
pip install imednet
# Install all tabular export dependencies
pip install "imednet[export]"

# Or install destination-specific extras
pip install "imednet[duckdb]"
pip install "imednet[mongodb]"
pip install "imednet[neo4j]"
pip install "imednet[snowflake]"
# Workflow plugin package
pip install imednet-workflows

# Airflow provider package (core hook/operator/sensor support)
pip install "apache-airflow>=3.2.0,<4.0.0" apache-airflow-providers-imednet

Basic Usage

Set your credentials by copying the environment template or exporting them directly:

cp .env.example .env
export IMEDNET_API_KEY="your_api_key"
export IMEDNET_SECURITY_KEY="your_security_key"

Synchronous Example


from __future__ import annotations

import sys

from dotenv import load_dotenv

from imednet import ImednetSDK, load_config
from imednet.utils import configure_json_logging

Asynchronous Example


from __future__ import annotations

import asyncio
import os
import sys

from dotenv import load_dotenv

from imednet import AsyncImednetSDK, load_config
from imednet.utils import configure_json_logging

Custom retry logic can be provided via a RetryPolicy:

from imednet import ImednetSDK
from imednet.core.retry import RetryPolicy, RetryState
from imednet.errors import ServerError

class ServerRetry(RetryPolicy):
    def should_retry(self, state: RetryState) -> bool:
        return isinstance(state.exception, ServerError)

sdk = ImednetSDK(api_key="mock", security_key="mock", retry_policy=ServerRetry())

See Retry Policy and Error Handling for more guidance on error handling and exponential backoff.