A user phenotype identification method, device, medium and product based on hospital clinical data
By constructing a phenotypic semantic governance rule base and a multi-layer self-attention encoder model, hospital clinical data is standardized, which solves the problem of user phenotypic recognition accuracy caused by field changes and achieves stable recognition results when the field order and number change.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INSTITUTE OF BASIC MEDICAL SCIENCES CHINESE ACADEMY OF MEDICAL SCIENCES
- Filing Date
- 2026-05-13
- Publication Date
- 2026-08-04
AI Technical Summary
Existing hospital clinical data processing methods struggle to guarantee the accuracy of user phenotype identification results after changes in field order and quantity. Traditional modeling methods are ill-suited to adapting to field additions, deletions, and order adjustments, leading to a decline in the accuracy of the identification model.
By constructing a user phenotypic semantic governance rule base, the original phenotypic record set is standardized to generate a standardized phenotypic record set and a normalized phenotypic record set. The user phenotypic representation model with a multi-layer self-attention encoder and a multi-layer attention convergence layer is used for mining to generate phenotypic input vector sequences and effective position masks, thereby achieving stability of field order changes and data structure.
It improves the accuracy of user phenotype recognition results, ensures the stability of output when field order is adjusted and data structure changes, and can generate accurate risk probabilities of users suffering from certain diseases.
Smart Images

