HL7MAP Library

The HL7MAP Library is an importable library containing functions that help you dynamically call mapping and filtering functions for complex HL7 mapping and filtering. This library is used in the HL7 to HL7 Map component.

How to use it:

Import the HL7MAP library into the Translator using the image-20240702-200510.png button.

Typically only the HL7MAPinit module needs to be required in order to initialize the library and access the methods.

require "HL7MAP.HL7MAPinit"

Call HL7MAPinit in your script to initialize the library object and configure the mapping and/or filtering directories that the object will use to call mapping and/or filtering modules. For example:

local H = HL7MAPinit{filter_dir='filters',mapping_dir='mappings'}

Add message-specific filter modules in the specified filters directory. The modules should be named [HL7_Type].lua. There should also be a default.lua to handle default filter conditions.

Messages with an inbound HL7 message type (ex. ADTA01) that matches the name of a filtering module (ex. ADTA01.lua) will be filtered by that module. All other messages will be filtered by the default filter conditions default.lua, which can also be further customized.

Add mapping modules in the specified mapping directory. The modules should be named [HL7_Type].lua.

By default, only messages with an outbound HL7 message type (ex. ADTA01) that matches the name of a mapping module (ex. ADTA01.lua) will be mapped. All other messages will be pushed downstream in their original form.

Any codemap-related modules can also be stored in this directory.

How it works:

Sets up the HL7MAP library framework, adding the method modules to a metatable and storing the provided mapping and filter directories. The library can be used for filtering alone, mapping alone, or both filtering and mapping.

The directory paths are also used in require statements for the appropriate modules, so they should be based on the syntax used to call those modules directly. For example, let’s say we want to use the mappings folder inside the configurations folder:

image-20240702-200919.png

We would now initialize our library object like so:

local H = HL7MAPinit{mapping_dir='configurations.mappings'}

The methods dynamically call the correct mapping or filtering module based on the provided arguments: