Airflow Export Operator DAG

Prerequisites

  • apache-airflow-providers-imednet and imednet[export] installed in an Apache Airflow 3.2+ environment

Environment variables

Configure the imednet_default connection in Apache Airflow (or set AIRFLOW_CONN_IMEDNET_DEFAULT):

export AIRFLOW_CONN_IMEDNET_DEFAULT="https://<api-key>:<security-key>@your.imednet.com"

Description

Define an Apache Airflow DAG using ImednetExportOperator to export Study Records to CSV via an Airflow connection.

See Airflow Integration for connection setup and export destination options.

"""Apache Airflow DAG exporting Study Records to CSV via ``ImednetExportOperator``.

Update ``STUDY_KEY`` and ``output_path`` before running. Credentials are read
from the ``imednet_default`` Airflow connection (or override ``imednet_conn_id``).
"""

from datetime import datetime

from airflow.sdk import DAG

from apache_airflow_providers_imednet import ImednetExportOperator

default_args = {"start_date": datetime(2024, 1, 1)}

with DAG(
    dag_id="imednet_export_example",
    schedule=None,
    default_args=default_args,
    catchup=False,
) as dag:
    export_records = ImednetExportOperator(
        task_id="export_records",
        study_key="STUDY_KEY",
        output_path="/tmp/records.csv",
        export_func="export_to_csv",
    )