Metadata mapping-based heterogeneous data template assignment and loop processing method and system

By using a metadata mapping approach, employing XPath/JPath parsers and CASEWHEN syntax, we have achieved unified parsing and standardized transformation of heterogeneous medical data, solving the problem of low efficiency in heterogeneous data processing and improving data processing efficiency and adaptability.

CN122173539APending Publication Date: 2026-06-09CHENGDU CHENGDIAN YIXING DIGITAL HEALTH SOFTWARE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHENGDU CHENGDIAN YIXING DIGITAL HEALTH SOFTWARE CO LTD
Filing Date
2026-03-06
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing technologies struggle to achieve unified parsing, mapping, and assignment of heterogeneous medical data, resulting in high development costs, significant maintenance difficulties, and a lack of flexible handling capabilities for loop nodes, leading to low data processing efficiency and severely hindering smooth cross-platform and cross-system interaction and in-depth applications.

Method used

A metadata-based approach is adopted, which uses XPath/JPath parsers to uniformly parse XML/JSON formats. Combined with CASEWHEN syntax and custom code matching logic, it enables unified parsing, flexible mapping, and loop processing of heterogeneous data, including node-by-node path information extraction, metadata query, field mapping, and loop assignment.

Benefits of technology

It achieves efficient unified parsing and standardized conversion of heterogeneous medical data, reduces development and maintenance costs, improves data processing efficiency, adapts to the diverse needs of complex data scenarios, and solves the problem of efficient processing of loop nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122173539A_ABST
    Figure CN122173539A_ABST
Patent Text Reader

Abstract

This application provides a method and system for heterogeneous data template assignment and loop processing based on metadata mapping. The method involves extracting and parsing a preset XML / JSON template, locating all target nodes, and confirming the node hierarchy and data type. It then extracts target metadata from the database using preset SQL statements based on externally input business parameters. Field mapping is performed between target nodes and target metadata, and the mapping logic is adjusted using the CASEWHEN syntax. Differentiated loop assignment is then performed on the child nodes of the loop nodes. This achieves unified parsing, flexible mapping, standardized conversion, and loop assignment of heterogeneous data such as XML and JSON, improving the efficiency and standardization of medical data exchange, and reducing development and maintenance costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of medical data interaction technology, and relates to a method and system for assigning and iteratively processing heterogeneous data templates based on metadata mapping. Background Technology

[0002] In the field of medical data exchange, data interaction standards are characterized by diversity and heterogeneity. Currently, HL7V3 has been established as a standard specification for medical data interaction, but medical device manufacturers and software service providers generally adopt custom interaction standards based on their own product architectures. Data formats cover various types such as XML and JSON, and there are significant differences in field definitions, encoding rules, and data structures.

[0003] This heterogeneous data situation leads to many pain points in the medical data interaction process: On the one hand, data of different formats and standards are difficult to parse and process uniformly, requiring the development of separate adaptation programs for each standard, which is costly and difficult to maintain; on the other hand, fields such as diagnosis and surgery in medical data have a large number of standardized conversion requirements, and traditional mapping methods are difficult to efficiently handle the code conversion of massive fields, and lack the ability to flexibly handle loop nodes, resulting in low data processing efficiency and insufficient standardization, which seriously restricts the smooth interaction and in-depth application of medical data across platforms and systems.

[0004] In existing technologies, heterogeneous data processing often adopts point-to-point adaptation or simple field mapping methods, which cannot achieve unified control over the entire process of parsing, mapping, transformation, and iterative processing. Furthermore, the adaptation flexibility is poor, making it difficult to meet the needs of complex data scenarios in the medical field. Summary of the Invention

[0005] To address the shortcomings of the aforementioned existing technologies, this application provides a method and system for assigning and iteratively processing heterogeneous data templates based on metadata mapping. This method enables unified parsing, flexible mapping, standardized conversion, and iterative assignment of heterogeneous data such as XML and JSON, thereby improving the efficiency and standardization of medical data exchange and reducing development and maintenance costs.

[0006] To achieve the above objectives, the present invention employs the following techniques: Methods for assigning and looping heterogeneous data templates based on metadata mapping include: Extract node-by-node path information from a preset XML or JSON template and generate a path information set; The system automatically matches a pre-deployed XPath or JPath parsing module based on the path information set. This allows the XPath parsing module to locate all target nodes in the XML template or the JPath parsing module to locate them in the JSON template, and to confirm the node hierarchy and data type as the basis for subsequent mapping. Receive business parameters passed in when an external interface is triggered; The target metadata corresponding to the business parameters is extracted from the database using a preset metadata query SQL statement; different metadata query SQL statements extract target metadata with different numbers. The mapping logic assignment maps the target node to the fields of the target metadata, and adjusts the mapping logic using the SQL CASEWHEN syntax to form mapping rules. Then, values ​​are assigned based on these rules, checking whether the target node to be assigned is a pre-defined loop node during the assignment process. If it is a loop node, start the loop process and loop through all child nodes within the loop node. If the number of the target metadata corresponding to the child node mapping is the same as the number of the target metadata corresponding to the loop node mapping, then loop through the child node and perform loop iteration to assign values; if the number of the target metadata corresponding to the child node mapping is different from the number of the target metadata corresponding to the loop node mapping, then loop through the child node and keep the assignment unchanged during the loop. If it is not a loop node, the loop process will not be executed, and the target metadata will be directly assigned to the target node based on the mapping rules; After completing the assignment of all target metadata to the actual data of the target node, export the XML or JSON data that conforms to the preset XML or JSON template format.

[0007] Furthermore, during assignment, it is first determined whether the target metadata contains a field carrying a key marker: If so, the preset code dictionary or code interface is called to complete the code conversion of the field carrying the code marker, and then the value is assigned. If not, then assign a value directly.

[0008] A heterogeneous data template assignment and loop processing system based on metadata mapping includes: The template preset module is used to preset XML or JSON templates; The path generation module is used to extract node-by-node path information from a preset XML or JSON template and generate a set of path information. The path parsing module is used to automatically match the pre-deployed XPath parsing module or JPath parsing module based on the path information set, so as to locate all target nodes in the XML template through the XPath parsing module or in the JSON template through the JPath parsing module, and confirm the node level and data type as the basis for subsequent mapping. The SQL preset module is used to preset the SQL statements for metadata queries, so as to lock the target metadata from the database according to the business parameters; The data extraction module is used to extract target metadata corresponding to the business parameters from the database by using a preset metadata query SQL statement when the external interface is triggered. Different metadata query SQL statements extract target metadata with different numbers. The mapping and assignment module is used to map target nodes to fields in the target metadata, and adjusts the mapping logic using the SQL CASEWHEN syntax to form mapping rules. Then, values ​​are assigned based on these rules, checking whether the target node to be assigned is a preset loop node during the assignment process. If it is a loop node, start the loop process and loop through all child nodes within the loop node. If the number of the target metadata corresponding to the child node mapping is the same as the number of the target metadata corresponding to the loop node mapping, then loop through the child node and perform loop iteration to assign values; if the number of the target metadata corresponding to the child node mapping is different from the number of the target metadata corresponding to the loop node mapping, then loop through the child node and keep the assignment unchanged during the loop. If it is not a loop node, the loop process will not be executed, and the target metadata will be directly assigned to the target node based on the mapping rules; The data export module is used to export XML or JSON data that conforms to a preset XML or JSON template format after all target metadata has been assigned to the actual data of the target node.

[0009] The beneficial effects of this invention are as follows: 1. Achieve unified parsing, mapping, and assignment of heterogeneous medical data, eliminating the need for point-to-point adaptation, significantly reducing development and maintenance costs, and substantially improving data processing efficiency in medical data exchange scenarios. Employing a unified XPath / JPath parser, it achieves unified node parsing for XML and JSON, two mainstream data formats, breaking down barriers between heterogeneous data formats and eliminating the need to develop separate parsing programs for different formats. 2. By combining CASEWHEN syntax with custom code matching logic, a two-layer standardized mapping system is constructed, which can not only meet the rapid standardized conversion of simple fields, but also cope with the massive code matching needs of complex fields such as diagnosis and surgery, and adapt to the diverse data scenarios in the medical field. 3. By specifying cyclic metadata, differentiated assignment of values ​​between cyclic nodes and non-cyclic nodes is achieved, solving the problem of efficient cyclic processing of multiple sets of related data (such as multiple diagnoses and multiple surgical records) and improving the adaptability to complex data scenarios. Attached Figure Description

