Skip to content

SFTP Source

The SFTP source connects to a remote SFTP server and polls a directory for new files at a configurable interval. Each file discovered is read into the pipeline, then moved to an archive directory or an error directory depending on the processing outcome.

source:
type: sftp
host: sftp.lab-partner.com
port: 22
poll_interval: 1m
directory: /outbound/results
file_pattern: "*.hl7"
move_to: /outbound/archive
error_dir: /outbound/error
auth:
type: private_key
username: intuware
private_key_file: ./keys/id_ed25519
passphrase: ${SFTP_KEY_PASSPHRASE}
sort_by: date
PropertyTypeRequiredDefaultDescription
hoststringYesHostname or IP of the SFTP server.
portintNo22SSH port.
poll_intervalstringNo1mHow often to check for new files. Supports s, m, h suffixes.
directorystringYesRemote directory to poll.
file_patternstringNo*Glob pattern to match filenames.
move_tostringNoRemote directory to move files to after successful processing.
error_dirstringNoRemote directory to move files to when processing fails.
authobjectYesAuthentication credentials (see below).
sort_bystringNonameOrder in which files are processed: name, date, or size.
auth:
type: password
username: intuware
password: ${SFTP_PASSWORD}
auth:
type: private_key
username: intuware
private_key_file: ./keys/id_ed25519
passphrase: ${SFTP_KEY_PASSPHRASE}

The passphrase field is only required if the private key is encrypted.

Poll lab results from an external SFTP server and route them into the hospital LIS:

channel.yaml
channel:
name: lab-sftp-pickup
description: Retrieve lab results from reference lab SFTP
source:
type: sftp
host: sftp.lab-partner.com
port: 22
poll_interval: 1m
directory: /outbound/results
file_pattern: "*.hl7"
move_to: /outbound/archive
error_dir: /outbound/error
auth:
type: private_key
username: intuware
private_key_file: ./keys/id_ed25519
passphrase: ${SFTP_KEY_PASSPHRASE}
sort_by: date
transformer:
type: typescript
file: ./transforms/normalize-lab.ts
destination:
type: tcp
host: lis.hospital.local
port: 2575
mode: mllp