Skip to main content

From File

The From File component processes files from a specified local source directory, and pushes the contents to the queue. Processed files are deleted by default, or alternatively, they can be setup to be moved to a processed directory.

All functionality described is highly customizable from within the component Translator. Existing features can be modified and new features can be added to meet your specifications.

Running the Component

The below steps assume the correct user permissions are in place to read/write/move files.

STEP 1: Import the From File component

Using , import the From File component

STEP 2: Setup the component configurations in the component card

Bolded fields are required, otherwise default values defined in config.json are used:

Field

Description

Default Value

Poll Time (s)

The frequency (in seconds) the component polls the Source Directory.

10

Source Directory

The directory to retrieve files from.

Extension of Files

Extension of files, comma separated e.g., txt, hl7, x12

*

Minimum File Age (s)

Time (in seconds) to wait after last modified date before processing.

0

After Processing

File handling procedure after reading

Options: Delete processed files,
Move processed files

Delete processed files

Processed Files Directory*

The directory to move processed files to.

* Only required if the After Processingfield is set to Move processed files

Extract Messages

Controls whether to try extracting messages from the file based on the Input File Type field.

The component will error out if the Input File Type field is set to Arbitrary text and this field is set to true.

true

Input File Type

Specifies the type of message to be extracted from the file.

Note: Has no effect if the Extract Messages field is set to false.

Note: Custom message must be defined inside DATAformats.lua and be similar in structure to HL7 and X12 (pre-set header and delimiter).

Options: HL7, X12, Custom message, Arbitrary text

HL7

Ignored Segments List

Segments that will be removed from extracted messages. Works with any type of message.

Note: Has no effect if the Extract Messages field is set to false.

(HL7 Only) Replace Segment Delimiter With

Controls the segment delimiter in the message.

Hint: The HL7 standard for the segment delimiter is carriage return (\r).

Note: Has no effect if the Extract Messages field is set to false.

Options: \r (Carriage Return - 0x0D), \n (Line Feed - 0x0A), \r\n (Carriage Return followed by Line Feed - 0x0D 0x0A)

\r (Carriage Return - 0x0D)

Input File Encoding

The encoding used in the input data. List of available encodings is available when you click to change the encoding.

Use system default ISO-8859-1 on Linux/MacOS or Windows-1252 on Windows

Print Debug Logs

Enable/disable logging of additional debug information.

false

STEP 3: Start the component and view processed files' contents in the logs

Once the component is started, any file in the Source Directory matching the Input File Encoding and Minimum File Age will be read, and its contents will be pushed to queue.

Verify that the contents are being read as expected, and adjust the configuration if necessary.

Optional configuration: Custom message parsing and extracting

In the DATAformats.lua file, you can also modify the message delimiter used for each data type, as well as its header. You can also define your own custom message type's header and delimiter.

  • Keep in-mind that the length of the header is used in extracting the message properly.

  • The built-in function for extracting messages expects the segment headers to be alphanumeric (numbers and letters - no special characters).