[0010] Figure 1 This is a flowchart of the method steps in an embodiment of this application.

[0011] Figure 2 This is a system structure block diagram of an embodiment of this application.

[0012] Figure 3 This is a raw XML format example of an embodiment of this application.

[0013] Figure 4 This is an example of the XML format after a loop assignment in this application embodiment. Detailed Implementation

[0014] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the implementation methods of the present invention will be described in detail below with reference to the accompanying drawings. However, the embodiments described in this invention are only some embodiments of the present invention, and not all embodiments.

[0015] One aspect of this application provides a method for assigning and looping heterogeneous data templates based on metadata mapping, comprising the following steps: (1) Preset XML or JSON templates: Based on the needs of the medical data interaction scenario, specify an XML template or JSON template that conforms to the interaction standard. For example, the XML template is based on the HL7V3 standard, HL7 FHIR standard, or a user-defined standard preset, and the preset JSON template is based on the HL7 FHIR standard or a user-defined standard preset. The template clearly defines the data structure framework, field names, node levels, and data format requirements, serving as a unified specification for the final output data.

[0016] (2) Extract node paths and match parsing rules: For the preset XML template or JSON template, extract the corresponding path information for each node. The XML template uses XPath syntax to extract node paths, and the JSON template uses JPath syntax to extract node paths, ensuring that the node paths of different template formats can be uniformly recognized; and generate a set of path information.

[0017] (3) Node parsing: A unified parser is pre-deployed, which has built-in XPath and JPath parsing modules. Based on the path information set generated in the previous step, the pre-deployed XPath or JPath parsing module is automatically matched to accurately locate all target nodes in the XML template through the XPath parsing module or in the JSON template through the JPath parsing module, and to confirm the node level and data type as the basis for subsequent mapping.

[0018] (4) Preset metadata query SQL statement: Based on medical business needs, a preset metadata query SQL statement is prepared, defining business parameter types and configuring filtering condition logic, so that the SQL statement can lock the target metadata (such as patient basic information, diagnosis information, surgical information, etc.) according to the business parameters, ensuring that the required metadata can be quickly extracted when the external interface is triggered.

[0019] (5) Receive business parameters passed in when the external interface is triggered; the business parameters are business information in medical data interaction, which can be any field known in the medical information field. They are flexibly defined here through special placeholder symbols. For example, whatever the interface sends, the SQL will use. Such as patient ID, visit serial number, examination request number, laboratory request number, prescription number, patient ID number, doctor's order number, etc.

[0020] The target metadata corresponding to the business parameters is extracted from the database using a preset metadata query SQL statement; different metadata query SQL statements extract target metadata with different numbers.

[0021] (6) Mapping logic assignment: Map the target node to the fields of the target metadata in a one-to-one or many-to-one manner to establish a field mapping relationship; and adjust the mapping logic using the SQL CASEWHEN syntax to form a mapping rule. For example, for the standardized mapping of the gender field, the following syntax is used: case when gender='male'then'1'when gender='female'then'2'else'9'end. This method converts non-standardized metadata into standardized data that meets the template requirements.

[0022] Assignment is based on mapping rules. For scenarios with a large number of fields and complex standardization transformations, such as diagnosis and surgery, a dedicated key mapping marker field is set. Preferably, during assignment, it is first determined whether the target metadata contains a field carrying a key mapping marker: if so, a preset key mapping dictionary or key mapping interface is called to complete the key mapping transformation of the field carrying the key mapping marker before assignment; if not, the assignment is performed directly.

[0023] For target nodes requiring cyclic assignment, the "cyclic metadata" they depend on (such as diagnostic code metadata corresponding to multiple diagnostic records) is specified during the mapping configuration phase. When the assignment is performed, if the target node belongs to the cyclic node category, the cyclic process is started based on the specified cyclic metadata. During the loop, only the assignment of target nodes mapped to cyclic metadata changes synchronously with the loop iteration; other nodes mapped to non-cyclic metadata maintain the same value and do not change with the loop. Specifically, during assignment, it is determined whether the target node to be assigned is a preset cyclic node: If it is a loop node, start the loop process and loop through all child nodes within the loop node. Specifically: if the number of the target metadata corresponding to the child node mapping is the same as the number of the target metadata corresponding to the loop node mapping, then loop through the child node and perform loop iteration assignment. During loop iteration assignment, the number of loops is the same as the number of data entries in the corresponding target metadata, and one data entry is assigned in each loop iteration; if the number of the target metadata corresponding to the child node mapping is different from the number of the target metadata corresponding to the loop node mapping, then loop through the child node and keep the assignment unchanged during the loop. If it is not a loop node, the loop process will not be executed, and the target metadata will be directly assigned to the target node based on the mapping rules.

[0024] After assigning all target metadata to the actual data of the target nodes, export the XML or JSON data conforming to the preset XML or JSON template format. This data can be directly used for interaction between medical systems without secondary processing.

[0025] The following uses the scenario of exporting patient medical information in a medical system as an example to explain in detail the implementation process of this embodiment: (1) Template creation: Create a custom XML template that includes patient basic information (name, gender, age), medical information (medical number, medical time), and diagnosis information (multiple diagnosis records, including diagnosis code and diagnosis name) nodes, where the diagnosis information node is a preset loop node.

[0026] (2) Path extraction: Extract the XPath path of each node, such as: The path to the gender node is " / Patient / BaseInfo / Gender"; The path to the diagnostic coding node is “Patient / DiagnosisList / Diagnosis / Code”.

[0027] (3) Node parsing: The unified parser locates all nodes through the XPath path and confirms the node level and data type.

[0028] (4) Preset SQL: Preset metadata query SQL statements, such as "SELECT * FROM PatientInfo WHERE EVIsitNo=? AND PatientID=?", which locks metadata by the visit number and patient ID. There can be many preset metadata query SQL statements, each with an independent number. They can be used interchangeably between different template mappings, and after parsing the actual parameters through preset placeholders, each SQL statement can guarantee that it retrieves the real business data.

[0029] (5) The interface takes the patient number “20260128001” and the patient ID “P123456” as input, and extracts the target metadata from the database according to the preset metadata query SQL statement. The number of the extracted target metadata is consistent with the number of the metadata query SQL statement.

[0030] (6) Mapping Logic Assignment: Map the gender node to the metadata "gender" field, configure the CASEWHEN logic to implement encoding conversion; directly map the visit number and visit time nodes to the corresponding metadata. Code Matching Configuration: Set a code matching flag for the diagnostic code field, extract the metadata and trigger the code matching process, call the ICD-10 diagnostic code dictionary to complete the standardized conversion. Loop Configuration: Specify that the diagnostic information node depends on the "diagnostic code" metadata as loop metadata, map the diagnostic code and diagnostic name nodes to this loop metadata, and map the patient basic information and visit information nodes to non-loop metadata.

[0031] (7) Export standard-compliant XML data for interaction with other medical systems.

[0032] To further illustrate the loop configuration, the following example is provided: Metadata presets: The SQL statement corresponding to number 1 is "Select * from PatientInfo where VisitNo=? ANDPatientID=?"; the SQL statement corresponding to number 2 is "Select * from PatientDiagnosis whereVisitNo=?".

[0033] The node XPath has the following: Here, in the example, "Diagnosis" is marked as a loop node. Therefore, all its child nodes (Code node, patientName node) need to be looped. The metadata number corresponding to the Code node is 2, which is the same as the metadata number 2 of the loop node. Thus, the Code node needs to be iteratively assigned values. Looping twice means assigning two different values, such as "Diagnosis Code 1" and "Diagnosis Code 2". Specifically, the target metadata with number 2 is a List collection containing two data items. Looping twice, the first time retrieves the first data item, and the second time retrieves the second data item. These two data items are different in business logic, including their actual values, so two different values, "Diagnosis Code 1" and "Diagnosis Code 2", can be displayed. The metadata number corresponding to the patientName node is 1, which is different from the metadata number 2 of the loop node. Therefore, the patientName node loops but keeps the patient's basic information values ​​unchanged, such as "Zhang San". Taking XML format as an example, before assignment, as follows... Figure 3 As shown; after the loop assignment, as... Figure 4 As shown.

