The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::HL7::Compare - compare two HL7 v2 messages against one another

SYNOPSIS

        use App::HL7::Compare;

        my $stringified = App::HL7::Compare->new(
                files => [
                        'filename.hl7',
                        \$file_content,
                ],
        )->compare_stringify;

        print $stringified;

DESCRIPTION

This module contains routines for parsing, comparing and generating output for HL7 v2 (pipe-separated) messages. Such comparison can be useful for determining what's missing from a message, which may not be immediately obvious (depending on message complexity).

Output format

MSH segments are automatically skipped and not included in the comparison. The output lines are as follows:

        SEGM.1[1][2][3]: val1 => val2

Where:

  • SEGM.1 is the same of the segment and its number. If there are more segments of this type the number will distinguish that.

  • [1][2][3] is the path in the segment. The numbers are: field, component, subcomponent. The list may be shorter if there are no more subdivisions.

  • val1 => val2 are the values present in the first and the second message.

Options

files

The list of files to parse. Must consist of two files. Each can be either a plain string (a filename) or a reference to a string (a file's contents).

exclude_matching

Optional, boolean, true by default. If the value is the same, line is excluded from the comparison.

message_opts

Optional, hash reference, empty by default. Additional constructor parameters for App::HL7::Compare::Parser::Message.

Methods

compare

Returns the comparison in arrayref format.

compare_stringify

Returns the comparison in string format.

TODO

Decoding escaped HL7 characters in App::HL7::Compare::Parser::Subcomponent.

SEE ALSO

App::HL7::Dump

AUTHOR

Bartosz Jarzyna <bbrtj.pro@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2023 by Bartosz Jarzyna

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.