Skip to content

File Source

The File source watches a directory at a configurable poll interval and feeds each new file into the channel pipeline. It supports local filesystems, FTP, Amazon S3, and SMB network shares through a unified configuration.

After a file is successfully processed it is moved to an archive directory. Files that fail processing are moved to an error directory so they can be reviewed without blocking the queue.

source:
type: file
scheme: local
directory: /data/inbound
file_pattern: "*.hl7"
poll_interval: 30s
move_to: /data/archive
error_dir: /data/error
sort_by: date
PropertyTypeRequiredDefaultDescription
schemestringYesTransport scheme: local, ftp, s3, or smb.
directorystringYesPath to the directory to poll.
file_patternstringNo*Glob pattern to match filenames (e.g. *.hl7, ADT_*.txt).
poll_intervalstringNo30sHow often to check for new files. Supports s, m, h suffixes.
move_tostringNoDirectory to move files to after successful processing.
error_dirstringNoDirectory to move files to when processing fails.
sort_bystringNonameOrder in which files are processed: name, date, or size.

When scheme is s3, the following additional properties are available under the s3 key:

PropertyTypeRequiredDefaultDescription
bucketstringYesS3 bucket name.
regionstringYesAWS region (e.g. us-east-1).
prefixstringNoKey prefix to filter objects.
authobjectNoExplicit credentials. Falls back to the default AWS credential chain when omitted.
source:
type: file
scheme: s3
directory: /incoming
file_pattern: "*.json"
poll_interval: 1m
s3:
bucket: ehr-integration-inbox
region: us-east-1
prefix: facility-01/
auth:
access_key_id: ${AWS_ACCESS_KEY_ID}
secret_access_key: ${AWS_SECRET_ACCESS_KEY}

Poll a local directory for HL7v2 files and forward them over MLLP:

channel.yaml
channel:
name: lab-file-pickup
description: Pick up lab result files and forward to the LIS
source:
type: file
scheme: local
directory: /data/lab/inbound
file_pattern: "*.hl7"
poll_interval: 30s
move_to: /data/lab/archive
error_dir: /data/lab/error
sort_by: date
transformer:
type: typescript
file: ./transforms/enrich-lab.ts
destination:
type: tcp
host: lis.hospital.local
port: 2575
mode: mllp