[0034] Another aspect of this application provides a heterogeneous data template assignment and loop processing system based on metadata mapping, such as... Figure 2 As shown, the modules include a template preset module, a path generation module, a path parsing module, an SQL preset module, a data extraction module, a mapping assignment module, and a data export module.

[0035] The module comprises several components: a template preset module for pre-defined XML or JSON templates; a path generation module for extracting node-by-node path information from these templates and generating a path information set; specifically, XPath syntax is used to extract node paths from XML templates, and JPath syntax is used to extract node paths from JSON templates; a path parsing module for automatically matching pre-deployed XPath or JPath parsing modules based on the path information set; and an SQL preset module for pre-defined metadata query SQL statements to retrieve target metadata from the database based on business parameters.

[0036] The data extraction module is used to extract target metadata corresponding to the business parameters from the database by using a preset metadata query SQL statement when the external interface is triggered. The target metadata extracted by different metadata query SQL statements has different numbers.

[0037] The mapping assignment module is used to map target nodes to fields in the target metadata, and adjusts the mapping logic using the SQL CASEWHEN syntax to form mapping rules. Then, values ​​are assigned based on these mapping rules, checking whether the target node to be assigned is a preset loop node during the assignment process. If it is a loop node, start the loop process and loop through all child nodes within the loop node. Specifically: if the number of the target metadata corresponding to the child node mapping is the same as the number of the target metadata corresponding to the loop node mapping, then loop through the child node and perform loop iteration assignment. During loop iteration assignment, the number of loops is the same as the number of data entries in the corresponding target metadata, and one data entry is assigned in each loop iteration; if the number of the target metadata corresponding to the child node mapping is different from the number of the target metadata corresponding to the loop node mapping, then loop through the child node and keep the assignment unchanged during the loop. If it is not a loop node, the loop process will not be executed, and the target metadata will be directly assigned to the target node based on the mapping rules.

[0038] When assigning values, the mapping assignment module first determines whether the target metadata contains a field carrying a key pair marker: If so, the preset code dictionary or code interface is called to complete the code conversion of the field carrying the code marker, and then the value is assigned. If not, then assign a value directly.

[0039] The data export module is used to export XML or JSON data that conforms to a preset XML or JSON template format after all target metadata has been assigned to the actual data of the target node.

[0040] The above description is only a preferred embodiment of this application and is not intended to limit this application. Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application.

Claims

1. A method for assigning and iteratively processing heterogeneous data templates based on metadata mapping, characterized in that: include: Extract node-by-node path information from a preset XML or JSON template and generate a path information set; The system automatically matches a pre-deployed XPath or JPath parsing module based on the path information set. This allows the XPath parsing module to locate all target nodes in the XML template or the JPath parsing module to locate them in the JSON template, and to confirm the node hierarchy and data type as the basis for subsequent mapping. Receive business parameters passed in when an external interface is triggered; Extract the target metadata corresponding to the business parameters from the database using a preset metadata query SQL statement; Different metadata query SQL statements extract target metadata with different numbers; The mapping logic assignment maps the target node to the fields of the target metadata, and adjusts the mapping logic using the SQL CASEWHEN syntax to form mapping rules. Then, values ​​are assigned based on these rules, checking whether the target node to be assigned is a pre-defined loop node during the assignment process. If it is a loop node, start the loop process and loop through all child nodes within the loop node. If the number of the target metadata corresponding to the child node mapping is the same as the number of the target metadata corresponding to the loop node mapping, then loop through the child node and perform loop iteration to assign values; if the number of the target metadata corresponding to the child node mapping is different from the number of the target metadata corresponding to the loop node mapping, then loop through the child node and keep the assignment unchanged during the loop. If it is not a loop node, the loop process will not be executed, and the target metadata will be directly assigned to the target node based on the mapping rules; After completing the assignment of all target metadata to the actual data of the target node, export the XML or JSON data that conforms to the preset XML or JSON template format.

