Skip to content
dev

TORCH Import ​

Extracts patient data from a TORCH server. Supports two modes: CRTDL-based extraction and direct TORCH URL import.

What it does ​

CRTDL mode (submit + poll + download):

  • Sends CRTDL query to TORCH
  • Polls for extraction completion
  • Downloads FHIR NDJSON data

Direct URL mode (poll + download):

  • Polls an existing TORCH extraction/result URL
  • Downloads FHIR NDJSON data when ready
  • Skips the extraction submission step

Start check ​

Before the first step starts, aether pipeline start sends GET {base_url}/fhir/metadata with the TORCH credentials and a 5-second timeout. The start stops if TORCH is unreachable, rejects the credentials (HTTP 401 or 403), sends a different status, or does not send a CapabilityStatement. The error shows the full URL and the HTTP status. If software.name in the statement does not contain Torch, aether logs a warning and continues.

Progress display ​

While the step polls, aether reads batch progress from the TORCH Task API (GET /fhir/Task/{jobId}, extension torch-job-progress) and shows it in three places:

  • A progress line in the terminal, with a bar, a percent value, and the active batch stages: TORCH extraction [##########......] 66% — 1/3 batches (500/1200 patients), active: DIRECT_LOAD (2/5)
  • A structured log line each time the progress changes.
  • The pipeline status command, which reads the last persisted progress from the job file — also from a second terminal while the pipeline runs.

The percent value is an estimate: each active batch counts as stage index / 5 of a batch, and the five stages get equal weight.

The Task API extension needs TORCH v1.0.2 or later. Against an older TORCH, aether falls back to the OperationOutcome diagnostics text, as before.

Configuration ​

yaml
services:
  torch:
    base_url: "https://your-torch-server.org"
    username: "your-username"
    password: "your-password"
    extraction_timeout: PT30M    # default
    polling_interval: PT5S       # default
    max_polling_interval: PT30S  # default
    file_ready_retries: 10       # default
    file_ready_interval: PT10S   # default
    download_stall_timeout: PT1M # default
    request_timeout: PT1M        # default

pipeline:
  enabled_steps:
    - torch

Usage ​

With CRTDL file ​

bash
aether pipeline start aether.yaml crtdl.json

With TORCH URL ​

bash
aether pipeline start aether.yaml crtdl.json "https://torch.example.com/fhir/extraction/result-123"

URLs containing /fhir/extraction/ or /fhir/result/ are automatically recognized as TORCH URLs. See the TORCH Integration guide for details.

Configuration Options ​

OptionTypeDefaultDescription
base_urlstring-TORCH server root URL (required). aether appends /fhir.
usernamestring-Authentication username
passwordstring-Authentication password
extraction_timeoutdurationPT30MMax wait time for extraction
polling_intervaldurationPT5SInitial status check interval
max_polling_intervaldurationPT30SMax interval (exponential backoff)
file_ready_retriesint10Retries while waiting for files to appear after extraction completes
file_ready_intervaldurationPT10SInterval between file-availability checks
download_stall_timeoutdurationPT1MInactivity window while streaming a result file; the download is canceled only if no bytes arrive for this long. 0 uses the built-in default.
request_timeoutdurationPT1MTime limit for one request to TORCH, for example the extraction submit. aether does not send the submit again, because each submit starts a new extraction. 0 uses the built-in default.

Healthcare data integration made simple