ID automatic generation and deviation checking method and system

By using UUIDv8 generation rules and a dynamic normal model, the problem of ID generation and data association difficulties in multi-system medical information systems has been solved, realizing the unified generation of business IDs and accurate identification of abnormal deviations, thereby improving the parsability and consistency of medical data.

CN121435920BActive Publication Date: 2026-03-24BEIJING ZHIYI HEALTH INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-05
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

In medical information systems with concurrent writes across multiple hospital areas and systems, existing ID generation methods are difficult to parse, leading to difficulties in cross-system data association and a lack of temporal consistency constraints on patient visit sequences, making it difficult to identify abnormal deviations in medical data.

Method used

The UUIDv8 generation rules are used to construct business IDs, and the business IDs are generated through desensitization encoding and dictionary encoding. Combined with dynamic normal model and adjacent hierarchical clustering, the temporal consistency verification and abnormal deviation detection of medical business event data are realized.

Benefits of technology

In high-concurrency, multi-system scenarios, it achieves unified generation of business IDs and parsability across system links, which can accurately identify abnormal deviations and enhance the temporal consistency and governance stability of medical data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121435920B_ABST
    Figure CN121435920B_ABST
Patent Text Reader

Abstract

The application discloses an ID automatic generation and deviation checking method and system, comprising the following steps: acquiring medical business event data, constructing a business ID based on a UUIDv8 rule; arranging the medical business event data in ascending order of event time stamp to form a medical sequence; dividing the medical sequence according to a window length to obtain a plurality of subsequences, and generating a subsequence feature vector set; acquiring a training subsequence feature vector set, establishing a normal mode set of a dynamic normal model, and generating a normal cluster set; acquiring to-be-checked medical business event data and generating a to-be-checked representation vector, calculating an abnormal score and a drift score, and generating an abnormal flag and a drift flag. The application can stably generate a globally unique and traceable business ID by introducing a UUIDv8 self-defined bit segment-based analyzable business ID generation, and significantly improves the consistency of medical business data association and the robustness of deviation detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical business data technology, and in particular to a method and system for automatic ID generation and deviation verification. Background Technology

[0002] In existing medical information systems, a large number of business IDs are generated during the patient's visit, including registration, consultation, diagnosis, treatment, prescription issuance, pharmacy node transfer, and medication dispensing. These IDs are used for data association and traceability between different modules and systems. Existing technologies typically use database auto-incrementing numbers, snowflake algorithms, GUID / UUIDs, etc., to generate IDs, and use field validation or rule engines to achieve consistency checks in order to support data aggregation and auditing across departments and institutions.

[0003] However, in scenarios involving concurrent writes across multiple hospital areas and systems, the aforementioned solutions often suffer from difficulties in association due to unresolvable IDs or a lack of business semantics. When changes in the business distribution occur due to adjustments in the clinic's business structure, changes in the drug catalog, addition of pharmacy nodes, or interface upgrades, verification methods relying on fixed rules are prone to false alarms or missed alarms, making it difficult to distinguish between normal drift and abnormal deviations. At the same time, traditional ID verification focuses more on the legality of fields in a single record and lacks temporal consistency constraints based on the patient visit sequence. It is difficult to reliably identify deviations such as misbinding, order mixing, and time sequence reversal in the prescription, treatment, and dispensing links, affecting the credibility and traceability of medical data. Summary of the Invention

[0004] To address the technical problems existing in the background art, this invention proposes an automatic ID generation and deviation verification method and system.

[0005] The present invention proposes an automatic ID generation and deviation verification method, comprising the following steps:

[0006] S1. Obtain medical business event data, perform desensitization encoding and dictionary encoding processing on the medical business event data, and construct a business ID based on the UUIDv8 generation rules. The UUIDv8 is a 128-bit universal unique identifier format defined in RFC 9562. Its "v8" indicates that the version field of the UUID is fixed at 8. At the same time, it is required to use the RFC4122 / DCE variant. After satisfying the version bit and variant bit constraints, the remaining 122 bits are customized by the implementer according to business needs, so as to carry business structure information while maintaining UUID compatibility.

[0007] S2. Arrange the medical business event data generated continuously by the same patient within the session interval in ascending order according to the event timestamp to form a medical visit sequence;

[0008] S3. Divide the patient visit sequence into multiple sub-sequences according to the window length. For each sub-sequence, parse the business ID to obtain the time slice integer value, the business main category integer code, and the business sub-category integer code, and generate a set of sub-sequence feature vectors.

[0009] S4. Obtain the training subsequence feature vector set using the subsequence feature vector set, establish the normal pattern set of the dynamic normal model based on the training subsequence feature vector set, and perform adjacent hierarchical clustering on the subsequences in adjacent time periods to generate a normal cluster set.

[0010] S5. Obtain the medical business event data to be verified and generate the representation vector to be verified. Calculate the anomaly score and drift score based on the normal pattern set and normal cluster set of the dynamic normal model, and generate anomaly flags and drift flags.

[0011] Preferably, the medical business event data Including patient identification Doctor's logo Expert logo Clinic signage Diagnostic type identifier Medical treatment item identification Treatment plan labeling Drug codes Pharmacy node signage Organizational logo Business main category tags and event timestamp .

