Professional Documents
Culture Documents
Accepted Manuscript Vietnam Journal of Computer Science
Accepted Manuscript Vietnam Journal of Computer Science
Accepted Manuscript
Vietnam Journal of Computer Science
DOI: 10.1142/S2196888819500258
To be cited as: Dinh Tuyen Hoang, In Keun Lee, Dosam Hwang, Version-Compatible
HL7 Parser Based on Object-Oriented Design, Vietnam Journal of Com-
puter Science, doi: 10.1142/S2196888819500258
This is an unedited version of the accepted manuscript scheduled for publication. It has been uploaded
in advance for the benefit of our customers. The manuscript will be copyedited, typeset and proofread
before it is released in the final form. As a result, the published copy may differ from the unedited
version. Readers should obtain the final version from the above link when it is published. The authors
are responsible for the content of this Accepted Article.
T
Accepted manuscript to appear in VJCS
IP
CR
Vietnam Journal of Computer Science
World Scientific Publishing Company
US
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
AN
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
In Keun Leeb
b
Daegu Metropolitan Transit Corporation,
Daegu, Korea
inkeunlee@gmail.com
Dosam Hwanga,*
DM
a
Department of Computer Engineering, Yeungnam University,
Gyeongsan-si, Gyeongsangbuk-do, Korea
dshwang@yu.ac.kr
International standards for the exchange of healthcare information, known as Health Level Seven
(HL7), were developed for the interoperability of healthcare information systems. Because of HL7’s
complex structure and syntax, HL7 messages are processed by computer software. HL7 defines that,
when the version is updated, it should be compatible with the previous version. However, most of
the HL7 interface software that is currently in development does not consider the version
TE
compatibility of HL7 messages. Instead, a separate conversion software module has been used to
handle the version compatibility of HL7 messages for the healthcare information system. However,
such a method is inefficient, because it requires several hours and incurs a huge cost. Therefore, in
this study, an HL7 parser was developed that not only supports backward compatibility with older
versions in accordance with the version compatibility definition of the HL7 V2 messages but also
guarantees forward compatibility with newer versions to enhance its utilization. The developed
parser was used to test conversion between different versions of HL7 V2 messages, which were
created to transmit information from one healthcare device to another. Through this test, the
EP
1
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Vietnam Journal of Computer Science
World Scientific Publishing Company
1. Introduction
US
exchange information between healthcare systems that have been built independently by
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
2
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Version-Compatible HL7 Parser Based on Object-Oriented Design
structures of segments and components from the previous version. Hence, HL7
guarantees backward compatibility based on the version compatibility definition.4 (e.g., a
message based on V2.3 will be understood by an application that supports V2.6). In other
words, because the structure of a newer version (e.g., V2.6) includes the structure of
anolder version (e.g., V2.3) in HL7, it should be possible to convert a message of the
newer version to a message of the older version. However, in reality, the structures of
US
HL7 messages between different versions are partly different, so the existing parsers have
not taken the version compatibility into consideration. In addition, a separate conversion
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
module based on the version of the HL7 messages has been developed and is being used
to support the version compatibility. To solve such a problem, previous studies6-8 have
proposed, from an object-oriented perspective, a conceptual design of a parser that can
convert from a newer version to anolder version; however, they could not provide
specific methods to implement a parser based on their design.
AN
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
the superclass of “V25.ADT_A01” class in Fig. 1. Once the message has been converted
to the newer version (V2.5), the instance of subclass "V25.ADT_A01" performs the
creation of new messages. Therefore, message and component classes for all versions are
interrelated in the HL7 parser designed based on the concept of object-oriented design
(shortly OOD).
TE
EP
3
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Hoang et al.
US
instance of the class for the older version, as shown in Fig. 1, HL7 messages of all
versions can be processed using only the instance of the lowest subclass. However, unlike
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
the previous research8, in this study, the lowest subclass was defined not to have a
version specified for it, as shown in Fig. 2. The parser was designed to process messages
of all versions by utilizing the lowest subclass.
AN
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
DM
TE
For example, when processing the ADT^A01 message of HL7 V2.4, the parser first
EP
checks the actual version of the message, and the instance of the "V24.ADT_A01" class
for the corresponding version processes the message. The “V24.ADT_A01” class
contains the instance of the "MSH" class. Here, the request is made to "V25.MSH"—the
instance of the lowest subclass—to process the message, and the instance of "V24.MSH"
class processes the HL7 message according to the version of the actual message. The data
C
4
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Version-Compatible HL7 Parser Based on Object-Oriented Design
of the HL7 message that have been processed through this procedure are stored in the
instance of the class associated with the corresponding version.
However, if a new system is implemented using the parser library developed
following the design of the previous study8, the developer would produce the software by
using the lowest subclass (e.g., V25.ADT_A01 class in Fig. 2) provided by the library. If
a parser library that includes the HL7 messages of a new version is provided, then the
US
system developer encounters the problem of having to modify the existing software. For
example, if the code is written using the HL7 parser library for V2.4, as shown in Fig.
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
3(a), but later the HL7 parser library updated with V2.5 is used, then the instance of the
lowest subclass must be redefined, as shown in Fig. 3(b).
AN
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
(a) part of code using previous library (b) part of code using updated library
common.ADT_A01 adt_a01;
...
common.MSH msh = adt_a01.getMSH();
Fig. 4. Example of code using the library based on the proposed structure
The HL7 parser has been designed to parse messages in a bottom-up manner to support
backward compatibility. To be specific, the following method is used to process an HL7
message: (1) the version of the original HL7 message is checked, (2) the superclass
method is called by the overridden decode() method until the instance of the class
associated with the version of the original message is reached, and (3) the message is
processed by the instance of the class corresponding to the version of the original
message. For example, if the ADT^A01 message of HL7 V2.4 is processed as in Fig. 5
EP
and Fig. 6, the type and version of the message are first checked. Then, the instance of
"common.ADT_A01" class, which is the lowest subclass, is created regardless of the
version, and parsing is performed. In the parser, the message is processed by the instance
of the "V24.ADT_A01" class that corresponds to the actual version of the message. The
“V24.ADT_A01” class contains the instance of the "MSH" class. Here also, the request is
made to the instance of the lowest subclass, "common.MSH," and the HL7 message is
C
5
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Hoang et al.
US
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
AN
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
For example, to create a message of a new version by converting the original message
of the newer version (V2.4) to the message of the older version (V2.3), as shown in Fig. 7
and Fig. 8, the following procedure is used: (1) after setting the version (V2.3), the
instance of the lowest subclass "common.ADT_A01" calls the encode() method, (2) the
encode() method of the “V23.ADT_A01” class, which is the superclass of the
“V24.ADT_A01” class, is called according to the set version, and (3) the encode()
C
6
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Version-Compatible HL7 Parser Based on Object-Oriented Design
methods of "V23.MSH" and "V23.CE" classes are called using the same method to create
the HL7 message of the set version. The method overriding of object-oriented design is
utilized to support backward compatibility.
US
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
AN
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
Fig. 8. Method diagram for encoding of an HL7 message for backward compatibility
However, a structure that can process HL7 messages in a bottom-up manner, as well
as a method that can process HL7 messages in a top-down fashion, is needed to design an
effective parser. In other words, implementing a parser that guarantees forward
EP
7
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Hoang et al.
the class associated with the set version of the message creates the message by calling the
encode() method.
For example, as shown in Fig. 9 and Fig. 10, the process to convert the message of
the older version (V2.4) to the message of the newer version (V2.5) is as follows: (1) the
instance of the lowest subclass "common.ADT_A01" calls the encode() method, (2) the
US
encode() method of the "V24.ADT_A01" class is called, which processed the original
HL7 V2.4 message, (3) the data stored in the "V24.ADT_A01" class instance are
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
converted to data defined in the "V25.ADT_A01" class, and the converted data are stored
in the "V25.ADT_A01" class instance according to the set version (V2.5) for message
conversion, and (4) the message of the set version is output by calling the encode()
method of the "V25.ADT_A01” class again. This method uses casting in object-oriented
programming to support forward compatibility. In other words, a superclass instance
AN
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
cannot call the instance of a subclass directly. Therefore, data stored in the superclass
instance are converted to the data type of the subclass instance by forcing the encode()
method of the subclass to be called through casting the superclass instance into the
subclass instance.
DM
8
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Version-Compatible HL7 Parser Based on Object-Oriented Design
US
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
AN
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
Fig. 10. Method diagram for encoding of an HL7 message for forward compatibility
Fig. 11. Flow chart for converting HL7 message as given version
C
9
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Hoang et al.
As shown in Table 1, the number of HL7 message types and components has steadily
increased by version. The parser developed in this study processes HL7 messages of all
versions. Therefore, the number of classes that need to be created for messages,
US
segments, and components for all versions of HL7 messages amounts to approximately
6000. In addition, because the developed parser supports conversion of HL7 messages
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
from one version to another, the classes that comprise the parser are related to each other.
Version 2.1
AN
2.2 2.3 2.3.1 2.4 2.5 2.5.1 2.6 2.7 Total
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
Total 211 336 677 666 803 906 905 1,001 969 6,474
DM
In the process of developing the HL7 parser based on object-oriented design, the
number of classes that need to be implemented according to the proposed design amounts
to several thousand, as shown in Table 1. Therefore, implementing the parser according
to the proposed design requires many staff resources and much time. In addition, to
modify the code of a class related to a specific version of HL7 messages, the structure
and code of all related classes have to be modified as well. In other words, if a small
modification is needed for the superclass, its subclasses and many other related class files
must also be modified.
In this study, "Class File Maker" was implemented to create Java class files
automatically according to the predefined rules, as shown in Fig. 12(a), to implement
TE
effectively the HL7 parser comprising several thousand classes. The relationship between
the HL7 message structures of different versions was set up as a database of tables, as
shown in Fig. 12(b), and codes for classes related to HL7 messages and their components
were composed as a template shown in Fig. 12(c). The Java class files were generated
automatically by combining these tables and templates.
EP
C
10
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Version-Compatible HL7 Parser Based on Object-Oriented Design
US
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
AN
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
The method for automatically implementing the parser can be explained using the
following example: (1) HL7-related data provided by a previous report1 are converted
into a table format, and the HL7 DB is set up using these tables, (2) class code templates
in Fig. 12(c) are created to implement automatically class files (e.g., ADT_A01.java)
related to HL7 messages (e.g., ADT_A01), class files (e.g., MSH.java, PID.java) related
to segments (e.g., MSH, PID) composing the HL7 messages, and class files (e.g.,
CX.java, HD.java) related to components (e.g., CX, HD) composing the segments, and (3)
class files that constitute the HL7 parser are created automatically by the "Class File
Maker" in Fig. 12(a) by referring to the HL7 DB in Fig. 12(b) based on the characteristics
TE
of the HL7 messages, segments, and components for each version in Table 1.
This method is useful for the development and modification of the HL7 parser,
because codes for several thousand class files are modified in a batch when the HL7
parser is modified, and a minimum of 1 min is needed to verify the test results for the
modified parser.
EP
To evaluate the version compatibility function of the developed parser, the ORU^R01
messages of various versions (V2.1, V2.2, V2.3, V2.3.1, V2.4, V2.5, V2.5.1, V2.6, V2.7)
were used to conduct the compatibility experiment. The ORU^R01 message is an
automatic observation message (unsolicited transmission of an observation message) and
C
11
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Hoang et al.
is used for transmitting vital signs, such as blood pressure, blood glucose level, and body
composition, measured using the personal health devices. This message is composed of
segments such as MSH (Message Header), PID (Patient Identification), OBR
(Observation Request), and OBX (Observation Result). The compatibility experiment
was conducted using 200 HL7 V2.5 messages (ORU^R01)9, which were created when
US
the blood glucose level, blood pressure, and body composition measured using the U-
Healthcare system for 11 inpatients at the endocrine internal medicine department of K-
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
university hospital in 2012 were transmitted to the Medical Information System. Table 2
shows the part of the ORU^R01 message used in the experiment. To verify the backward
compatibility of the developed parser, the HL7 V2.5 message was converted to V2.1,
V2.2, V2.3, V2.3.1, and V2.4. Furthermore, a test was performed to convert the HL7
V2.5 message to V2.5.1, V2.6, and V2.7 to verify the forward compatibility. Through the
AN
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
test, whether an error occurred during the conversion of the HL7 message between
versions and the reliability of the converted messages were verified. Table 3 shows the
results of the experiment for converting the HL7 messages between versions by using the
developed parser. The experimental results verified that the message was successfully
converted to each version without an error.
DM
MSH|^~\&|Gateway|BIT|SeniCare|MIPTH|20120209181657||ORU^R01^ORU_R01|2
0120209181657-0|P|2.5
PID|||61:A2:02:07:00:01:04:E0||USER
OBR||1|1|29247-8^VITAL SIGNS^LN||20120209181657|20120209181657
OBX|1|NM|8462-4^INTRAVASCULAR DIASTOLIC:PRES^LN||83|mm(hg)|60-
90||||F
Transmission
OBX|2|NM|8479-8^INTRAVASCULAR SYSTOLIC:PRES^LN||117|mm(hg)|100-
blood 160||||F
pressure OBX|3|NM|8867-4^HEART BEAT RATE^LN||97|/min|60-100||||F
OBX|4|ST|8357-6^BLOOD PRESSURE METHOD^LN||MANUAL BY UA-
TE
767PBT||||||F
OBX|5|ST|8886-4^HEART RATE METHOD^LN||MANUAL BY UA-767PBT||||||F
MSH|^~\&|SeniCare|MIPTH|Gateway|BIT|20120209181700||ORU^R01^ORU_R01|2
ACK 0120209181657-0-R|P|2.5
MSA|AA|20120209181657-0
MSH|^~\&|Gateway|BIT|SeniCare|MIPTH|20120209181400||ORU^R01^ORU_R01|2
0120209181400-0|P|2.5
Transmission PID|||61:A2:02:07:00:01:04:E0||USER
EP
12
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Version-Compatible HL7 Parser Based on Object-Oriented Design
MSH|^~\&|Gateway|BIT|SeniCare|MIPTH|20120206121848||ORU^R01^ORU_R01|2
0120206121848-0|P|2.5
PID|||61:A2:02:07:00:01:04:E0||USER
Transmission OBR||1|1|10210-3^PHYSICAL FINDINGS^LN||20120206121848|20120206121848
body OBX|1|NM|18833-4^BODY WEIGHT:MASS^LN||64.5|kg|0-120||||F
composi- OBX|2|NM|39156-5^BODY MASS INDEX:RATIO^LN||22.2|kg/m2|18.5-25.0||||F
tion OBX|3|NM|41982-0^BODY FAT PERCENTAGE:MFR^LN||20.0|%|10.0-20.0||||F
US
MSH|^~\&|SeniCare|MIPTH|Gateway|BIT|20120206121850||ORU^R01^ORU_R01|2
ACK 0120206121848-0-R|P|2.5
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
MSA|AA|20120206121848-0
AN
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
Version 2.1 2.2 2.3 2.3.1 2.4 2.5 2.5.1 2.6 2.7
Trans. Message 200 200 200 200 200 - 200 200 200
Error 0 0 0 0 0 - 0 0 0
Error Ratio 0% 0% 0% 0% 0% - 0% 0% 0%
and V2.3.1, it was confirmed that a new message is created by applying the component
rule for each version. However, in the case of PID, RFID-tag ID, which is expressed in 8
bytes in the original message, was written in 22 characters, because the RFID-tag ID was
expressed along with ":". During the process of converting the original message to V2.3.1
and V2.7, “61:A2:02:07:00:01:04:E0” was modified to “61:A2:02:07:00:01:04” based on
the limitation of the PID-4 component length because the maximum length of the PID-4
(Alternate Patient ID) is limited to “≤20”. Therefore, it was verified that the PID-4 data
of the original message had to be modified to less than or equal to 20 characters based on
the limitation of the PID-4 component length.
TE
Table 4. Example of ORU^R01 message translated from V2.5 to V2.3.1 and V2.7
OBX|1|NM|18833-4^BODY WEIGHT:MASS^LN||64.5|kg|0-120||||F
OBX|2|NM|39156-5^BODY MASS INDEX:RATIO^LN||22.2|kg/m2|18.5-25.0||||F
OBX|3|NM|41982-0^BODY FAT PERCENTAGE:MFR^LN||20.0|%|10.0-20.0||||F
MSH|^~\&|Gateway|BIT|SeniCare|MIPTH|20120209181400||ORU^R01^ORU_R01|201202091
81400-0|P|2.3.1
2.3.1 PID|||61:A2:02:07:00:01:04||USER
OBR||1|1|10210-3^PHYSICAL FINDINGS^LN||20120206121848|20120206121848
OBX|1|NM|18833-4^BODY WEIGHT:MASS^LN||64.5|kg|0-120||||F
C
13
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Hoang et al.
US
OBX|1|NM|18833-4^BODY WEIGHT:MASS^LN||64.5|kg|0-120||||F
OBX|2|NM|39156-5^BODY MASS INDEX:RATIO^LN||22.2|kg/m2|18.5-25.0||||F
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
5. Conclusion
In this study, an HL7 message parser that supports version compatibility was designed
AN
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
based on the object-oriented design. Based on the design, several thousand class files
need to be created. By creating these files automatically, a method of quickly
implementing the HL7 message parser was proposed. By using the proposed method, a
parser was implemented that can convert HL7 messages between eight different versions.
Additionally, the usefulness of the developed HL7 parser was verified through an HL7
version compatibility experiment by using data exchanged between healthcare devices. It
needs to be conducted to test on parsing all kinds of HL7 messages and converting
between all versions of the messages in order to verity the usefulness of the developed
DM
HL7 parser completely. However, we remain it for next study because it takes long time
to finish the test perfectly.
To apply the developed HL7 parser to healthcare information systems, further study
is needed on the implementation of a method to enable the system developer to input and
output effectively data stored in the objects by using the library. Additionally, a study is
needed to develop a method for implementing an HL7 parser that can incorporate the
characteristics of messages or components (e.g., outputting the set version of the message
from the MSH segment) that are difficult to implement in a batch by using the template
according to the segment or component.
TE
Acknowledgments
This research was supported by Basic Science Research Program through the National
Research Foundation of Korea (NRF) funded by the Ministry of Science, ICT & Future
Planning (2017R1A2B4009410).
EP
References
14
AC
T
Accepted manuscript to appear in VJCS
IP
CR
Version-Compatible HL7 Parser Based on Object-Oriented Design
3. H.S. Kim, H. Cho, and I.K. Lee, The Development of a Graphical User Interface Engine for the
Convenient Use of the HL7 Version 2.x Interface Engine, Healthcare informatics research,
17(4) (2011) 214–223.
4. S.M. Lee, J.T. Song, I.K. Kim, H. Cho, and Y.S. Kwak, The Design of the HL7 V2.4 Message
Interface Engine, inProceedings KISC 2003 Autumn Annual Conference, 2003, pp. 781-783,
2003.
5. The Open Source HL7 API for Java –HAPI (2019), https://hapifhir.github.io/hapi-hl7v2.
US
6. H.S. Park, H.S. Kim, and H. Cho, Development of Compatible Health Level 7 Parser,
Journalof the Korea Academia-Industrial cooperation Society, 15(7) (2014) 4290-4300.
by 5.188.217.244 on 09/18/19. Re-use and distribution is strictly not permitted, except for Open Access articles.
7. I.K. Lee, and D. Hwang, Design of a Version-Compatible HL7 Parser, in Proceedings of the
29th Annual Conference on Human and Cognitive Language Technology, 2017, pp. 201-202.
8. I.K. Lee, and D. Hwang, Development of a Version-Compatible HL7 Parser, in Proceedings of
the 30th Annual Conference on Human and Cognitive Language Technology, 2018.
9. I.K. Lee, H.S. Kim, and H. Cho, Development of an Ubiquitous Healthcare System based on
Health Information Exchange Standards, Journal of Korean Institute of Intelligent Systems,
AN
Vietnam J. Comp. Sci. Downloaded from www.worldscientific.com
22(3)(2012) 273-280.
DM
TE
EP
C
15
AC