Description
The HL7SegmentMergeReceiver merges data from two or more segmented data files, generated from the SegmentDataCreatorReceiver, into HL7 formatted output.
HL7 (Health Level Seven) is a standard for exchanging information between medical applications. The format of the HL7 formatted output is determined by reading a configuration file and associated XML templates.
In This Article
- When should this Receiver be used?
- When should this Receiver not be used?
- Are any additional items required to use this Receiver?
- List of Steps to Generate Nested HL7 Format
- Receiver Parameters
- Receiver Attribute Property Keys
- Configuration File
- Example Patient Story
- Example Configuration File
- Template Files
- Example Files
When should this Receiver be used?
- Any time you want to generate nested HL7 formatted output.
When should this Receiver not be used?
- Any time you want to generate another type of nested output.
Are any additional items required to use this Receiver?
- SegmentDataCreatorReceiver- Must be assigned to each Domain, except the Merge Domain.
- Note: The HL7SegmentMergeReceiver should only be assigned to the Merge Domain that merges the generated segments.
- Note: The HL7SegmentMergeReceiver should only be assigned to the Merge Domain that merges the generated segments.
- Configuration File - Used to determine the XML output format. This is typically named "config.xml" but can be named differently. This file will need to be created manually for this Receiver.
- Note: When named differently, the name must also be changed for the configName parameter within the Receiver.
- Note: When named differently, the name must also be changed for the configName parameter within the Receiver.
- Template Files - Referenced within the configuration file to determine the XML output format. These files will also need to be manually created for this Receiver.
List of Steps to Generate Nested HL7 Format
- Set up a Project with Domains, Parent-Child Relationships, and Scenarios.
- For each Domain except the Merge Domain, complete the following:
- Assign the SegmentDataCreatorReceiver and configure it accordingly.
- Create a Merge Domain with just an id Attribute
- Note: This may have already been done if Domains were imported.
- Add the HL7SegmentMergeReceiver to the Merge Domain and configure it, as discussed in this article.
- Create a Scenario Chain with all Domain Scenarios. Make sure the Merge Scenario is in the last position.
- Manually create a Configuration File as discussed in this article.
- Manually create the Template Files that are referenced by the Configuration File.
- Download the Scenario Chain to your local computer.
- Make sure the Configuration File and Template Files are located in the appropriate location on your local machine.
Receiver Parameters
The HL7SegmentMergeReceiver requires the following parameters to be defined. Items with an asterisk* are required.
- outputPath* - Defines the location to store the newly generated HL7 file(s).
- outputSubDirectory* - Defines the prefix name of subdirectories that are auto-created under the outputPath and then appended with a number.
- configName* - Defines the name of the configuration file.
- configPath*- Defines the location where the configuration file is to be stored.
- configSubDir - Defines the subdirectory under the configPath directory where the configuration file is to be stored.
- segmentPath* - Defines the path to the Segment directory where all segment subdirectories can be found.
- segmentSubDirectory* - Defines the subdirectory under the segmentPath where segment files can be found.
- filesPerOutputSubDir* - Defines the number of files to be generated per output subdirectory.
- overrideFileName - Defines the fileName, which will override the fileName provided in the configuration file.
- deleteOutputSubDir - Defines whether to delete the generated or an existing outputSubDir or not during the execution of the Scenario.
Receiver Attribute Property Keys
There are no property keys necessary for this Receiver.
Configuration File
The configuration file defines the following elements of information:
fileNameSegments - contains subelements that define how the file names will be created for each HL7 generated document.
templateFiles - contains subelements that define the template file to read and an optional segment to read for the merge process.
segments - contains nested segments which define the nesting of the templates that will define the HL7 output.
Example Patient Story
The examples given below will be based on the generation of segmented data for eight Domains. There are eight Domains that represent the following hierarchy in parent-child relationships:
- HeaderRecordDomain is the Root Domain
- PatientRecordDomain is a child of the HeaderRecordDomain
- OrderRecordDomain is a child of the PatientRecordDomain
- ResultRecordDomain is a child of the OrderRecordDomain
- CommentRecordDomain is a child of the ResultRecordDomain
- AddendumRecordDomain is a child of the CommentRecordDomain
- ReissuedReportRecordDomain is a child of the ResultRecordDomain
- BatchTrailRecordDomain is a trailer Domain
Each Domain will use a SegmentCreatorReceiver to generate segmented data output with referential integrity with regard to parent-child relationships. The last Domain, Merge, will also use an HL7SegmentMergeReceiver to merge the segmented data generated for each Domain into one or more nested HL7 formatted output files.
Nine Scenarios will be created, out of which Eight Scenarios will be containing the instruction on how much-segmented data to generate for each Domain, and the last Scenario will merge the segments together to generate the output.
Lastly, the Scenarios can be chained together so that they can be run with one command instead of eight separate commands.
Example Configuration File
This is an example configuration file and is defined to allow eight segment files to be merged into one or more HL7 formatted nested output files. The format of the segmented data must produce nested output which meets the following rules:
- There must be three header records generated, and each to its own nested HL7 formatted file.
- Each header record must have one patient record
- Each patient record must have one order record
- Each order record must have three result record
- Each result record must have three comment record
- Each comment record must have six addendum record
- Each result record must have one reissued report record
- There must be one batch trail record generated for each batch, i.e., to the last HL7 formatted file.
The XML configuration file
The example configuration file defines the following information.
FileNameSegments
The subelements will produce a file naming convention that looks like the following:
- ASTMPHP-2020010603-1.xml
- ASTMPHP-2020010603-2.xml
- ASTMPHP-2020010603-3.xml
TemplateFiles
The following template files will be loaded and used to create the XML output when merged with segment data.
- HeaderRecordTemplate.xml
- PatientRecordTemplate.xml
- OrderRecordTemplate.xml
- ResultRecordTemplate.xml
- CommentRecordTemplate.xml
- AddendumRecordTemplate.xml
- ReissuedReportRecordTemplate.xml
- BatchTrailerRecord.xml
SegmentFiles
The following segment files will be loaded, and their data used in the merge process.
HeaderRecordSegment.xml
PatientRecordSegment.xml
OrderRecordSegment.xml
ResultRecordSegment.xml
CommentRecordSegment.xml
AddendumRecordSegment.xml
ReissuedReportRecordSegment.xml
BatchTrailerSegment.xml
Segments
The nested segments determine the sequence and structure of the nested XML output.
Template Files
Each template file below represents a block of XML elements used for merging with segment data that, combined together, will create a nested HL7 formatted file.
HeaderRecord Template
This template will be used for data segment merging with <segment name="headerRecord">
PatientRecord Template
This template will be used for data segment merging with <segment name="patientRecord">
OrderRecord Template
This template will be used for data segment merging with <segment name="orderRecord">
ResultRecord Template
This template will be used for data segment merging with <segment name="resultRecord">
CommentRecord Template
This template will be used for data segment merging with <segment name="commentRecord">
AddendumRecord Template
This template will be used for data segment merging with <segment name="addendumRecord">
ReissuedReportRecord Template
This template will be used for data segment merging with <segment name="reissuedReportRecord">
BatchTrailRecord Template
This template will be used for data segment merging with <segment name="batchTrailRecord">
Example Files
All of the example files below were generated by GenRocket.
Example merged nested XML file
The following is an example of a merged XML file for the first header record generated.
Example Segment Files
The following are eight example segmented data files used to generate the merged nested HL7 formatted files.
HeaderRecordSegment.xml
This file will contain three segments, each having one data element containing the header record attributes, a loopCount equal to one, and no parentId since the header record is the root Domain and does not have a parent Domain.
PatientRecordSegment.xml
This file will contain three segments, each having three data elements containing the patient record attributes, a loopCount equal to three, and a parentId given each set of patient record referential integrity to a header record defined within HeaderRecordSegment.xml.
OrderRecordSegment.xml
This file will contain three segments, each having the following data elements containing the user attributes, a loopCount equal to three, and a parentId given each set of order record referential integrity to a given patient record defined within PatientRecordSegment.xml.
ResultRecordSegment.xml
This file will contain seven segments, each having one data element containing result record attributes, a loopCount equal to 3, and a parentId given each order record referential integrity to a given order record defined within OrderRecordSegment.xml.
CommentRecordSegment.xml
This file will contain twenty-seven segments, each having one data element containing comment record attributes, a loopCount equal to 3, and a parentId given each comment record referential integrity to a given result record defined within ResultRecordSegment.xml.
AddendumRecordSegment.xml
This file will contain hundred and sixty-two segments, each having one data element containing addendum record attributes, a loopCount equal to 6, and a parentId given each addendum record referential integrity to a given comment record defined within CommentRecordSegment.xml.
ReissuedReportRecordSegment.xml
This file will contain nine segments, each having one data element containing reissued record attributes, a loopCount equal to 1, and a parentId given each reissued record referential integrity to a given result record defined within ResultRecordSegment.xml.
BatchTrailerRecordSegment.xml
This file will contain one segment having one data element containing batch trail record attributes, a loopCount equal to 1 and no parentId since the batch trail record is the trailer Domain and does not have a parent Domain.