[0012] Preferably, the medical business event data undergoes de-identification encoding and dictionary encoding processing, as follows:

[0013] Desensitization encoding is performed on patient identifiers, doctor identifiers, and expert identifiers. The HMAC algorithm is used to generate corresponding fixed-length digest values, and the fixed-length digest values ​​are mapped to identifier bit segments. The HMAC algorithm is an algorithm that uses a key K and a hash function H to generate a fixed-length authentication code. It is used to realize message integrity verification and authentication under shared key conditions, and is also often used for irreversible desensitization mapping of sensitive identifiers.

[0014] Dictionary encoding is performed on the institution identifier, clinic identifier, pharmacy node identifier, diagnosis type identifier, treatment item identifier, treatment plan identifier, and drug code to obtain the corresponding integer codes for institution identifier, clinic identifier, pharmacy node identifier, diagnosis type identifier, treatment item identifier, treatment plan identifier, and drug code. The integer codes for institution identifier, clinic identifier, and pharmacy node identifier are then mapped to the institution identifier business field bit segment, clinic identifier business field bit segment, and pharmacy node identifier business field bit segment, respectively, through a binary mapping function.

[0015] Preferably, the service ID is a binary string of length 128, and the service ID is composed of version bit strings. Variant bit string and custom bit string Composition, let the business ID be :

[0016] ;

[0017] in, This indicates a bit string concatenation operation;

[0018] The version bit string length is 4, the variant bit string length is 2, and the custom bit string length is 122.

[0019] The version bit string is a four-bit binary string representing the integer 8. ;

[0020] The variant bit string is a binary string that meets the requirements of RFC4122 variant. ,in and For fixed values;

[0021] The custom bit string is configured with the organization bit segment, service type bit segment, node bit segment, and time slice bit segment in sequence.

[0022] Preferably, the custom bit string is configured with an organization bit segment, a service type bit segment, a node bit segment, and a time slice bit segment in sequence, as follows:

[0023] The organization identification business field bit segment As an institutional bit segment;

[0024] Define the collection of main business classes as follows The main business class tag for obtaining medical business event data , Encode the main business class tag to generate an integer code for the main business class;

[0025] Integer encoding based on diagnostic type identifier Integer code for diagnosis and treatment items Treatment plan identifier integer code And drug code integer code Calculate the integer encoding of the business details:

[0026] ;

[0027] in, , , , These are the weighting coefficients;

[0028] The binary mapping function maps the main business class integer code and the sub-business class integer code to the main business class bit string and the sub-business class bit string respectively. The main business class bit string and the sub-business class bit string are then concatenated to form the business type bit segment.

[0029] The node bit segment is identified by the clinic identification business field bit segment. and pharmacy node identifier business field bit segment To assemble;

[0030] Based on event timestamps Calculate the integer value of the time slice :

[0031] ;

[0032] in, For time granularity parameters, ;

[0033] The time-slice integer value is mapped to the time-slice bit segment using a binary mapping function.

[0034] Preferably, the medical service event data generated consecutively by the same patient within the session interval are arranged in ascending order by event timestamp to form a consultation sequence, as follows:

[0035] Let the medical business event data set be ,in, For the first One medical business incident, Let the total number of medical service events be denoted by the patient identifier set. Identify any patient The corresponding medical business event data index set is defined as follows:

[0036] ;

[0037] in, Medical business event data Patient identifiers included;

[0038] The medical event data corresponding to the same patient is sorted in ascending order by event timestamp to obtain an ordered index sequence. Set session interval , Based on expert experience, the system is configured to sequentially traverse the medical business event data corresponding to the ordered index sequence to perform session segmentation. For adjacent medical business event data, when the difference between the corresponding event timestamps is less than or equal to the session interval, i.e. Adjacent medical business event data are grouped into the same session. When the difference between the corresponding event timestamps is greater than the session interval, the session is split at the session boundary to obtain the patient's session sequence index set. And the corresponding medical visit sequence for each session. ,in, For patients The corresponding number of sessions For the first The number of medical business events contained within a session.

[0039] Preferably, the patient visit sequence is divided into multiple sub-sequences according to the window length. For each sub-sequence, the business ID is parsed to obtain the time slice integer value, the business main category integer code, and the business sub-category integer code, and a set of sub-sequence feature vectors is generated, as follows:

[0040] The medical appointment sequence is set according to the preset window length. The sequence was split into multiple subsequences. ,in, Indicates the first Subsequences;

[0041] Encode the diagnosis type identifier of each medical business event data into an integer. Integer code for diagnosis and treatment items Treatment plan identifier integer code Drug code integer code Integer code of pharmacy node identifier and time slice integer values Integer encoding of the main business class and business category integer encoding Combined into event-level feature vectors:

[0042] ;

[0043] Each subsequence is based on event-level feature vectors. Based on the index of the subsequence Constructing the feature vector of the subsequence :

[0044] ;

[0045] Combine all subsequence feature vectors into a subsequence feature vector set:

[0046] ;

[0047] in, The number of subsequences.

[0048] Preferably, a set of training subsequence feature vectors is obtained using the subsequence feature vector set. Based on the training subsequence feature vector set, a set of normal patterns for a dynamic normal model is established, and adjacency hierarchical clustering is performed on subsequences within adjacent time periods to generate a set of normal clusters, as follows:

[0049] Based on the subsequence feature vector set Obtain the set of feature vectors of training subsequences used to build the dynamic normal model. , ,and The subsequence corresponding to each subsequence feature vector in the data is labeled as normal;

[0050] For each subsequence feature vector Normalization is performed to obtain the representation vector :

[0051] ;

[0052] in, for The One portion, , For subsequence The number of medical business event data;

[0053] Establish a set of normal patterns for a dynamic normal model. Normal pattern set Each normal pattern in the model consists of a triplet comprising the pattern vector of the normal pattern, the number of representation vectors contained in the normal pattern, and the radius parameter of the normal pattern. The set of normal patterns in the dynamic normal model is defined as follows: ,in, Number of normal patterns For the first The pattern vector of a normal pattern, For the first The number of representation vectors contained in a normal pattern For the first The radius parameter of a normal pattern;

[0054] For the set of feature vectors of training subsequences All representation vectors Processing sequentially, the vector distance function is defined as follows:

[0055] ;

[0056] When the normal pattern set When empty, the current representation vector is... Set as the pattern vector of the first normal mode Set the number of representation vectors contained in the corresponding normal mode to 1, that is... Set the radius parameter of the corresponding normal mode to 0, that is... ;

[0057] When the normal pattern set When not empty, compute the current representation vector for each existing normal pattern. Pattern vectors of normal mode The nearest normal pattern is selected based on the distance between them. :

[0058] ;

[0059] When the minimum distance The radius parameter is less than or equal to the nearest normal pattern. When, the current representation vector is... Merge into the most recent normal pattern and update the pattern vector of the most recent normal pattern to the original pattern vector. With the current representation vector The new vector obtained after weighted summation increments the number of representation vectors contained in the most recent normal pattern by one, and updates the radius parameter of the most recent normal pattern to the original radius parameter. minimum distance The larger of the two:

[0060] ;

[0061] ;

[0062] ;

[0063] When the minimum distance Radius parameter greater than the most recent normal pattern When a new normal mode is added, the current representation vector is changed. Set as the mode vector of the new normal mode Set the number of representation vectors contained in the new normal mode to 1, that is... Set the radius parameter of the new normal mode to 0, that is... ;

[0064] For the set of feature vectors of training subsequences All representation vectors in the dataset are divided into time periods, and for any adjacent time periods... , time period The corresponding set of representation vectors With time period The corresponding set of representation vectors merged into For all representation vectors within adjacent time periods Perform adjacent hierarchical clustering, using each representation vector within adjacent time periods as an initial cluster to form an initial cluster set;

[0065] Assume the clustering link criterion is the average link criterion, and the inter-cluster distance is defined as the average of the pairwise distances between any two representation vectors within two clusters:

[0066] ;

[0067] in, and For any two clusters, and These represent the number of representation vectors within the cluster;

[0068] Set clustering stopping threshold , Based on expert experience, in each iteration, the inter-cluster distance between any two clusters in the current cluster set is calculated, and the two clusters with the smallest inter-cluster distance are selected for merging and the cluster set is updated.

[0069] When the distance between any two clusters in the updated cluster set is greater than the clustering stopping threshold The merging process stops when the time interval is reached, resulting in a set of normal clusters corresponding to adjacent time intervals. Each normal cluster is denoted as , For each normal cluster in the normal cluster set, the cluster number is used. Calculate the cluster center vector:

[0070] .

[0071] Preferably, the medical business event data to be verified is acquired and a representation vector to be verified is generated. Based on the normal pattern set and normal cluster set of the dynamic normal model, the anomaly score and drift score are calculated, and anomaly flags and drift flags are generated, as follows:

[0072] Obtain medical business event data to be verified and the corresponding business ID and the subsequence to be verified and the vector to be verified ;

[0073] For each normal pattern in the set of normal patterns, calculate the representation vector to be verified. Pattern vectors of normal mode Distance between :

[0074] ;

[0075] Based on the representation vector to be verified Pattern vectors of normal mode Distance between and the radius parameter of normal mode Calculate anomaly scores :

[0076] ;

[0077] Calculate the representation vector to be verified Cluster center vectors to each normal cluster distance :

[0078] ;

[0079] And based on the representation vector to be verified Cluster center vectors to each normal cluster distance Calculate drift score :

[0080] ;

[0081] Set an abnormal threshold With drift threshold The anomaly threshold and drift threshold are set based on expert experience.

[0082] Get the exception flag When abnormal scores Greater than the abnormal threshold At that time, abnormal flag It is 1 if it is true, otherwise it is 0.

[0083] Get Drift Mark When abnormal scores Less than or equal to the abnormal threshold And drift score Less than or equal to the drift threshold At that time, drift marker It is 1 if it is true, otherwise it is 0;

[0084] Based on medical business event data to be verified Corresponding business ID, anomaly score Drift score Abnormal signs and drift markers Generate audit logs.

[0085] An automatic ID generation and deviation verification system, comprising:

[0086] The data acquisition and processing module is used to acquire medical business event data and perform de-identification encoding and dictionary encoding processing on the medical business event data;

[0087] The business ID generation module is used to construct business IDs based on UUIDv8 generation rules;

[0088] The appointment sequence construction module is used to arrange the medical business event data of the same patient generated continuously within the session interval into an appointment sequence by the event timestamp in ascending order.

