HL7v2.x data extraction method, terminal device and storage medium
By constructing a tree-structured expression for HL7v2.x data, the problem of high development costs caused by the complexity of HL7v2.x message structures was solved, and the flexibility and efficiency of data extraction were improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 纳龙健康科技股份有限公司
- Filing Date
- 2023-05-11
- Publication Date
- 2026-05-19
AI Technical Summary
The existing HL7v2.x message structure is complex, which requires developers to write a lot of code for parsing and adjustment, increasing communication and deployment costs, and lacking flexible data extraction methods.
Expressions are constructed using a tree structure, which is built by concatenating the identifiers of groups, segments, domains, components, and sub-components. Combined with query conditions, data extraction is achieved. The logic code is separated from the data extraction, allowing on-site implementation engineers to configure the data logic themselves.
It improves the flexibility and efficiency of the program, reduces reliance on developers, allows engineers to modify the data extraction logic themselves, and reduces communication and deployment costs.
Smart Images

Figure CN116578748B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data extraction, and in particular to an HL7v2.x data extraction method, terminal device, and storage medium. Background Technology
[0002] As hospital information systems become more sophisticated, information exchange between various heterogeneous systems is becoming more frequent. HL7v2.x (including versions from v2.1 to 2.8) is widely used as a standardized health information transmission protocol for inter-system interaction.
[0003] Due to the complexity and size of the HL7v2.x message structure (containing 256 events, 116 message types, 139 segments, 55 data types, and 408 data dictionaries), developers often need to write a large amount of code to parse and extract data from messages. If on-site requirements change and field assignments need to be adjusted, implementation engineers also need to communicate with developers to have them modify the code and redeploy, increasing communication and deployment costs and wasting time and effort. Because of the complexity of the HL7v2.x structure, message segments with the same name often have different meanings when appearing in different locations, and multiple message segments can be combined and repeated, there is currently no single expression available on the market that can be used to extract HL7v2.x data. Summary of the Invention
[0004] To address the aforementioned issues, this invention proposes an HL7v2.x data extraction method, terminal device, and storage medium.
[0005] The specific plan is as follows:
[0006] A data extraction method for HL7v2.x includes the following steps:
[0007] S1: Load HL7v2.x data and generate the corresponding tree structure;
[0008] S2: Determine the location of the data to be extracted from the tree structure;
[0009] S3: Based on the location of the data to be extracted, construct the expression corresponding to the data to be extracted in the top-to-bottom order of the tree structure. The expression is constructed by splicing together the identifiers corresponding to the required structures in the order of the five structures in the tree structure: group, segment, domain, component and sub-component.
[0010] S4: Associate the data to be extracted from the business process with the constructed expression;
[0011] S5: When the business program receives HL7v2.x data, it performs a data query from the HL7v2.x data based on the expression corresponding to the data to be extracted, and obtains the query result of the data to be extracted.
[0012] Furthermore, different identifiers in the expression are separated by "-".
[0013] Furthermore, when the domain containing the data to be extracted contains multiple components with the same structure, these components with the same structure in the domain are treated as an array, represented by square brackets []. The data inside the square brackets [] represents the index of the component containing the data to be extracted.
[0014] Furthermore, the expression also includes an expression with query conditions, used when the ordinal number of the component in the domain where the data to be extracted is located is uncertain. The query conditions are used to determine the ordinal number of the component in the domain where the data to be extracted is located, and are represented by component identifier = component value.
[0015] Furthermore, the identifiers corresponding to domains, components, and subcomponents are represented by Arabic numerals corresponding to the ordinal numbers of the domains, components, and subcomponents.
[0016] Furthermore, the required structure is determined based on the location of the data to be extracted. If it belongs to the data under a group, then the starting structure of its expression is the group; if it does not belong to the data under a group, then the starting structure of its expression is the segment.
[0017] Furthermore, when the data to be extracted is located within a child component, the required structure for the expression includes the child component; otherwise, it does not.
[0018] Furthermore, steps S4 and S5 specifically include: associating the location where the data to be extracted needs to be displayed in the business program with the expression corresponding to the data to be extracted; when the business program receives HL7v2.x data, it performs a data query from the HL7v2.x data based on the expression corresponding to the data to be extracted, and displays the query result at the location where the data to be extracted needs to be displayed in the business program.
[0019] An HL7v2.x data extraction terminal device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the method described above in the embodiments of the present invention.
[0020] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method described above in the embodiments of the present invention.
[0021] The present invention adopts the above technical solution, which solves the problem that the existing HL7v2.x data extraction cannot be configured, improves program flexibility, and increases work efficiency. Attached Figure Description
[0022] Figure 1 The diagram shown is a flowchart of Embodiment 1 of the present invention.
[0023] Figure 2 The diagram shown illustrates the loading of HL7v2.x data using 7Edit in this embodiment.
[0024] Figure 3 The diagram shown illustrates the process of associating the data to be extracted with the expression in this embodiment.
[0025] Figure 4 The image shown is a schematic diagram of the business program interface in this embodiment. Detailed Implementation
[0026] To further illustrate the various embodiments, the present invention provides accompanying drawings. These drawings are part of the disclosure of the present invention, primarily used to illustrate the embodiments, and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these drawings, those skilled in the art should be able to understand other possible implementations and the advantages of the present invention.
[0027] The present invention will now be further described in conjunction with the accompanying drawings and specific embodiments.
[0028] Example 1:
[0029] In HL7, a message is the basic unit for data exchange between systems, and each message has its own message type.
[0030] A message consists of multiple segments, each with a name that defines its content or function. For example, a message might contain segments such as: Message Header (MSH), Patient Identifier (PID), and Patient Appointment (PV1). The first segment in a message is always the Message Header, which specifies the sending and receiving program names, message type, and a unique message ID number. The composition of subsequent segments is determined by the message type. Adjacent segments with a relationship can form a group, such as... Figure 2 PATIENT in the context.
[0031] A segment consists of multiple fields, each separated by "|". The "|" cannot be omitted even if the corresponding field contains no data. Each field can contain one or more components with the same structure, separated by "~". Components are divided into simple type components and composite type components. Simple type components represent simple information, such as gender which only requires a description of male or female, and their content can be primitive data types (e.g., strings or numbers). Composite type components consist of multiple simple type components or nested components to describe complex information, such as address information which includes country, city, street, and postal code. Simple type components or nested components within a composite type component are separated by the ^ character. Nested components consist of multiple sub-components. For example, a component describing a department can nest two simple type components (department number and department name) to jointly describe department information. Sub-components are separated by the & character, and sub-components must be primitive data types (e.g., strings or numbers).
[0032] Based on the above message structure, this embodiment of the invention provides an HL7v2.x data extraction method, such as... Figure 1 As shown, the method includes the following steps:
[0033] S1: Load HL7v2.x data and generate the corresponding tree structure.
[0034] This embodiment uses the third-party tool 7Edit for loading. 7Edit is an HL7 message utility that can parse HL7 messages into a tree structure through a graphical interface, such as... Figure 2 The left-hand workspace is shown in the diagram. Other tools may be used for loading in other embodiments, which are not limited here.
[0035] S2: Determine the location of the data to be extracted from the tree structure.
[0036] If the data to be extracted is Figure 2 The data "123434" can be represented in the middle. Figure 2 Select the location of the tree structure on the left.
[0037] S3: Based on the location of the data to be extracted, construct the expression corresponding to the data to be extracted in a top-down order of the tree structure. The expression is constructed by concatenating the identifiers corresponding to the required structures, in the order of the five structures in the tree structure: group, segment, domain, component, and sub-component.
[0038] The following describes the principles for constructing the expressions set in this embodiment.
[0039] Different identifiers in an expression are separated by "-".
[0040] The identifiers for domains, components, and subcomponents are represented by Arabic numerals corresponding to the ordinal numbers of the domains, components, and subcomponents.
[0041] When the domain containing the data to be extracted contains multiple components with the same structure, these components are treated as an array, represented by square brackets []. The data inside the brackets [] represents the index of the component containing the data to be extracted (i.e., which component it belongs to among those with the same structure). It should be noted that when the components with the same structure are composite type components, the total number of simple type components and nested components within the composite type component is the same. Components with the same structure can also all be simple type components. When the domain containing the data to be extracted contains only one component, the index of the component formed by the square brackets [] is not needed.
[0042] When the domain containing the data to be extracted contains multiple components with the same structure, and the index of the component containing the data to be extracted is uncertain, the aforementioned component indexing method cannot be directly applied. To solve this problem, this embodiment uses an expression with query conditions. The query conditions are used to determine the index of the component containing the data to be extracted (i.e., to replace the index of the component containing the data to be extracted). The query conditions are represented by component identifier = component value. In this embodiment, the component value is represented by a character enclosed in single quotes.
[0043] The required structure is determined based on the location of the data to be extracted. If it belongs to the data under a group, the starting structure of its expression is the group; if it does not belong to the data under a group, the starting structure of its expression is the segment.
[0044] When the data to be extracted is located within a child component, the required structure for the expression includes the child component; otherwise, it does not.
[0045] The following is based on Figure 2 The data to be extracted is presented in two expressions:
[0046] The first type is the regular expression “PATIENT-PID-3[2]-1”, where PATIENT is the group identifier, PID is the segment identifier, “3” is the domain identifier, indicating the third domain of the segment, “[2]” is the component index identifier, applicable to the case where the domain includes multiple components with the same structure, indicating the component with array index 2 in the third domain (the second component), “3[2]” is followed by “1”, indicating that the component with array index 2 in the third domain is a composite type component, and “1” is the identifier of which simple type component in the composite type component, indicating the first simple type component in the composite type component. The meaning of the expression “PATIENT-PID-3[2]-1” is: the first simple type component of the second component (a composite type component) in the third domain of the PID segment of the PATIENT group.
[0047] The second type is the expression with a query condition: "PATIENT-PID-3[-5='CZ']-1", where "3[-5='CZ']" represents the composite type component in the third field that satisfies the condition that the value of the fifth simple type component it contains is "CZ". The expression "PATIENT-PID-3[-5='CZ']-1" means: the first simple type component among the composite type components in the third field of the PID segment of the PATIENT group that satisfies the condition that the value of the fifth simple type component it contains is "CZ".
[0048] S4: Associate the data to be extracted from the business process with the constructed expression.
[0049] The association method can be any method, and no limitation is made here. The association process in this embodiment is as follows: Figure 3 As shown.
[0050] S5: When the business program receives HL7v2.x data, it performs a data query from the HL7v2.x data based on the expression corresponding to the data to be extracted, and obtains the query result of the data to be extracted.
[0051] In one embodiment, business users often need to display the data to be extracted directly at the corresponding location in the business program, such as... Figure 4 As shown, therefore, in steps S4 and S5, the position where the data to be extracted needs to be displayed in the business program can be associated with the expression corresponding to the data to be extracted; when the business program receives HL7v2.x data, it performs a data query from the HL7v2.x data based on the expression corresponding to the data to be extracted, and displays the query result in the position where the data to be extracted needs to be displayed in the business program.
[0052] This invention uses configured expressions to parse and extract HL7v2.x data, separating logic code from data extraction. Developers can focus on writing business logic code, while on-site implementation engineers can configure the HL7v2.x data extraction logic themselves without relying on developers. This division of labor allows for the development of business scenarios, and engineers can make modifications on their own even if on-site data extraction requirements change later.
[0053] Example 2:
[0054] The present invention also provides an HL7v2.x data extraction terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in the method embodiment described above in Embodiment 1 of the present invention.
[0055] Furthermore, as an executable solution, the HL7v2.x data extraction terminal device can be a computing device such as a desktop computer, laptop, handheld computer, or cloud server. The HL7v2.x data extraction terminal device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the above-described structure of the HL7v2.x data extraction terminal device is merely an example and does not constitute a limitation on the HL7v2.x data extraction terminal device. It may include more or fewer components than described above, or combine certain components, or different components. For example, the HL7v2.x data extraction terminal device may also include input / output devices, network access devices, buses, etc., and this embodiment of the invention does not limit this.
[0056] Furthermore, as an executable solution, the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. This processor is the control center of the HL7v2.x data extraction terminal device, connecting all parts of the HL7v2.x data extraction terminal device via various interfaces and lines.
[0057] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the HL7v2.x data extraction terminal device by running or executing the computer programs and / or modules stored in the memory and by calling the data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created based on the use of the mobile phone. In addition, the memory may include high-speed random access memory and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0058] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the methods described in the embodiments of the present invention.
[0059] If the modules / units integrated into the HL7v2.x data extraction terminal device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), and a software distribution medium, etc.
[0060] Although the invention has been specifically shown and described in conjunction with preferred embodiments, those skilled in the art should understand that various changes in form and detail may be made to the invention without departing from the spirit and scope of the invention as defined in the appended claims, all of which shall be within the scope of protection of the invention.
Claims
1. A data extraction method for HL7v2.x, characterized in that, Includes the following steps: S1: Load HL7v2.x data and generate the corresponding tree structure; the HL7v2.x data includes messages; the messages include multiple segments, each segment having a name that defines the content or function of the segment; Each segment comprises multiple fields; each field contains one or more structurally identical components that are separated from each other. The components include: simple type components and composite type components; composite type components include: multiple simple type components or nested components; the nested components are composed of multiple sub-components; S2: Determine the location of the data to be extracted from the tree structure; S3: Based on the location of the data to be extracted, construct the expression corresponding to the data to be extracted in a top-down order of the tree structure. The expression is constructed by concatenating the identifiers corresponding to the required structures in the order of the five structures in the tree structure: group, segment, domain, component, and sub-component. When the domain where the data to be extracted is located contains multiple components with the same structure, these components with the same structure in the domain are treated as an array and represented by square brackets []. The data inside the square brackets [] represents the index of the component where the data to be extracted is located. S4: Associate the data to be extracted from the business process with the constructed expression; S5: When the business program receives HL7v2.x data, it performs a data query from the HL7v2.x data based on the expression corresponding to the data to be extracted, and obtains the query result of the data to be extracted.
2. The HL7v2.x data extraction method according to claim 1, characterized in that: Different identifiers in an expression are separated by "-".
3. The HL7v2.x data extraction method according to claim 1, characterized in that: The expression also includes an expression with query conditions, used when the ordinal number of the component in the domain where the data to be extracted is uncertain. The query conditions are used to determine the ordinal number of the component in the domain where the data to be extracted is located, and are represented by component identifier = component value.
4. The HL7v2.x data extraction method according to claim 1, characterized in that: The identifiers for domains, components, and subcomponents are represented by Arabic numerals corresponding to the ordinal numbers of the domains, components, and subcomponents.
5. The HL7v2.x data extraction method according to claim 1, characterized in that: The required structure is determined based on the location of the data to be extracted. If it belongs to the data under a group, the starting structure of its expression is the group; if it does not belong to the data under a group, the starting structure of its expression is the segment.
6. The HL7v2.x data extraction method according to claim 1, characterized in that: When the data to be extracted is located within a child component, the required structure for the expression includes the child component; otherwise, it does not.
7. The HL7v2.x data extraction method according to claim 1, characterized in that: Steps S4 and S5 specifically include: associating the location where the data to be extracted needs to be displayed in the business program with the expression corresponding to the data to be extracted; when the business program receives HL7v2.x data, it performs a data query from the HL7v2.x data based on the expression corresponding to the data to be extracted, and displays the query result in the location where the data to be extracted needs to be displayed in the business program.
8. An HL7v2.x data extraction terminal device, characterized in that: It includes a processor, a memory, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the steps of the method as described in any one of claims 1 to 7.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.