Figure CN122511618A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of hospital clinical data technology, and in particular to a method, device, medium and product for user phenotype recognition based on hospital clinical data. Background Technology
[0002] Most hospital clinical data processing methods employ fixed-column-width tables or manual feature engineering, requiring pre-determined field names, order, and number of fields. Within a single hospital, clinical data, while belonging to the same institution, may originate from different business systems such as electronic medical records, laboratory, examination, medication, treatment, and follow-up. These systems, after upgrades, interface modifications, departmental workflow adjustments, or changes in statistical time windows and aggregation methods, may exhibit changes such as added fields, deleted fields, altered field order, changed units of measurement, changes in the definition of identically named fields, or changes in missing data patterns. Since user phenotypic identification results are used to characterize the risk probability of a user having a certain type of disease, the accuracy of user phenotypic identification results obtained by mining the altered data using existing identification models cannot be guaranteed. Often, it is necessary to re-adapt the input structure and feature definitions to ensure accuracy, making long-term stable reuse difficult.
[0003] Furthermore, existing recognition models typically employ sequential encoding or positional encoding methods, often treating input position as semantic information. They assume the same field consistently appears in the same column or at the same index, or primarily model single-type event sequences. While these methods are effective when field order is stable and the number of fields is fixed, they struggle with deep phenotypic data containing continuous, enumerated, and multi-valued values, and are ill-suited to the frequent additions, deletions, and reordering of fields common in hospital systems. Therefore, the accuracy of the recognition model cannot be guaranteed after data changes. Summary of the Invention
[0004] The purpose of this application is to provide a method, device, medium, and product for user phenotype recognition based on hospital clinical data, which can improve the accuracy of user phenotype recognition results.
[0005] To achieve the above objectives, this application provides the following solution.
[0006] Firstly, this application provides a user phenotype identification method based on hospital clinical data, including: The hospital's clinical data is extracted to obtain the user's original phenotypic record set; the original phenotypic record set includes data of different types of users; each type of data records different phenotypic data; Based on the original phenotypic record set, a user's phenotypic semantic governance rule base is constructed; Based on the phenotypic semantic governance rule base, the original phenotypic record set is standardized to obtain a standardized phenotypic record set. Extracting from the standardized phenotypic record set yields a phenotypic item definition table and a normalized phenotypic record set; The phenotypic item definition table and the normalized phenotypic record set are transformed to obtain a numerical input matrix; Based on the numerical input matrix, a phenotypic input vector sequence and an effective position mask are generated; Based on the numerical input matrix, the phenotypic input vector sequence, and the effective location mask, a trained user phenotypic representation model is used for mining to obtain the user's phenotypic recognition result; the user phenotypic representation model includes a multi-layer self-attention encoder and a multi-layer attention convergence layer.
[0007] Secondly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described user phenotype recognition method based on hospital clinical data.
[0008] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described user phenotype recognition method based on hospital clinical data.
[0009] Fourthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described user phenotype recognition method based on hospital clinical data.
[0010] According to the specific embodiments provided in this application, this application has the following technical effects: This application generates a raw phenotypic record set representing users by extracting different types and phenotypic data from hospital clinical data. This set not only covers various types of user data within the hospital but also different phenotypic representations of those data. Based on this raw phenotypic record set, a phenotypic semantic governance rule base is constructed. Then, based on this rule base, the raw phenotypic record set is standardized to obtain a standardized phenotypic record set. Extraction from this standardized phenotypic record set yields a phenotypic item definition table and a normalized phenotypic record set. This process transforms data from the raw phenotypic record set that has inconsistent field names, units of measurement, and value types into a computable standardized phenotypic record set, a normalized phenotypic record set, and their tokenized results. This ensures that the model input has a unified, traceable, and reproducible data structure. For phenotypic items... The definition table and normalized phenotypic record set are transformed to obtain a numerical input matrix. Based on the numerical input matrix, a phenotypic input vector sequence and an effective position mask are generated. Based on the numerical input matrix, the phenotypic input vector sequence, and the effective position mask, a trained user phenotypic representation model is used for mining to obtain the user's phenotypic recognition result. This allows the trained user phenotypic representation model to generate accurate recognition results without relying on the field arrangement order. By carrying the user's identity through the normalized phenotypic record set, adjusting the field order only changes the input arrangement without changing the meaning of the phenotypic items. Adding or deleting fields will not cause the overall position of existing fields to shift. This improves the output stability when the field order changes, the field is added, deleted, or the missing pattern changes, as well as the accuracy of the user phenotypic recognition result (i.e., the risk probability of a user having a certain type of disease). Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a flowchart illustrating a user phenotype identification method based on hospital clinical data provided in this application.
[0013] Figure 2 This is a schematic diagram of the structure of a user phenotype recognition system based on hospital clinical data provided in this application.
[0014] Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application.
[0015] Figure labeling: Data access module-1; Construction module-2; Standardization governance module-3; Phenotypic item identifier generation module-4; Tokenization and vocabulary module-5; Input encoding module-6; User phenotypic recognition module-7. Detailed Implementation
[0016] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0017] This application focuses not on a single data cleaning problem, but on the problem of unified representation of user phenotypic data. Even if user data comes from the same hospital and the field types are the same, it does not necessarily mean that the clinical meaning, measurement unit, statistical time window, collection scenario, aggregation method and missing meaning are the same. Therefore, when the clinical system is upgraded, fields are added or deleted, the order is adjusted and the missing pattern changes, it is still necessary to generate user phenotypic representation vectors with consistent meanings that can be reused in the long term.
[0018] Unlike traditional ordered encoding methods that rely on column position, input order, or fixed-width table structure, traditional methods typically treat the column position or input order of a field as part of the phenotypic meaning. For example, the tenth column is assumed to represent serum creatinine, and the eleventh column represents white blood cell count. If the hospital system adds, deletes, or adjusts the order of fields, or changes the imputation method for missing fields, the meaning of the same user record in the model may shift. This application does not require user data in the original phenotypic record set to be arranged with a fixed column width. Instead, it represents user phenotypic data as a combination of several "phenotypic item tags - value tags," that is, a semantically unordered set of paired tags consisting of phenotypic item tags and value tags corresponding to standardized phenotypic item identifiers. Here, a phenotypic item refers to a type of clinical data item that can describe a user's status, such as serum creatinine, white blood cell count, systolic blood pressure, weight, the result of a certain examination, or a certain type of medication record. A standardized phenotypic item identifier is a standardized identifier used to uniquely identify a clinical phenotypic item and its statistical time window and aggregation method, used to clarify "what was measured, what unit was used, which statistical time window was used, and how it was summarized." For example, "the most recent serum creatinine level during this hospitalization, in micromoles per liter" is a phenotypic item with a different scope than "the average serum creatinine level over the year prior to admission." This application does not use manually arranged field positions as a semantic source, but rather determines the true clinical meaning of each phenotypic item through the standardized phenotypic item identifiers in the standardized phenotypic record set. It should be noted that the absence of positional coding in this application does not imply the removal of clinical time information; the clinical time meaning is expressed by statistical time windows and aggregation methods, and participates in subsequent labeling and coding as part of the standardized phenotypic item identifiers.
[0019] This application, on a user-by-user basis, unifies multi-source heterogeneous data from electronic medical records, diagnostic data, laboratory data, examination data, treatment data, medication data, and follow-up data into standardized phenotypic record sets and normalized phenotypic record sets. The transformation then yields a numerical input matrix, generating a phenotypic input vector sequence and an effective location mask. Finally, a pre-trained user phenotypic representation model is used for mining to obtain the user's phenotypic identification result (i.e., the risk probability of the user having a certain type of disease). The user phenotypic identification result may also include user stratification results, similar sample retrieval results, or phenotypic cue ranking results.
[0020] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0021] In one exemplary embodiment, such as Figure 1As shown, a user phenotype recognition method based on hospital clinical data is provided. This method is executed by a computer device, specifically by a terminal or server alone, or by both a terminal and a server. In this embodiment, the method is described using a server as an example, and includes the following steps S1 to S7.
[0022] Step S1: Extract clinical data from the hospital to obtain the user's original phenotypic record set; the original phenotypic record set includes different types of data from the user; each type of data record contains different phenotypic data.
[0023] As an feasible approach, the original phenotypic record set includes: electronic medical record data, diagnostic data, laboratory data, examination data, treatment data, medication data, and follow-up data; step S1 specifically includes steps S11 to S12: Step S11: Obtain the user's unique identifier and the unique identifier for medical treatment.
[0024] Step S12: De-identify the user's unique identifier to obtain a de-identified user-associated identifier.
[0025] Step S13: Based on the de-identified user association identifier, the unique identifier of the visit, and the preset statistical time window, extract the hospital clinical data to obtain the user's original phenotypic record set.
[0026] Specifically, raw data is collected from different clinical business systems according to the dimensions of user unique identifier and visit unique identifier to form a raw phenotypic record set that can be used for subsequent management. The user unique identifier is de-identified to obtain a de-identified user association identifier. The hospital's clinical data is then extracted according to the de-identified user association identifier, visit unique identifier, and preset statistical time window. Specifically, electronic medical record data, diagnostic data, laboratory data, examination data, treatment data, medication data, and follow-up data are extracted. Multi-source records of the same user within the preset statistical time window are merged. The original user unique identifier is not used as input for model training and inference, resulting in the user's raw phenotypic record set.
[0027] Step S2: Based on the original phenotypic record set, construct the user's phenotypic semantic governance rule base.
[0028] As an implementable approach, the phenotypic semantic governance rule base includes: master index rules, field synonym rules, standard item coding rules, unit of measurement conversion rules, statistical time window rules, aggregation method rules, value type rules, missing semantic rules, anomaly conflict determination rules, and source tracing rules.
[0029] Specifically, based on the original phenotypic record set, a versionable user phenotypic semantic governance rule base is established, and the phenotypic semantic governance rule base is used as the unified basis for subsequent standardization in step S3 (such as merging, mapping, conversion, time window inclusion, missing semantic annotation and quality judgment).
[0030] Step S3: Based on the phenotypic semantic governance rule base, standardize the original phenotypic record set to obtain a standardized phenotypic record set.
[0031] Specifically, step S3 is not merely about routine deduplication, desensitization, and format cleaning, nor is it a necessary prerequisite for merging data from multiple hospitals or across institutions. Even within a single hospital, clinical business systems such as electronic medical records, laboratory tests, examinations, treatments, medication administration, and follow-ups may produce records with inconsistent field names, local codes, units of measurement, event times, aggregation methods, missing meanings, and source evidence due to differences in system versions, interface sources, departmental workflows, statistical time windows, or aggregation methods. Even if field types are the same—numerical, enumerated, or text—it does not necessarily mean their clinical meanings are consistent. Therefore, the object of step S3 is not simply to unify field types, but to unify the clinical semantics, unit caliber, time caliber, value caliber, missing meanings, and quality evidence expressed by the records. Here, the clinical phenotype can be understood as the actual user status described by a record, such as a serum creatinine test result, the average systolic blood pressure within a certain time window, the result status of a certain examination item, or a certain type of medication record.
[0032] As one feasible approach, step S3 specifically includes steps S31 to S35: Step S31: Based on the main index rules and source tracing rules, using the de-identified user association identifier and the unique medical visit identifier as the main index, merge the records belonging to the same user in the original phenotypic record set to obtain the candidate phenotypic record set.
[0033] Specifically, using the main index rules and source tracing rules in the phenotypic semantic governance rule base of step S2, with the de-identified user association identifier and the unique medical visit identifier as the main index, duplicate records belonging to the same user, the same medical visit, or the same statistical time window in the original phenotypic record set output by S1 are merged. The source system, source field, original value, original unit, original event time, processing time, and rule version are retained in the merged candidate phenotypic records, thereby forming a candidate phenotypic record set that can continue to perform semantic judgment and whose source can be traced back.
[0034] Step S32: Based on the field synonym rule, standard item coding rule, statistical time window rule, and aggregation method rule, the candidate phenotype record set is judged to obtain the standard clinical meaning of each data in the candidate phenotype record set; the standard clinical meaning includes the standard item code and the standard item name.
[0035] Specifically, based on the candidate phenotypic record set formed in step S31 and its retained source fields, original values, original units, and original event times, the field synonym rules, standard item coding rules, statistical time window rules, and aggregation method rules in the phenotypic semantic governance rule base of step S2 are invoked to determine the clinical meaning of each record, thus obtaining the standard clinical meaning of each data point in the candidate phenotypic record set. For records with different field names, local codes, or units of measurement but representing the same clinical meaning, they are mapped to the same standard item code and standard item name. For example, "Cr," "CREA," and "creatinine" can be mapped to the same serum creatinine item when the units, statistical time windows, and aggregation methods are consistent. For records with the same field name but different units of measurement, statistical time windows, collection scenarios, or aggregation methods, they are split into different standard items. For example, "most recent serum creatinine" and "average serum creatinine over the past thirty days" are used as standard items with different scopes. In other words, the original source evidence retained in step S32 is used to support the synonym merging and heteronym splitting in this step, preventing the model from treating data with different scopes as the same feature simply because the column names are the same.
[0036] Step S33: Based on the unit conversion rules, statistical time window rules, and value type rules, the standard clinical meaning of each data point in the candidate phenotype record set is standardized in terms of value and time, resulting in a standardized candidate phenotype record set. The standardized candidate phenotype record set includes: standard unit, standardized value, value type, and statistical time window.
[0037] Specifically, for each data point in the candidate phenotype record set from step S32, based on its standard clinical meaning, the unit conversion rules, statistical time window rules, and value type rules from the phenotype semantic governance rule base in step S2 are called again to unify the values and time caliber, resulting in a unified candidate phenotype record set. For continuous values, such as serum creatinine, white blood cell count, or systolic blood pressure, the original values are converted to standardized values in standard units according to the unit dimension. For diagnostic, testing, examination, treatment, medication, and follow-up events, the original event times retained in step S31 are assigned to preset statistical time windows, such as 30 days before admission, during the current visit, or 3 months after follow-up, and the start and end times of the window are recorded. For enumerated, multi-valued, and text-based values, they are converted to a unified value format, such as converting positive / negative, normal / abnormal, and occurred / not occurred states into unified state values.
[0038] Step S34: Based on the missing semantic rules and the abnormal conflict judgment rules, perform missing and quality identification on the unified candidate phenotypic record set to obtain the identified candidate phenotypic record set; the identified candidate phenotypic record set includes: missing semantic state, quality mark, source traceability mark and governance rules.
[0039] Specifically, based on the unified candidate phenotypic record set (i.e., standard units, standardized values, and statistical time windows) obtained in step S33, the missing semantic rules and abnormal conflict judgment rules in the phenotypic semantic governance rule base of step S2 are called to distinguish between missing and quality issues, resulting in the identified candidate phenotypic record set. For records that are not collected, collected but not recorded, cannot be identified, are not applicable, and are true negatives, different missing semantic states are generated, such as "this test was not performed," "it was performed but the result was not returned," "this test is not applicable to this user," and "the result is negative," which are not confused. For records that are outside the physiological range, have mismatched units, or have conflicting results across systems, a quality mark is generated by combining the source traceability information retained in step S31. The source traceability information includes the source traceability identifier, source system, source field, original value, original unit, and original event time, forming an original chain of evidence when necessary.
[0040] Step S35: Summarize the candidate phenotype record set, standard clinical meaning, unified candidate phenotype record set, and identified candidate phenotype record set to determine the standardized phenotype record set.
[0041] Specifically, the candidate phenotypic records, standard item codes, standard item names, standard units, standardized values, value types, statistical time windows, missing semantic states, quality markers, source traceability identifiers, and governance rule versions generated in steps S31 to S34 are summarized to output a standardized phenotypic record set. Each standardized phenotypic record in the standardized phenotypic record set includes at least a de-identified user association identifier, a unique patient visit identifier, a data field, a standard item code, a standard item name, a standard unit, a standardized value, a value type, a statistical time window, a missing semantic state, a quality marker, a source traceability identifier, and a governance rule version. The resulting standardized phenotypic record set is not a wide table dependent on fixed column positions, but a traceable record set centered on clinical meaning; when subsequent fields are added or deleted, field order is adjusted, the source system changes, or the missing pattern changes, step S4 can still generate stable standardized phenotypic item identifiers based on the same clinical meaning.
[0042] Step S4: Extract the standardized phenotypic record set to obtain the phenotypic item definition table and the normalized phenotypic record set.
[0043] Specifically, standardized phenotypic records are centralized with standardized phenotypic item identifiers. These identifiers can be understood as the "identity card" of clinical phenotypic items within the system, determined by the data domain, standard item code, unit of measurement, statistical time window, aggregation method, and version information. The statistical time window is, for example, 30 days prior to admission, during the current visit, or 3 months after follow-up. The aggregation method is, for example, the most recent, average, maximum, or count. Through this identifier, records with different names but consistent clinical meanings from different systems are grouped into the same phenotypic item, while records with the same name but different units, time windows, or aggregation methods are distinguished as different phenotypic items.
[0044] Specifically, the main purpose of step S4 is to generate unique identifiers for each phenotypic item with consistent clinical meaning, statistical time window, and aggregation method, ensuring that subsequent labeling and model input do not depend on the original field names. The standardized phenotypic record set output from step S3 is used to generate unique normalized phenotypic item identifiers for each phenotypic data with the same clinical meaning, statistical time window, and aggregation method, according to the combination rules of "data domain, standard item code, unit of measurement, statistical time window, and aggregation method." The normalized phenotypic item identifier can be understood as the unique identifier of the clinical phenotypic item in the model, used to answer "which clinical item this value corresponds to, what unit is used, which statistical time window, and how it is summarized." For example, if different systems write "Cr" and "CREA" but both represent serum creatinine in the same unit and statistical time window, they are mapped to the same normalized phenotypic item identifier; however, if test items with the same name have different units, time windows, or aggregation methods, different normalized phenotypic item identifiers are generated. For example, "highest systolic blood pressure during this visit" and "average systolic blood pressure during this visit" correspond to different normalized phenotypic item identifiers due to different aggregation methods. The aggregation method must include at least one of the following: most recent, average, maximum, minimum, and count. The phenotypic item definition table records the normalized phenotypic item identifier, phenotypic item identifier version number, effective time, data field, standard item code, unit of measurement, statistical time window, and aggregation method. The normalized phenotypic record set is formed by adding the corresponding normalized phenotypic item identifier, phenotypic item identifier version number, and aggregation method to each record based on the normalized phenotypic record set output in step S3; it retains the normalized values, value types, missing semantic states, quality markers, and source traceability identifiers from step S3, resulting in the phenotypic item definition table and the normalized phenotypic record set, which serve as the direct input for the tokenization in step S5.
[0045] Step S5: Transform the phenotypic item definition table and the normalized phenotypic record set to obtain the numerical input matrix.
[0046] Specifically, the main purpose of step S5 is to convert the normalized phenotypic item identifiers and their corresponding values in the normalized phenotypic record set obtained in step S4 into tags and tag numbers that the model can read, and to form a paired tag sequence, a phenotypic item vocabulary, a value vocabulary, and a numerical input matrix.
[0047] As one feasible approach, step S5 specifically includes steps S51 to S55: Step S51: Initialize the table of table items and the table of table values.
[0048] Specifically, initialize or call a fixed version of the phenotypic item vocabulary and the value vocabulary; if a historical version of the vocabulary exists, read the vocabulary version number, the registered flag, the unknown phenotypic item flag and the filled phenotypic item flag in the phenotypic item vocabulary, and the unknown value flag, the filled value flag and the mask flag in the value vocabulary to obtain the phenotypic item vocabulary and the value vocabulary, so as to ensure that the numbering rules of this batch of data are consistent with the existing model input numbering rules.
[0049] Step S52: Generate multiple phenotypic item tags based on the phenotypic item definition table and the phenotypic item thesaurus.
[0050] Specifically, based on the normalized phenotypic item identifiers in the phenotypic item definition table, a query is performed through the phenotypic item thesaurus to generate multiple phenotypic item tags for each item. For normalized phenotypic item identifiers already existing in the phenotypic item thesaurus, the existing phenotypic item tags and phenotypic item tag numbers are retained. For normalized phenotypic item identifiers that are allowed to be added but have not yet been registered, new phenotypic item tags and phenotypic item tag numbers are assigned, and the normalized phenotypic item identifier, phenotypic item tag number, thesaurus version number, and effective time are recorded in the phenotypic item thesaurus. For phenotypic items that appear during the inference phase but are not allowed to be added in the current version, they are mapped to unknown phenotypic item tags, resulting in multiple phenotypic item tags.
[0051] Step S53: Generate multiple value tags based on the normalized phenotypic record set and the value vocabulary.
[0052] Specifically, based on the value types in the standardized phenotype record set, a query is performed using a value terminology to generate multiple value tags for each record. For continuous values, such as serum creatinine, white blood cell count, or systolic blood pressure, intervals are defined according to clinical thresholds, training set percentile thresholds, or equal-frequency binning thresholds, and the intervals into which the standardized values fall are identified as interval value tags. For enumerated values, such as negative / positive, normal / abnormal, occurred / not occurred, corresponding value tags are generated according to a unified enumeration status. For multi-valued values, such as a user having multiple abnormal examination items or multiple medication records, each candidate item is used to generate a derived standardized phenotype item identifier based on the parent standardized phenotype item identifier and the candidate item standard item code. This derived standardized phenotype item identifier is then registered or queried as a sub-phenotype item in the phenotype item definition table and phenotype item terminology, and an occurrence tag or non-occurrence tag is generated for the corresponding sub-phenotype item. For missing values and unknown values, missing value tags and unknown value tags are generated respectively.
[0053] Step S54: Generate a pairing tag sequence based on multiple phenotypic item tags and multiple value tags.
[0054] Specifically, paired tag sequences are generated on a user-by-user basis. The tokenization and vocabulary module aggregates normalized phenotypic records of the same user according to the de-identified user association identifier, converting each normalized phenotypic item identifier and its value into a paired tag. A paired tag consists of a phenotypic item tag corresponding to the normalized phenotypic item identifier and a value tag, and multiple paired tags form a paired tag sequence. The paired tag sequence can be arranged according to phenotypic item tag number, record generation time, or preset stable rules, but this arrangement is only used for matrix storage and batch calculation and does not indicate that the field position has clinical meaning.
[0055] Step S55: Generate a numerical input matrix based on multiple phenotypic item tags, multiple value tags, and a sequence of paired tags.
[0056] Specifically, a numerical input matrix is formed: phenotypic item tags in the pairing tags are converted into phenotypic item tag numbers according to the phenotypic item vocabulary, and value tags in the pairing tags are converted into value tag numbers according to the value vocabulary; each matrix position corresponds to a pairing tag, including a phenotypic item tag number and a value tag number; for user records with more than the preset maximum number of pairs, pairing tags are retained according to the preset truncation rules; for positions with less than the preset maximum number of pairs, padding is performed using padding pairing tags, and padding phenotypic item tag numbers and padding value tag numbers are filled in respectively.
[0057] Specifically, version and integrity checks can be performed on the numerical input matrix generated in step S55. It is checked that the tag number of each phenotypic item in the numerical input matrix can be traced back to the phenotypic item vocabulary, and the tag number of each value can be traced back to the value vocabulary, and the vocabulary version number is recorded. When unregistered phenotypic items or values appear in subsequent data, they are mapped to unknown phenotypic item tags or unknown value tags respectively, to maintain the stability of the encoding rules of the numerical input matrix. The output consists of a pairing tag sequence, a phenotypic item vocabulary, a value vocabulary, and a numerical input matrix. The pairing tag sequence comprises multiple pairing tags, each including a phenotypic item tag and its corresponding value tag, used to store the correspondence between user-level phenotypic items and their values. The phenotypic item vocabulary stores the correspondence between normalized phenotypic item identifiers, phenotypic item tags, and phenotypic item tag numbers. The value vocabulary stores the correspondence between value tags, value tag numbers, and value meanings. The numerical input matrix is obtained by converting the phenotypic item tags and value tags in the pairing tag sequence into phenotypic item tag numbers and value tag numbers respectively, without masking or random value replacement.
[0058] Step S6: Based on the numerical input matrix, generate the phenotypic input vector sequence and the effective position mask.
[0059] As an implementable approach, step S6 specifically includes: extracting the numerical input matrix to obtain a sequence of phenotypic input vectors; and performing random masking on the numerical input matrix to obtain an effective position mask.
[0060] Specifically, the main purpose of step S6 is to convert the phenotypic item label numbers and value label numbers in the numerical input matrix output by S5 into a phenotypic input vector sequence, while avoiding the model's use of the column position information of the fields. The input is a numerical input matrix that conforms to the vocabulary and numbering rules of S5; the meaning of the numbering in the numerical input matrix is determined by the phenotypic item vocabulary and value vocabulary output by step S5, and each non-filled matrix position corresponds to a paired label in the paired label sequence of step S5. During the training phase, the positionless input encoding method of step S6 is applied to the sample numerical input matrix, sample phenotypic input vector sequence, and sample effective position mask generated in step S7 in the training set; during the inference phase, the positionless input encoding method of step S6 is applied to the numerical input matrix used in step S7. First, the embedding vectors of phenotypic item labels corresponding to the phenotypic item numbers in the numerical input matrix are queried, and the embedding vectors of value labels corresponding to the value labels in the numerical input matrix are also queried. Preferably, both the phenotypic item embedding vectors and the value embedding vectors are 256-dimensional. Then, the two are added element-wise to obtain the input vector for each "phenotypic item-value" combination. Multiple input vectors from non-filled matrix positions together form a sequence of phenotypic input vectors. Subsequently, an effective position mask is generated based on the filling pairing label positions in the numerical input matrix, but position encoding is not introduced. The effective position mask is a computational mask generated from the filling pairing label positions and is used to exclude filling positions in the attention calculation. It is different from the mask label in the value vocabulary in step S5, and also different from the mask replacement in mask pre-training in step S7. Specifically, the mask label is used to temporarily replace the observed values that are masked, and the effective position mask only identifies which matrix positions participate in the calculation or do not participate in the calculation, without changing the value label itself. That is, only the phenotypic items and their values that the user has are read, not the column or position of the item. Unlike traditional ordered encoding, this step does not assume that "a certain position corresponds to a fixed field." In traditional methods, if the tenth column originally represented serum creatinine, and the meaning of the tenth column changes after the addition of fields or reordering, the model may mistakenly identify different phenotype items as the same phenotype item. In this step, the phenotype item label number in the numerical input matrix generated in step S5 carries the item identity itself; the input order is only used for calculation arrangement and does not serve as a source of clinical meaning. It should be noted that not introducing positional encoding does not remove clinical time information; the statistical time window and aggregation method are included in step S5 as part of the normalized phenotype item identifier. The start and end times of the window are retained as record-level metadata in the normalized phenotype record set to determine the time window to which the value belongs, but they do not participate in the model semantics as field position or input order. For example, "average serum creatinine in the thirty days prior to admission" and "most recent serum creatinine during this visit" are treated as different phenotype items. Among them, missing value labels and unknown value labels participate in encoding as valid input labels, and the filling position does not participate in attention calculation.
[0061] Step S7: Based on the numerical input matrix, phenotypic input vector sequence, and effective location mask, the trained user phenotypic representation model is used for mining to obtain the user's phenotypic recognition result; the user phenotypic representation model includes a multi-layer self-attention encoder and a multi-layer attention convergence layer.
[0062] As an feasible approach, the training process of the user phenotypic representation model specifically includes: constructing a training set; the training set includes: a sample numerical input matrix, a sample phenotypic input vector sequence, a sample effective location mask, and sample phenotypic recognition results; constructing a user phenotypic representation model; inputting the sample numerical input matrix, the sample phenotypic input vector sequence, and the sample effective location mask into the user phenotypic representation model to obtain the predicted phenotypic recognition results; based on the predicted phenotypic recognition results and the sample phenotypic recognition results, constructing a loss function, and iteratively optimizing the parameters of the user phenotypic representation model based on the loss function until the loss function converges or reaches the maximum number of iterations, thus obtaining the trained user phenotypic representation model.
[0063] Specifically, the main purpose of training the user phenotypic representation model is to learn the associations between different phenotypic items and values through mask pre-training, thereby obtaining a reusable trained user phenotypic representation model. The input consists of a sample numerical input matrix, a sequence of sample phenotypic input vectors, and a sample effective position mask from the training set. The sample effective position mask is generated by filling the paired marker positions in the sample input numerical matrix. It should be noted that the same phenotypic item vocabulary, value vocabulary, marker numbering rules, and matrix structure are used in both the training and inference phases, but the input content differs: in the training phase, the sample effective position mask is generated based on the output sample numerical input matrix, using the sample numerical input matrix without training perturbation. During training, 15% of the unfilled and observed value markers in the sample numerical input matrix are randomly selected as prediction targets, and the original value marker numbers of the selected positions are retained as training labels. Then, a mask training input matrix is generated, where 80% of the selected positions are replaced with value marker numbers corresponding to the mask markers reserved in the value vocabulary, 10% are replaced with random value marker numbers from the same data domain and with compatible value types, and 10% retain their original value marker numbers. Simultaneously, a sample effective position mask is generated based on the filling pair marker positions. This sample effective position mask does not participate in value replacement but is only used to exclude filling positions. Unselected observed positions retain their original value marker numbers, and filling positions retain both the filling phenotypic item marker number and the filling value marker number. This sample effective position mask pre-training can be understood as temporarily inserting reserved mask markers into the training samples to mask some known values, requiring the model to recover the original value markers before masking based on the remaining phenotypic information of the same user. Subsequently, the input is extracted using the positionless input encoding method of S6, converting the sample numerical input matrix into a phenotypic input vector sequence, which is then input into the user phenotypic representation model. The user phenotypic representation model employs a six-layer self-attention encoder, each layer including eight attention heads, residual connections, layer normalization, and a feedforward network. The hidden layer dimension of the feedforward network is preferably 1024 dimensions. An attention convergence layer is connected after the encoder to generate the user phenotypic representation vector. The user phenotypic representation model predicts the original value label of the selected position based on information from other positions and calculates a low-frequency value weighted cross-entropy loss at the selected position, assigning higher weights to low-frequency value labels to ensure that rare phenotypic values are not ignored by the model due to their infrequent occurrence. The optimizer uses an adaptive moment estimation optimizer, with an initial learning rate preferably of 0.0001, a batch size preferably of 64, and a maximum training epoch preferably of 50 epochs. Training stops when the validation set loss no longer decreases for five consecutive epochs, and the model parameters with the best performance on the validation set are retained, resulting in the finally trained user phenotypic representation model.
[0064] Specifically, the pre-trained user phenotypic representation model is invoked to generate phenotypic recognition results for each user. The numerical input matrix refers to a numerical input matrix that has the same vocabulary, label numbering rules, and matrix structure as the sample numerical input matrix from the training phase, but without mask replacement, without inserting reserved mask labels, without replacing them with randomly selected labels, and retains all available user pair labels, which are numbered and filled according to the rules. The active data mining task configuration includes task type, task parameters, and task rules. The task type includes at least one of user stratification, similar sample retrieval, and phenotypic clue ranking. Task parameters include at least one of the following: number of clusters, stratification threshold, similarity metric, number of candidate samples, reference sample set, phenotypic clue ranking rules, or number of results.
[0065] During inference, mask replacement and training labels are no longer performed. Instead, the numerical input matrix, phenotypic input vector sequence, and effective position mask are input into the trained user phenotypic representation model. The trained user phenotypic representation model generates the phenotypic input vector sequence and effective position mask according to the positionless input encoding method in the training phase. The results are then passed through a self-attention encoder and an attention convergence layer to obtain the user's phenotypic recognition result.
[0066] In addition to representing the risk probability of a user having a certain type of disease, the user's phenotypic identification results can also be used for proactive data mining. Downstream processing is then performed according to the subsequent proactive mining task configuration: When the task type is user stratification, vector clustering, threshold grouping, or similarity grouping are performed based on the user's phenotypic identification results, and the user stratification results are output; when the task type is similar sample retrieval, the vector distance or similarity between the user's phenotypic identification results and the candidate user phenotypic representation vectors is calculated, and the similar sample retrieval results are output according to the similarity magnitude; when the task type is phenotypic clue ranking, a ranking score is calculated according to preset phenotypic clue ranking rules, a reference sample set, or vector similarity rules, and the phenotypic clue ranking results are output. The proactive mining results can be used as examples for phenotypic data exploration or research cohort screening. These proactive mining results include user stratification results, similar sample retrieval results, or phenotypic clue ranking results.
[0067] The beneficial effects of the user phenotype identification method based on hospital clinical data proposed in this application are mainly reflected in: 1. It can uniformly convert hospital phenotypic data with inconsistent field names, inconsistent units of measurement, and mixed value types into computable standardized phenotypic record sets, normalized phenotypic record sets, and their tokenized results, so that the input of the trained user phenotypic representation model has a unified, traceable, and reproducible data structure.
[0068] 2. This application enables users to identify phenotypic results independently of field order. Compared with traditional ordered encoding, this application does not use column position or input order as the source of meaning for phenotypic items, but instead uses standardized phenotypic item identifiers to carry item identity. Therefore, adjusting the field order only changes the input arrangement and does not change the meaning of phenotypic items. Adding or deleting fields will not cause an overall shift in the position of existing fields, thereby improving the output stability when field order changes, fields are added or deleted, or the missing pattern changes.
[0069] 3. It enables trained user phenotypes to recover masked values using unmasked phenotype information, improving the ability to learn from missing data, rare phenotypes, and long-tailed phenotypes.
[0070] 4. It enables different active mining tasks to share the phenotypic recognition results of the same user; active mining changes the downstream stratification, retrieval or ranking rules by adjusting the active mining task configuration without retraining the user phenotypic representation model, thereby avoiding the inconsistency of input caused by defining field positions and manual feature sets separately due to task switching, and improving the reusability of active mining results under different research topics and different time windows.
[0071] 5. By carrying user identity through the normalized phenotypic record set, adjusting the field order only changes the input arrangement without altering the meaning of the phenotypic items. Adding or deleting fields will not cause an overall shift in the position of existing fields, thus improving the output stability when the field order changes, fields are added, deleted, or the missing pattern changes, as well as the accuracy of user phenotypic identification results (i.e., the risk probability of a user having a certain type of disease).
[0072] 6. By combining "standardized phenotypic item identification, hierarchical labeling, positionless input encoding and mask pre-training", user multi-source clinical phenotypic information is mapped to a unified phenotypic representation space, so that the user phenotypic representation vector remains stable when the field order changes, the field is added, deleted and missing patterns change, and the reusability of active mining results under different research topics and different time windows is improved.
[0073] Based on the same inventive concept, this application also provides a user phenotype recognition system based on hospital clinical data. The solution provided by this system is similar to the solution described in the above method. Therefore, the specific limitations of one or more user phenotype recognition system embodiments based on hospital clinical data provided below can be found in the limitations of the user phenotype recognition method based on hospital clinical data described above, and will not be repeated here.
[0074] In one exemplary embodiment, such as Figure 2 As shown, a user phenotype recognition system based on hospital clinical data is provided, including: Data access module 1 is used to extract hospital clinical data to obtain the user's original phenotypic record set; the original phenotypic record set includes different types of data from the user; each type of data record contains different phenotypic data.
[0075] Module 2 is used to build a user's phenotypic semantic governance rule base based on the original phenotypic record set.
[0076] The standardization governance module 3 is used to standardize the original phenotypic record set based on the phenotypic semantic governance rule base to obtain a standardized phenotypic record set.
[0077] Phenotypic item identifier generation module 4 is used to extract standardized phenotypic record sets to obtain phenotypic item definition tables and standardized phenotypic record sets.
[0078] The tokenization and vocabulary module 5 is used to transform the phenotypic item definition table and the normalized phenotypic record set to obtain a numerical input matrix.
[0079] Input encoding module 6 is used to generate a phenotypic input vector sequence and an effective position mask based on the numerical input matrix.
[0080] User phenotypic recognition module 7 is used to mine user phenotypic recognition results based on numerical input matrix, phenotypic input vector sequence and effective position mask using a trained user phenotypic representation model; the user phenotypic representation model includes a multi-layer self-attention encoder and a multi-layer attention convergence layer.
[0081] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 3 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores the user's original phenotypic record set. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a user phenotypic recognition method based on hospital clinical data.
[0082] Those skilled in the art will understand that Figure 3 The structures shown are merely block diagrams of some structures related to the present application and do not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than shown in the figures, or combine certain components, or have different component arrangements. In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0083] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0084] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0085] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0086] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
[0087] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, etc., and are not limited to these.
[0088] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0089] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A user phenotype identification method based on hospital clinical data, characterized in that, include: The hospital's clinical data was extracted to obtain the user's original phenotypic record set; The original phenotypic record set includes different types of user data; Each type of data record has different table data; Based on the original phenotypic record set, a user's phenotypic semantic governance rule base is constructed; Based on the phenotypic semantic governance rule base, the original phenotypic record set is standardized to obtain a standardized phenotypic record set; Extracting from the standardized phenotypic record set yields a phenotypic item definition table and a normalized phenotypic record set; The phenotypic item definition table and the normalized phenotypic record set are transformed to obtain a numerical input matrix; Based on the numerical input matrix, a phenotypic input vector sequence and an effective position mask are generated; Based on the numerical input matrix, the phenotypic input vector sequence, and the effective location mask, a trained user phenotypic representation model is used for mining to obtain the user's phenotypic recognition result; the user phenotypic representation model includes a multi-layer self-attention encoder and a multi-layer attention convergence layer.
2. The user phenotyping method based on hospital clinical data according to claim 1, characterized in that, The original phenotypic record set includes: electronic medical record data, diagnostic data, laboratory data, examination data, treatment data, medication data, and follow-up data; By extracting clinical data from hospitals, the user's original phenotypic record set is obtained, specifically including: Obtain the user's unique identifier and the unique identifier for medical treatment; The user's unique identifier is de-identified to obtain a de-identified user-associated identifier; Based on the de-identified user association identifier, the unique medical visit identifier, and the preset statistical time window, the hospital's clinical data is extracted to obtain the user's original phenotypic record set. 3.The user phenotyping method based on hospital clinical data according to claim 2, characterized in that, The phenotypic semantic governance rule base includes: main index rules, field synonym rules, standard item coding rules, unit of measurement conversion rules, statistical time window rules, aggregation method rules, value type rules, missing semantic rules, anomaly conflict determination rules, and source tracing rules. 4.The user phenotyping method based on hospital clinical data according to claim 3, characterized in that, Based on the phenotypic semantic governance rule base, the original phenotypic record set is standardized to obtain a standardized phenotypic record set, specifically including: Based on the main index rules and the source tracing rules, using the de-identified user association identifier and the unique medical visit identifier as the main index, records belonging to the same user in the original phenotypic record set are merged to obtain a candidate phenotypic record set; The candidate phenotype record set is evaluated based on the field synonym rules, the standard item coding rules, the statistical time window rules, and the aggregation method rules to obtain the standard clinical meaning of each data point in the candidate phenotype record set; the standard clinical meaning includes the standard item code and the standard item name; Based on the unit conversion rules, the statistical time window rules, and the value type rules, the standard clinical meaning of each data point in the candidate phenotype record set is standardized in terms of value and time, resulting in a standardized candidate phenotype record set. The standardized candidate phenotype record set includes: standard unit, standardized value, value type, and statistical time window. Based on the missing semantic rules and the abnormal conflict determination rules, the unified candidate phenotypic record set is subjected to missing and quality identification to obtain the identified candidate phenotypic record set; the identified candidate phenotypic record set includes: missing semantic state, quality mark, source traceability identifier and governance rules; The candidate phenotype record set, the standard clinical meaning, the unified candidate phenotype record set, and the identified candidate phenotype record set are summarized to determine the standardized phenotype record set. 5.The hospital clinical data-based user phenotype identification method of claim 1, wherein, The phenotypic item definition table and the normalized phenotypic record set are transformed to obtain a numerical input matrix, specifically including: Initialize the table of table items and the table of values; Based on the phenotypic item definition table and the phenotypic item vocabulary, multiple phenotypic item tags are generated; Based on the normalized phenotypic record set and the value vocabulary, multiple value tags are generated; Generate a sequence of paired tags based on multiple phenotypic item tags and multiple value tags; A numerical input matrix is generated based on multiple phenotypic item tags, multiple value tags, and the paired tag sequence. 6.The hospital clinical data-based user phenotype identification method according to claim 1, wherein, Based on the numerical input matrix, a sequence of phenotypic input vectors and an effective position mask are generated, specifically including: The numerical input matrix is extracted to obtain a sequence of phenotypic input vectors; The numerical input matrix is randomly masked to obtain the effective position mask. 7.The hospital clinical data-based user phenotype identification method of claim 1, wherein, The training process of the user phenotype representation model specifically includes: Construct a training set; the training set includes: a sample numerical input matrix, a sequence of sample phenotype input vectors, a mask of valid sample locations, and sample phenotype recognition results; Construct a user phenotypic representation model; The sample numerical input matrix, the sample phenotype input vector sequence, and the sample effective location mask are input into the user phenotype representation model to obtain the predicted phenotype recognition result. Based on the predicted phenotypic recognition results and the sample phenotypic recognition results, a loss function is constructed, and the parameters of the user phenotypic representation model are iteratively optimized based on the loss function until the loss function converges or reaches the maximum number of iterations, thereby obtaining a trained user phenotypic representation model.
8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the user phenotype recognition method based on hospital clinical data as described in any one of claims 1-7.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that, When executed by a processor, the computer program implements the user phenotype recognition method based on hospital clinical data as described in any one of claims 1-7.
10. A computer program product comprising a computer program, characterized in that, When executed by a processor, the computer program implements the user phenotype recognition method based on hospital clinical data as described in any one of claims 1-7.