[0089] The subsequence segmentation module is used to segment the medical visit sequence into multiple subsequences according to the window length. For each subsequence, the business ID is parsed to obtain the time slice integer value, the business main category integer code, and the business sub-category integer code, and a set of subsequence feature vectors is generated.

[0090] The normal pattern set construction module is used to obtain the training subsequence feature vector set using the subsequence feature vector set, build the normal pattern set of the dynamic normal model based on the training subsequence feature vector set, and perform adjacent hierarchical clustering on the subsequences in adjacent time periods to generate a normal cluster set.

[0091] The audit log generation module is used to acquire medical business event data to be verified and generate a representation vector to be verified. Based on the normal pattern set and normal cluster set of the dynamic normal model, it calculates the anomaly score and drift score, and generates anomaly flags and drift flags.

[0092] The proposed method and system for automatic ID generation and deviation verification in this invention have the following beneficial technical effects:

[0093] 1. This application integrates the generation of medical business IDs with the structured encoding of business semantics. Sensitive identifiers such as patients, doctors, and experts are first desensitized and mapped to identifier bit segments. Then, the institution, clinic, pharmacy node, diagnosis type, treatment item, treatment plan, and drug code are dictionary-encoded and mapped to business field bit segments. These are then written into a custom bit area of ​​UUIDv8 according to a preset bit segment order. The business ID is output by combining the time slice bit segment and the unique bit segment of "random sub-segment + counter sub-segment". This enables unified generation of business IDs in high-concurrency, multi-system, and multi-node medical scenarios. Moreover, the business ID can directly carry institution, node, business type, and time information, improving the determinism of cross-system link associations and the resolvability of audit traceability.

[0094] 2. This application deeply integrates the dynamic normality model with business ID deviation detection. By constructing a dynamic normality model and an adjacent hierarchical clustering mechanism within a time period, it achieves accurate differentiation between "abnormal deviations" and "concept drift" in medical business processes. The system can dynamically adjust the judgment boundary based on the statistical patterns of historical business sequences, thereby effectively reducing misjudgments caused by business changes, catalog updates, etc., and accurately identifying potential high-risk events such as incorrect patient binding, prescription order confusion, and node jumps, thus enhancing the temporal consistency and governance stability of medical data. Attached Figure Description

[0095] Figure 1 This is a flowchart of an ID automatic generation and deviation verification method according to the present invention;

[0096] Figure 2 This is a block diagram illustrating the principle of an automatic ID generation and deviation verification system according to the present invention. Detailed Implementation

[0097] Embodiments of the present invention are described in detail below. Examples of these embodiments are illustrated in the accompanying drawings, wherein the same or similar symbols denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0098] like Figure 1 The method for automatic ID generation and deviation verification shown includes the following steps:

[0099] S1. Obtain medical business event data, perform desensitization encoding and dictionary encoding processing on the medical business event data, and construct a business ID based on the UUIDv8 generation rules. The UUIDv8 is a 128-bit universal unique identifier format defined in RFC 9562. Its "v8" indicates that the version field of the UUID is fixed at 8. At the same time, it is required to use the RFC4122 / DCE variant. After satisfying the version bit and variant bit constraints, the remaining 122 bits are customized by the implementer according to business needs, so as to carry business structure information while maintaining UUID compatibility.

[0100] In an optional embodiment, the medical business event data Including patient identification Doctor's logo Expert logo Clinic signage Diagnostic type identifier Medical treatment item identification Treatment plan labeling Drug codes Pharmacy node signage Organizational logo Business main category tags and event timestamp ;

[0101] In an optional embodiment, the medical business event data undergoes de-identification encoding and dictionary encoding processing as follows:

[0102] Desensitization encoding is performed on patient identifiers, doctor identifiers, and expert identifiers. The HMAC algorithm is used to generate corresponding fixed-length digest values, and the fixed-length digest values ​​are mapped to identifier bit segments. The HMAC algorithm is an algorithm that uses a key K and a hash function H to generate a fixed-length authentication code. It is used to realize message integrity verification and authentication under shared key conditions, and is also often used for irreversible desensitization mapping of sensitive identifiers.

[0103] Dictionary encoding is performed on the institution identifier, clinic identifier, pharmacy node identifier, diagnosis type identifier, treatment item identifier, treatment plan identifier, and drug code to obtain the corresponding integer codes for institution identifier, clinic identifier, pharmacy node identifier, diagnosis type identifier, treatment item identifier, treatment plan identifier, and drug code. The integer codes for institution identifier, clinic identifier, and pharmacy node identifier are then mapped to the institution identifier business field bit segment, clinic identifier business field bit segment, and pharmacy node identifier business field bit segment, respectively, using a binary mapping function.

[0104] In an optional embodiment, the service ID is a 128-bit binary string, and the service ID is composed of version bit strings. Variant bit string and custom bit string Composition, let the business ID be :

[0105] ;

[0106] in, This indicates a bit string concatenation operation;

[0107] The version bit string length is 4, the variant bit string length is 2, and the custom bit string length is 122.

[0108] The version bit string is a four-bit binary string representing the integer 8. ;

[0109] The variant bit string is a binary string that meets the requirements of RFC4122 variant. ,in and For fixed values;

[0110] The custom bit string is configured with the organization bit segment, service type bit segment, node bit segment and time slice bit segment in sequence.

[0111] In an optional embodiment, the custom bit string is configured with an organization bit segment, a service type bit segment, a node bit segment, and a time slice bit segment in sequence, as follows:

[0112] The organization identification business field bit segment As an institutional bit segment;

[0113] Define the collection of main business classes as follows The main business class tag for obtaining medical business event data , Encode the main business class tag to generate an integer code for the main business class;

[0114] Integer encoding based on diagnostic type identifier Integer code for diagnosis and treatment items Treatment plan identifier integer code And drug code integer code Calculate the integer encoding of the business details:

[0115] ;

[0116] in, , , , These are the weighting coefficients;

[0117] The binary mapping function maps the main business class integer code and the sub-business class integer code to the main business class bit string and the sub-business class bit string respectively. The main business class bit string and the sub-business class bit string are then concatenated to form the business type bit segment.

[0118] The node bit segment is identified by the clinic identification business field bit segment. and pharmacy node identifier business field bit segment To assemble;

[0119] Based on event timestamps Calculate the integer value of the time slice :

[0120] ;

[0121] in, For time granularity parameters, ;

[0122] The time-slice integer value is mapped to the time-slice bit segment using a binary mapping function.

[0123] S2. Arrange the medical business event data generated continuously by the same patient within the session interval in ascending order according to the event timestamp to form a medical visit sequence;

[0124] In an optional embodiment, the medical service event data generated consecutively by the same patient within a session interval are arranged in ascending order by event timestamp to form a consultation sequence, as follows:

[0125] Let the medical business event data set be ,in, For the first One medical business incident, Let the total number of medical service events be denoted by the patient identifier set. Identify any patient The corresponding medical business event data index set is defined as follows:

[0126] ;

[0127] in, Medical business event data Patient identifiers included;

[0128] The medical event data corresponding to the same patient is sorted in ascending order by event timestamp to obtain an ordered index sequence. Set session interval , Based on expert experience, the system is configured to sequentially traverse the medical business event data corresponding to the ordered index sequence to perform session segmentation. For adjacent medical business event data, when the difference between the corresponding event timestamps is less than or equal to the session interval, i.e. Adjacent medical business event data are grouped into the same session. When the difference between the corresponding event timestamps is greater than the session interval, the session is split at the session boundary to obtain the patient's session sequence index set. And the corresponding medical visit sequence for each session. ,in, For patients The corresponding number of sessions For the first The number of medical business events contained within a session.

[0129] S3. Divide the patient visit sequence into multiple sub-sequences according to the window length. For each sub-sequence, parse the business ID to obtain the time slice integer value, the business main category integer code, and the business sub-category integer code, and generate a set of sub-sequence feature vectors.

[0130] In an optional embodiment, the medical visit sequence is divided into multiple sub-sequences according to the window length. For each sub-sequence, the service ID is parsed to obtain the time slice integer value, the main service category integer code, and the sub-service category integer code, and a set of sub-sequence feature vectors is generated, as follows:

[0131] The medical appointment sequence is set according to the preset window length. The sequence was split into multiple subsequences. ,in, Indicates the first Subsequences;

[0132] Encode the diagnosis type identifier of each medical business event data into an integer. Integer code for diagnosis and treatment items Treatment plan identifier integer code Drug code integer code Integer code of pharmacy node identifier and time slice integer values Integer encoding of the main business class and business category integer encoding Combined into event-level feature vectors:

[0133] ;

[0134] Each subsequence is based on event-level feature vectors. Based on the index of the subsequence Constructing the feature vector of the subsequence :

[0135] ;

[0136] Combine all subsequence feature vectors into a subsequence feature vector set:

[0137] ;

[0138] in, The number of subsequences.

[0139] S4. Obtain the training subsequence feature vector set using the subsequence feature vector set, establish the normal pattern set of the dynamic normal model based on the training subsequence feature vector set, and perform adjacent hierarchical clustering on the subsequences in adjacent time periods to generate a normal cluster set.

[0140] In an optional embodiment, a set of training subsequence feature vectors is obtained using the subsequence feature vector set. Based on the set of training subsequence feature vectors, a set of normal patterns for a dynamic normal model is established, and adjacency hierarchical clustering is performed on subsequences within adjacent time periods to generate a set of normal clusters, as follows:

[0141] Based on the subsequence feature vector set Obtain the set of feature vectors of training subsequences used to build the dynamic normal model. , ,and The subsequence corresponding to each subsequence feature vector in the data is labeled as normal;

[0142] For each subsequence feature vector Normalization is performed to obtain the representation vector :

[0143] ;

[0144] in, for The One portion, , For subsequence The number of medical business event data;

[0145] Establish a set of normal patterns for a dynamic normal model. Normal pattern set Each normal pattern in the model consists of a triplet comprising the pattern vector of the normal pattern, the number of representation vectors contained in the normal pattern, and the radius parameter of the normal pattern. The set of normal patterns in the dynamic normal model is defined as follows: ,in, Number of normal patterns For the first The pattern vector of a normal pattern, For the first The number of representation vectors contained in a normal pattern For the first The radius parameter of a normal pattern;

[0146] For the set of feature vectors of training subsequences All representation vectors Processing sequentially, the vector distance function is defined as follows:

[0147] ;

[0148] When the normal pattern set When empty, the current representation vector is... Set as the pattern vector of the first normal mode Set the number of representation vectors contained in the corresponding normal mode to 1, that is... Set the radius parameter of the corresponding normal mode to 0, that is... ;

[0149] When the normal pattern set When not empty, compute the current representation vector for each existing normal pattern. Pattern vectors of normal mode The nearest normal pattern is selected based on the distance between them. :

[0150] ;

[0151] When the minimum distance The radius parameter is less than or equal to the nearest normal pattern. When, the current representation vector is... Merge into the most recent normal pattern and update the pattern vector of the most recent normal pattern to the original pattern vector. With the current representation vector The new vector obtained after weighted summation increments the number of representation vectors contained in the most recent normal pattern by one, and updates the radius parameter of the most recent normal pattern to the original radius parameter. minimum distance The larger of the two:

[0152] ;

[0153] ;

[0154] ;

[0155] When the minimum distance Radius parameter greater than the most recent normal pattern When a new normal mode is added, the current representation vector is changed. Set as the mode vector of the new normal mode Set the number of representation vectors contained in the new normal mode to 1, that is... Set the radius parameter of the new normal mode to 0, that is... ;

[0156] For the set of feature vectors of training subsequences All representation vectors in the dataset are divided into time periods, and for any adjacent time periods... , time period The corresponding set of representation vectors With time period The corresponding set of representation vectors merged into For all representation vectors within adjacent time periods Perform adjacent hierarchical clustering, using each representation vector within adjacent time periods as an initial cluster to form an initial cluster set;

[0157] Assume the clustering link criterion is the average link criterion, and the inter-cluster distance is defined as the average of the pairwise distances between any two representation vectors within two clusters:

[0158] ;

[0159] in, and For any two clusters, and These represent the number of representation vectors within the cluster;

[0160] Set clustering stopping threshold , Based on expert experience, in each iteration, the inter-cluster distance between any two clusters in the current cluster set is calculated, and the two clusters with the smallest inter-cluster distance are selected for merging and the cluster set is updated.

[0161] When the distance between any two clusters in the updated cluster set is greater than the clustering stopping threshold The merging process stops when the time interval is reached, resulting in a set of normal clusters corresponding to adjacent time intervals. Each normal cluster is denoted as , For each normal cluster in the normal cluster set, the cluster number is used. Calculate the cluster center vector:

[0162] .

[0163] S5. Obtain the medical business event data to be verified and generate the representation vector to be verified. Calculate the anomaly score and drift score based on the normal pattern set and normal cluster set of the dynamic normal model, and generate anomaly flags and drift flags.

[0164] In an optional embodiment, the medical business event data to be verified is acquired and a representation vector to be verified is generated. Based on the normal pattern set and normal cluster set of the dynamic normal model, the anomaly score and drift score are calculated, and anomaly flags and drift flags are generated, as follows:

[0165] Obtain medical business event data to be verified and the corresponding business ID and the subsequence to be verified and the vector to be verified ;

[0166] For each normal pattern in the set of normal patterns, calculate the representation vector to be verified. Pattern vectors of normal mode Distance between :

[0167] ;

[0168] Based on the representation vector to be verified Pattern vectors of normal mode Distance between and the radius parameter of normal mode Calculate anomaly scores :

[0169] ;

[0170] Calculate the representation vector to be verified Cluster center vectors to each normal cluster distance :

[0171] ;

[0172] And based on the representation vector to be verified Cluster center vectors to each normal cluster distance Calculate drift score :

[0173] ;

[0174] Set an abnormal threshold With drift threshold The anomaly threshold and drift threshold are set based on expert experience.

[0175] Get the exception flag When abnormal scores Greater than the abnormal threshold At that time, abnormal flag It is 1 if it is true, otherwise it is 0;

[0176] Get Drift Mark When abnormal scores Less than or equal to the abnormal threshold And drift score Less than or equal to the drift threshold At that time, drift marker It is 1 if it is true, otherwise it is 0;

[0177] Based on medical business event data to be verified Corresponding business ID, anomaly score Drift score Abnormal signs and drift markers Generate audit logs.

[0178] like Figure 2 The illustrated ID automatic generation and deviation verification system includes:

[0179] The data acquisition and processing module is used to acquire medical business event data and perform de-identification encoding and dictionary encoding processing on the medical business event data;

[0180] The business ID generation module is used to construct business IDs based on UUIDv8 generation rules;

[0181] The appointment sequence construction module is used to arrange the medical business event data of the same patient generated continuously within the session interval into an appointment sequence by the event timestamp in ascending order.

[0182] The subsequence segmentation module is used to segment the medical visit sequence into multiple subsequences according to the window length. For each subsequence, the business ID is parsed to obtain the time slice integer value, the business main category integer code, and the business sub-category integer code, and a set of subsequence feature vectors is generated.

[0183] The normal pattern set construction module is used to obtain the training subsequence feature vector set using the subsequence feature vector set, build the normal pattern set of the dynamic normal model based on the training subsequence feature vector set, and perform adjacent hierarchical clustering on the subsequences in adjacent time periods to generate a normal cluster set.

[0184] The audit log generation module is used to acquire medical business event data to be verified and generate a representation vector to be verified. Based on the normal pattern set and normal cluster set of the dynamic normal model, it calculates the anomaly score and drift score, and generates anomaly flags and drift flags.

[0185] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A method for automatic ID generation and deviation verification, characterized in that, Includes the following steps: S1. Obtain medical business event data, perform desensitization and dictionary encoding processing on the medical business event data, and construct a business ID based on the UUIDv8 generation rules; S2. Arrange the medical business event data generated continuously by the same patient within the session interval in ascending order according to the event timestamp to form a medical visit sequence; S3. Divide the patient visit sequence into multiple sub-sequences according to the window length. For each sub-sequence, parse the business ID to obtain the time slice integer value, the business main category integer code, and the business sub-category integer code, and generate a set of sub-sequence feature vectors. S4. Obtain the training subsequence feature vector set using the subsequence feature vector set, establish the normal pattern set of the dynamic normal model based on the training subsequence feature vector set, and perform adjacent hierarchical clustering on the subsequences in adjacent time periods to generate a normal cluster set. S5. Obtain the medical business event data to be verified and generate the representation vector to be verified. Calculate the anomaly score and drift score based on the normal pattern set and normal cluster set of the dynamic normal model, and generate anomaly flags and drift flags.

2. The method for automatic ID generation and deviation verification according to claim 1, characterized in that, The medical business event data includes patient identifier, doctor identifier, expert identifier, consultation room identifier, diagnosis type identifier, treatment item identifier, treatment plan identifier, drug code, pharmacy node identifier, institution identifier, business category label, and event timestamp.

3. The method for automatic ID generation and deviation verification according to claim 1, characterized in that, The medical business event data underwent de-identification encoding and dictionary encoding processing as follows: Desensitization coding is performed on patient identifiers, doctor identifiers, and expert identifiers. The HMAC algorithm is used to generate corresponding fixed-length digest values, and the fixed-length digest values ​​are mapped to identifier bit segments. Dictionary encoding is performed on the institution identifier, clinic identifier, pharmacy node identifier, diagnosis type identifier, treatment item identifier, treatment plan identifier, and drug code to obtain the corresponding integer codes for institution identifier, clinic identifier, pharmacy node identifier, diagnosis type identifier, treatment item identifier, treatment plan identifier, and drug code. The integer codes for institution identifier, clinic identifier, and pharmacy node identifier are then mapped to the institution identifier business field bit segment, clinic identifier business field bit segment, and pharmacy node identifier business field bit segment, respectively, through a binary mapping function.

4. The method for automatic ID generation and deviation verification according to claim 1, characterized in that, The service ID is a binary string of length 128, which consists of a version bit string, a variant bit string, and a custom bit area string. The version bit string is a four-bit binary string, and the variant bit string is a binary string that meets the requirements of RFC4122 variant; The custom bit string is configured with the organization bit segment, service type bit segment, node bit segment, and time slice bit segment in sequence.

5. The method for automatic ID generation and deviation verification according to claim 4, characterized in that, The custom bit string is configured with the organization bit segment, service type bit segment, node bit segment, and time slice bit segment in sequence, as follows: Use the organization identifier business field bit segment as the organization bit segment; The main business class tag for acquiring medical business event data is encoded to generate an integer code for the main business class. Calculate the business category integer code based on the integer codes of diagnosis type identifier, diagnosis and treatment item identifier, treatment plan identifier, and drug code; The binary mapping function maps the main business class integer code and the sub-business class integer code to the main business class bit string and the sub-business class bit string respectively. The main business class bit string and the sub-business class bit string are then concatenated to form the business type bit segment. The node bit segment is composed of the clinic identification business field bit segment and the pharmacy node identification business field bit segment concatenated together; The time slice integer value is calculated based on the event timestamp, and the time slice integer value is mapped to the time slice bit segment through a binary mapping function.

6. The method for automatic ID generation and deviation verification according to claim 1, characterized in that, The medical service event data generated consecutively for the same patient within the session interval are arranged in ascending order by event timestamp to form a visit sequence, as follows: The medical business event data corresponding to the same patient is sorted in ascending order by event timestamp to obtain an ordered index sequence. The session interval is set, and the medical business event data corresponding to the ordered index sequence is traversed sequentially to perform session segmentation. For adjacent medical business event data, when the difference between the corresponding event timestamps is less than or equal to the session interval, the adjacent medical business event data are assigned to the same session. When the difference between the corresponding event timestamps is greater than the session interval, the data is split at the session boundary to obtain the patient's session sequence index set and the medical treatment sequence corresponding to each session.

7. The method for automatic ID generation and deviation verification according to claim 1, characterized in that, The patient visit sequence is divided into multiple sub-sequences according to the window length. For each sub-sequence, the business ID is parsed to obtain the time slice integer value, the main business category integer code, and the sub-business category integer code, and a set of sub-sequence feature vectors is generated, as follows: The patient visit sequence is divided into multiple sub-sequences according to a preset window length; The integer codes for diagnosis type, diagnosis and treatment items, treatment plan, drug, pharmacy node, time slice, main business category, and sub-business category of each medical business event data are combined into an event-level feature vector. Based on the event-level feature vector, a subsequence feature vector is constructed for each subsequence according to the subsequence index, and all subsequence feature vectors are combined into a subsequence feature vector set.

8. The method for automatic ID generation and deviation verification according to claim 1, characterized in that, The training subsequence feature vector set is obtained using the subsequence feature vector set. Based on the training subsequence feature vector set, a normal pattern set of the dynamic normal model is established, and adjacency hierarchical clustering is performed on subsequences within adjacent time periods to generate a normal cluster set, as follows: The training subsequence feature vector set is obtained based on the subsequence feature vector set, and the representation vector is obtained by normalizing each subsequence feature vector; Establish a set of normal patterns for the dynamic normal model. Each normal pattern in the set consists of a pattern vector of the normal pattern, the number of representation vectors contained in the normal pattern, and a triplet of the radius parameter of the normal pattern. All representation vectors in the feature vector set of the training subsequence are processed sequentially. When the normal pattern set is empty, the current representation vector is set as the pattern vector of the first normal pattern, the number of representation vectors contained in the corresponding normal pattern is set to 1, and the radius parameter of the corresponding normal pattern is set to 0. When the normal pattern set is not empty, calculate the distance between the current representation vector and the pattern vector of the normal pattern for each existing normal pattern, and select the normal pattern with the smallest distance as the nearest normal pattern. When the minimum distance is less than or equal to the radius parameter of the nearest normal pattern, the current representation vector is merged into the nearest normal pattern, the pattern vector of the nearest normal pattern is updated to a new vector obtained by weighted sum of the original pattern vector and the current representation vector, the number of representation vectors contained in the nearest normal pattern is increased by one, and the radius parameter of the nearest normal pattern is updated to the larger value between the original radius parameter and the minimum distance. When the minimum distance is greater than the radius parameter of the nearest normal pattern, a new normal pattern is added, the current representation vector is set as the pattern vector of the new normal pattern, the number of representation vectors contained in the new normal pattern is set to 1, and the radius parameter of the new normal pattern is set to 0. Divide all representation vectors in the feature vector set of the training subsequence into time periods, and use each representation vector in an adjacent time period as an initial cluster to form an initial cluster set; Set a clustering stopping threshold, calculate the inter-cluster distance between any two clusters in the current cluster set in each iteration, select the two clusters with the smallest inter-cluster distance, merge them and update the cluster set; When the distance between any two clusters in the updated cluster set is greater than the clustering stopping threshold, the merging stops, and a normal cluster set corresponding to adjacent time periods is obtained. The cluster center vector is then calculated for each normal cluster in the normal cluster set.

9. The method for automatic ID generation and deviation verification according to claim 1, characterized in that, The system acquires medical business event data to be verified and generates a representation vector to be verified. Based on the normal pattern set and normal cluster set of the dynamic normal model, it calculates the anomaly score and drift score, and generates anomaly and drift flags, as follows: Obtain the medical business event data to be verified, along with the corresponding business, the subsequence to be verified, and the representation vector to be verified. For each normal pattern, the distance between the representation vector to be verified and the pattern vector of the normal pattern is calculated based on the set of normal patterns. The anomaly score is calculated based on the distance between the vector to be verified and the pattern vector of the normal pattern, as well as the radius parameter of the normal pattern. Calculate the distance from the representation vector to be verified to the cluster center vector of each normal cluster, and calculate the drift score based on the distance from the representation vector to be verified to the cluster center vector of each normal cluster. Set an anomaly threshold and a drift threshold, and obtain anomaly flags and drift flags. When the anomaly score is greater than the anomaly threshold, the anomaly flag is 1; otherwise, the anomaly flag is 0. When the anomaly score is less than or equal to the anomaly threshold and the drift score is less than or equal to the drift threshold, the drift flag is 1; otherwise, the drift flag is 0. Audit records are generated based on the business ID, anomaly score, drift score, anomaly flag, and drift flag corresponding to the medical business event data to be verified.

10. An automatic ID generation and deviation verification system, used with any one of claims 1 to 9, characterized in that, include: The data acquisition and processing module is used to acquire medical business event data and perform de-identification encoding and dictionary encoding processing on the medical business event data; The business ID generation module is used to construct business IDs based on UUIDv8 generation rules; The appointment sequence construction module is used to arrange the medical business event data generated continuously by the same patient within the session interval into an appointment sequence by the event timestamp in ascending order. The subsequence segmentation module is used to segment the medical visit sequence into multiple subsequences according to the window length. For each subsequence, the business ID is parsed to obtain the time slice integer value, the business main category integer code, and the business sub-category integer code, and a set of subsequence feature vectors is generated. The normal pattern set construction module is used to obtain the training subsequence feature vector set using the subsequence feature vector set, build the normal pattern set of the dynamic normal model based on the training subsequence feature vector set, and perform adjacent hierarchical clustering on the subsequences in adjacent time periods to generate a normal cluster set. The audit log generation module is used to acquire medical business event data to be verified and generate a representation vector to be verified. Based on the normal pattern set and normal cluster set of the dynamic normal model, it calculates the anomaly score and drift score, and generates anomaly flags and drift flags.

Citation Information

Patent Citations

  • Medical time sequence data generation method and device considering diagnosis and treatment event relationship

    CN116759041A

  • Power multi-source data slice processing method and system based on reinforcement learning

    CN120724192A