2. The method for assigning and iteratively processing heterogeneous data templates based on metadata mapping according to claim 1, characterized in that, When assigning values, first check if the target metadata contains a field carrying a key marker: If so, the preset code dictionary or code interface is called to complete the code conversion of the field carrying the code marker, and then the value is assigned. If not, then assign a value directly.

3. The method for assigning and iteratively processing heterogeneous data templates based on metadata mapping according to claim 1, characterized in that, When assigning values ​​in a loop, the number of loop iterations is the same as the number of data entries in the corresponding target metadata. Each loop iteration takes one data entry and assigns it a value.

4. The method for assigning and iteratively processing heterogeneous data templates based on metadata mapping according to claim 1, characterized in that, XPath syntax is used to extract node paths from XML templates, and JPath syntax is used to extract node paths from JSON templates.

5. The method for assigning and iteratively processing heterogeneous data templates based on metadata mapping according to claim 1, characterized in that, XML templates are based on HL7V3, HL7 FHIR, or user-defined standard presets, while default JSON templates are based on HL7 FHIR or user-defined standard presets.

6. The method for assigning and iteratively processing heterogeneous data templates based on metadata mapping according to claim 1, characterized in that, The business parameters are business information fields used in medical data interaction.

7. A heterogeneous data template assignment and loop processing system based on metadata mapping, characterized in that, include: The template preset module is used to preset XML or JSON templates; The path generation module is used to extract node-by-node path information from a preset XML or JSON template and generate a set of path information. The path parsing module is used to automatically match the pre-deployed XPath parsing module or JPath parsing module based on the path information set, so as to locate all target nodes in the XML template through the XPath parsing module or in the JSON template through the JPath parsing module, and confirm the node level and data type as the basis for subsequent mapping. The SQL preset module is used to preset the SQL statements for metadata queries, so as to lock the target metadata from the database according to the business parameters; The data extraction module is used to extract target metadata corresponding to the business parameters from the database by using a preset metadata query SQL statement when the external interface is triggered. Different metadata query SQL statements extract target metadata with different numbers; The mapping and assignment module is used to map target nodes to fields in the target metadata, and adjusts the mapping logic using the SQL CASEWHEN syntax to form mapping rules. Then, values ​​are assigned based on these rules, checking whether the target node to be assigned is a preset loop node during the assignment process. If it is a loop node, start the loop process and loop through all child nodes within the loop node. If the number of the target metadata corresponding to the child node mapping is the same as the number of the target metadata corresponding to the loop node mapping, then loop through the child node and perform loop iteration to assign values; if the number of the target metadata corresponding to the child node mapping is different from the number of the target metadata corresponding to the loop node mapping, then loop through the child node and keep the assignment unchanged during the loop. If it is not a loop node, the loop process will not be executed, and the target metadata will be directly assigned to the target node based on the mapping rules; The data export module is used to export XML or JSON data that conforms to a preset XML or JSON template format after all target metadata has been assigned to the actual data of the target node.

8. The heterogeneous data template assignment and loop processing system based on metadata mapping according to claim 7, characterized in that, The mapping assignment module, when performing assignment, first determines whether the target metadata contains a field carrying a key marker: If so, the preset code dictionary or code interface is called to complete the code conversion of the field carrying the code marker, and then the value is assigned. If not, then assign a value directly.

9. The heterogeneous data template assignment and loop processing system based on metadata mapping according to claim 7, characterized in that, When assigning values ​​in a loop, the number of loop iterations is the same as the number of data entries in the corresponding target metadata. Each loop iteration takes one data entry and assigns it a value.

10. The heterogeneous data template assignment and loop processing system based on metadata mapping according to claim 7, characterized in that, The path generation module is used to extract node paths from XML templates using XPath syntax and from JSON templates using JPath syntax.