An electronic medical record dataset construction method, system and electronic device
By constructing an electronic medical record dataset, the performance limitations of large language models in processing electronic medical records were addressed, enabling more efficient semantic understanding and feature selection, and improving the model's performance in the field of electronic medical records.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- EAST CHINA UNIV OF SCI & TECH
- Filing Date
- 2023-12-15
- Publication Date
- 2026-07-21
AI Technical Summary
Existing large language models suffer from insufficient performance when processing electronic medical records due to differences in medical terminology, difficulties in feature selection, and improper handling of noise and outliers. There is also a lack of large-scale datasets specifically for Chinese electronic medical records.
A method for constructing electronic medical record datasets is proposed, which includes acquiring electronic medical record data for preprocessing, determining downstream tasks and establishing a set of instruction prompt templates, and generating a structured dataset by using synonym replacement, candidate constraints and time series techniques.
It improves the model's semantic understanding, feature selection, and noise handling capabilities for electronic medical records, enhances data consistency and standardization, and improves the model's reasoning and generation capabilities in complex situations.
Smart Images

Figure CN117831695B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of dataset construction, and in particular to a method, system, and electronic device for constructing electronic medical record datasets. Background Technology
[0002] Electronic medical records (EMRs), as a crucial component of medical information processing, are characterized by complexity and diversity. They not only contain basic patient information but also encompass various medical data such as diagnostic reports, laboratory test results, and medication prescriptions. This information coexists in structured, semi-structured, and unstructured formats, forming a complex information network. Furthermore, many EMRs require continuous observation and recording, resulting in large-scale time-series data that significantly increases the length of the information. The various subfields covered in different EMRs overlap (internal medicine, surgery, obstetrics and gynecology, etc.), and the numerous medical terms contained in the documents and examinations further enhance the complexity of the data.
[0003] Unlike other general tasks (such as translation and paragraph summarization), the complexity and diversity of electronic medical record (EMR) data mean that conventional large language models using the zero-shot approach will be significantly less effective in practical EMR applications without targeted model training. Typically, untrained models will exhibit significant shortcomings in the following areas:
[0004] 1. Semantic understanding: Due to the significant differences between medical terminology and everyday language, conventional models often fail to accurately interpret the deeper meanings in electronic medical records.
[0005] 2. Feature selection: For high-dimensional, multi-type electronic medical record data, it is extremely difficult to effectively identify features that are useful for specific medical tasks (such as diagnosis or prediction).
[0006] 3. Noise and outliers: Electronic medical records often contain erroneous or incomplete information, which requires specially trained models for efficient and accurate processing.
[0007] Currently, although some datasets and tasks related to medical information processing exist, such as PromptCBLUE, which includes tasks like medical text named entity recognition (NER), clinical terminology standardization, and clinical trial screening criteria classification, there is no large-scale dataset specifically designed for Chinese in the field of electronic medical records. Therefore, constructing a large-scale instruction dataset specifically for electronic medical records is of paramount importance for improving the performance of models in this domain. Summary of the Invention
[0008] The purpose of this invention is to provide a method, system, and electronic device for constructing electronic medical record datasets, providing large-scale datasets specifically designed for Chinese, in order to improve the performance of electronic medical record models.
[0009] To achieve the above objectives, the present invention provides the following solution:
[0010] A method for constructing an electronic medical record dataset includes:
[0011] Obtain electronic medical record data for the dataset to be constructed; the electronic medical record data includes database tables for progress notes, discharge notes, nursing records-temperature charts, outpatient records, admission notes, and surgical records; preprocess the electronic medical record data to obtain structured electronic medical record data; the preprocessing includes data table field analysis, data aggregation, data formatting, and data anonymization; based on the structured electronic medical record data, determine the downstream tasks for the dataset to be constructed, and establish a corresponding prompt template set for the downstream tasks; the downstream tasks include electronic medical record document structuring tasks, estimated text content belonging to fields or document tasks, and daily progress note automatic generation tasks; the prompt template set includes task descriptions, placeholders, and / or examples.
[0012] Using a synonym replacement method, the first task data of the document structuring task is determined based on the structured electronic medical record data and the instruction Prompt template set of the document structuring task; the task data includes Prompt, input data, and output data.
[0013] Using candidate constraints and negative guidance strategies, based on the structured electronic medical record data and the instruction Prompt template set of the field to which the estimated text content belongs or the document task, the second task data of the field to which the estimated text content belongs or the document task is determined; using time series technology and adaptive data cleaning algorithms, based on the structured electronic medical record data and the instruction Prompt template set of the daily medical record automatic generation task, the third task data of the daily medical record automatic generation task is determined.
[0014] The electronic medical record dataset is determined based on the first task data, the second task data, and the third task data.
[0015] Optionally, the electronic medical record data is preprocessed to obtain structured electronic medical record data, specifically including:
[0016] The electronic medical record data is analyzed by performing data table field analysis to obtain the analyzed electronic medical record data;
[0017] The analyzed electronic medical record data is aggregated to obtain aggregated electronic medical record data;
[0018] The aggregated electronic medical record data is formatted to obtain initial structured electronic medical record data.
[0019] The initial structured electronic medical record data is anonymized to obtain structured electronic medical record data.
[0020] Optionally, based on the structured electronic medical record data, downstream tasks for the dataset to be constructed are determined, and a corresponding set of instruction prompt templates for the downstream tasks is established, specifically including:
[0021] Based on the structured electronic medical record data, determine the downstream tasks for the dataset to be constructed;
[0022] The initial instructions (Prompt) for each of the downstream tasks are constructed manually.
[0023] ChatGPT is used to expand the initial instruction prompts of each downstream task to obtain the corresponding instruction prompt set for each downstream task.
[0024] Optionally, using a synonym replacement method, the first task data of the document structuring task is determined based on the structured electronic medical record data and the instruction Prompt template set of the document structuring task, specifically including:
[0025] Obtain the set of all field names of the structured electronic medical record data;
[0026] Obtain the input field set and output field set from the field name set; determine the first task data using a synonym replacement method based on the instruction Prompt template set of the document structuring task, the input field set, and the output field set.
[0027] Optionally, utilizing candidate constraints and negative guidance strategies, the second task data for determining the field to which the estimated text content belongs or the document task instruction Prompt template set, based on the structured electronic medical record data and the field to which the estimated text content belongs or the document task, specifically includes:
[0028] Obtain the set of all field names of the structured electronic medical record data;
[0029] Based on the field to which the estimated text content belongs or the instruction Prompt template set of the document task and the set of field names, the second task data is determined using candidate constraints and negative guidance strategies.
[0030] Optionally, using time series technology and adaptive data cleaning algorithms, based on the structured electronic medical record data and the instruction Prompt template set for the daily medical record automatic generation task, the third task data for the daily medical record automatic generation task is determined, specifically including:
[0031] Obtain the set of all field names of the structured electronic medical record data;
[0032] Based on the instruction Prompt template set for automatically generating tasks from the daily medical records and the set of field names, the third task data is determined using time series technology and an adaptive data cleaning algorithm.
[0033] An electronic medical record dataset construction system includes:
[0034] The data acquisition module is used to acquire electronic medical record data for the dataset to be constructed; the electronic medical record data includes a progress record database table, a discharge record database table, a nursing record-temperature chart database table, an outpatient medical record database table, an admission record database table, and a surgical record database table;
[0035] The preprocessing module is used to preprocess the electronic medical record data to obtain structured electronic medical record data; the preprocessing includes data table field analysis, data aggregation, data formatting, and data anonymization;
[0036] The downstream task and template set determination module is used to determine the downstream tasks of the dataset to be constructed based on the structured electronic medical record data, and to establish the corresponding instruction prompt template set for the downstream tasks; the downstream tasks include document structuring tasks of electronic medical records, document tasks of estimating the fields to which the text content belongs, and automatic generation tasks of daily medical records; the instruction prompt template set includes task description, placeholders and / or examples.
[0037] The first task data determination module is used to determine the first task data of the document structured task based on the structured electronic medical record data and the instruction Prompt template set of the document structured task using a synonym replacement method; the task data includes Prompt, input data and output data;
[0038] The second task data determination module is used to determine the second task data of the field to which the estimated text content belongs or the document task by using candidate constraints and negative guidance strategies, based on the structured electronic medical record data and the instruction Prompt template set of the field to which the estimated text content belongs or the document task.
[0039] The third task data determination module is used to determine the third task data for the automatic generation of daily medical records based on the structured electronic medical record data and the instruction Prompt template set for the automatic generation of daily medical records, using time series technology and adaptive data cleaning algorithms.
[0040] The dataset construction module is used to determine the electronic medical record dataset based on the first task data, the second task data, and the third task data.
[0041] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and the processor runs the computer program to enable the electronic device to perform the above-described electronic medical record dataset construction method.
[0042] Optionally, the memory is a readable storage medium.
[0043] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0044] This invention provides a method, system, and electronic device for constructing an electronic medical record (EMR) dataset. The method includes: acquiring EMR data to be constructed; preprocessing the EMR data to obtain structured EMR data; determining downstream tasks for the dataset based on the structured EMR data, and establishing corresponding instruction prompt template sets for the downstream tasks. This solves the problem of time-consuming, labor-intensive, and inconsistent manual construction of instruction prompt template sets. Utilizing synonym replacement, candidate constraint, negative guidance strategies, time series techniques, and adaptive data cleaning algorithms, the method determines the task data for the corresponding downstream tasks based on the structured EMR data and the instruction prompt template sets for document structuring tasks. Finally, based on the corresponding task data, the EMR dataset is determined. This invention, through synonym replacement strategies, can significantly improve data consistency and standardization, making it easier for further data analysis, automated processing, and cross-system sharing. Furthermore, the transformation of structured tasks makes the structure of electronic medical record documents clearer and easier to display and read. By employing candidate constraints and negative guidance strategies, the model's retrieval efficiency and accuracy for electronic medical record (EMR) data are improved, and its ability to trace the source of EMR content is enhanced, ensuring accurate and efficient extraction of key information during EMR processing. Utilizing time series techniques and adaptive data cleaning algorithms not only strengthens the model's understanding of professional knowledge and terminology in clinical medicine but also significantly improves its reasoning and summarization capabilities in complex scenarios. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 The flowchart of the electronic medical record dataset construction method provided by the present invention;
[0047] Figure 2 A flowchart illustrating the electronic medical record dataset construction method of the present invention in practical application;
[0048] Figure 3 This is a JSON format template for patient electronic medical record data as described in this invention;
[0049] Figure 4 This invention provides a standardized JSON format template for patient outpatient visit records.
[0050] Figure 5 This invention provides a standardized JSON format template for patient hospitalization records.
[0051] Figure 6 This is a flowchart of the document structuring task data construction for electronic medical records according to the present invention;
[0052] Figure 7 This is a flowchart illustrating the construction process of the predicted text content field or document task data according to the present invention.
[0053] Figure 8 The flowchart for the automatic generation of daily medical record task data in this invention is shown. Detailed Implementation
[0054] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0055] The purpose of this invention is to provide a method, system, and electronic device for constructing electronic medical record datasets, providing large-scale datasets specifically designed for Chinese, in order to improve the performance of electronic medical record models.
[0056] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0057] Example 1
[0058] like Figure 1 and Figure 2 As shown, the electronic medical record dataset construction method provided by the present invention includes:
[0059] Step 101: Obtain the electronic medical record data of the dataset to be constructed; the electronic medical record data includes the progress record database table, discharge record database table, nursing record-temperature chart database table, outpatient medical record database table, admission record database table, and surgical record database table.
[0060] In practical applications, all data comes from the actual data generated and stored in the hospital's electronic medical record management system during the patient's medical visit. The initially obtained electronic medical record data consists of multiple database tables, covering all information retained during the patient's medical visit from admission to discharge. These database tables include the progress note database table, discharge note database table, nursing record-temperature chart database table, outpatient medical record database table, admission note database table, and surgical record database table.
[0061] Step 102: Preprocess the electronic medical record data to obtain structured electronic medical record data; the preprocessing includes data table field analysis, data aggregation, data formatting, and data anonymization.
[0062] As an optional implementation, step 102 specifically includes:
[0063] Step 1021: Perform data table field analysis on the electronic medical record data to obtain the analyzed electronic medical record data.
[0064] In practical applications, numerical and column name analysis is performed on the fields of each database table to clarify the actual meaning of each column and remove irrelevant or redundant columns. The resulting explanations of the database table fields are shown in Table 1. Based on this, empty columns, irrelevant columns, and functional columns are identified, including "DATA_VERSION": "Data Version", "REC_SUB_TITLE": "Record Subtitle", "SYSTYPE": "System Category", etc. These columns are removed to make the data structure clearer.
[0065] Table 1. Explanation of each field in each database table
[0066]
[0067]
[0068] Step 1022: Aggregate the analyzed electronic medical record data to obtain aggregated electronic medical record data.
[0069] In practical applications, each database table uses the field "PATIENT_ID" (Patient ID) as a unique identifier. Records with the same "PATIENT_ID" from all database tables are merged to construct all medical record information for each patient (aggregated electronic medical record data).
[0070] Step 1023: Format the aggregated electronic medical record data to obtain initial structured electronic medical record data.
[0071] In practical applications, to enhance the convenience of data analysis and the efficiency of content indexing, this method employs a unified data template and field mapping rules. These rules are specifically designed for all inpatient information for each patient, thereby converting all medical record data for each patient into a standardized JSON format. Through in-depth analysis of the parent-child field relationships in various database tables, we constructed a multi-level JSON template. In this template, a patient's data is explicitly divided into multiple dimensions, such as "Name," "Gender," "Date of Birth," "Outpatient Visit Records," and "Inpatient Visit Records." Figure 3 As shown, this hierarchical division provides a clear view of the data. Furthermore, we refine "Outpatient Visit Records" and "Inpatient Visit Records" into more levels of subfields, the details of which are displayed below. Figure 4 and Figure 5 The multi-level structured JSON template design not only standardizes patient medical data but also significantly improves the automation efficiency of data processing and analysis. Furthermore, this structured data design facilitates continuous data maintenance and provides flexibility for future data format upgrades or modifications.
[0072] Step 1024: De-identify the initial structured electronic medical record data to obtain structured electronic medical record data.
[0073] In practical applications, since this data originates from medical records generated during actual medical visits, sensitive information needs to be anonymized to ensure privacy and security. This includes identifying, recognizing, and replacing sensitive information.
[0074] S1: Identify Sensitive Information. Identify the information in the electronic medical record data that needs to be anonymized, including mobile phone number, ID card number, hospital number, and name.
[0075] S2: Identify Sensitive Information. Among all sensitive information, mobile phone numbers, ID card numbers, and hospital registration numbers are identified using regular expression matching due to their relatively clear structure. The formulas are as follows:
[0076] Regrex phone =\d{18}
[0077] Regrex id =\d{17}([0-9]|X)
[0078] Regrex admission =z\d{5}
[0079] When identifying complex and sensitive information such as names, traditional regular expressions may not be precise enough. Therefore, we directly use the "PATIENT_NAME" field in the database to obtain the patient's name and then identify it using precise string matching methods.
[0080] S3: Replace Sensitive Information. To protect privacy while preserving the integrity of the data and its inherent logical patterns to the greatest extent possible, identified sensitive information is replaced with random information based on the rules governing its composition. Specifically, for common sensitive information, including names, mobile phone numbers, and ID card numbers, Python's faker library is used to generate corresponding types of random information; for sensitive information such as hospital registration numbers, random information of this type is automatically generated according to the rules governing this field, which is a lowercase letter 'z' followed by 5 digits.
[0081] Step 103: Based on the structured electronic medical record data, determine the downstream tasks of the dataset to be constructed, and establish a corresponding prompt template set for the downstream tasks; the downstream tasks include document structuring tasks for electronic medical records, estimated text content belonging to fields or document tasks, and automatic generation tasks of daily medical records; the prompt template set includes task descriptions, placeholders, and / or examples.
[0082] As an optional implementation, step 103 specifically includes:
[0083] Step 1031: Based on the structured electronic medical record data, determine the downstream tasks of the dataset to be constructed.
[0084] In practical applications, firstly, based on the structured electronic medical record information obtained in step 101, the downstream tasks of this dataset (the dataset to be constructed) are determined, specifically including the document structuring task of electronic medical records, the task of estimating the fields or documents to which the text content belongs, and the task of automatically generating daily medical records.
[0085] S1: To measure the model's ability to understand the structure of electronic medical records, the task of structuring electronic medical records is defined. The input is the unstructured text of electronic medical records, and the output is structured electronic medical record data.
[0086] S2: To measure the model's semantic understanding of electronic medical records, determine the field or document to which the predicted text content belongs. The input is unstructured medical record text, and the output is the source field or document of the text.
[0087] S3: To measure the model's ability to understand and generate complex electronic medical records, the task of automatically generating daily medical records is defined. A specific date during the patient's hospitalization is specified, the input is the patient's medical record information other than daily medical records on that date, and the output is the patient's daily medical record document for that date.
[0088] Step 1032: Manually construct the initial instructions (Prompt) for each of the downstream tasks.
[0089] In practical applications, initial prompts for each downstream task are manually constructed. A prompt consists of three parts: task description, placeholders, and examples. The task description explicitly tells the model the specific task it needs to complete, guiding the model accordingly. The task description should be concise and clear, without unnecessary complexity. Placeholders are used to mark parts that need to be dynamically filled in during practical applications, enclosed in curly braces "{}". For example, {input} and {keys} are placeholders, used to replace specific medical text and required field names, respectively. Examples are several task samples or a candidate set of answers, used to further guide the model in completing the task. This part is optional, not mandatory.
[0090] S1: For document structuring tasks, the manually written initial instruction Prompt is represented as p. w The statement is: "Based on the content of the given electronic medical record, output in the form of {keys}:\n{input}\n"; the task description is this entire statement; the placeholders are {keys} and {input}, which will be replaced by the actual medical text and the actual field names required in actual use; there are no examples or instructions.
[0091] S2: For the field to which the estimated text content belongs or the document task, the manually written preliminary instruction Prompt is represented as p. y The statement is: "What is the source of the medical records for the following medical texts?\n{input}\nOptions: {choices}\n"; the task description is "What is the source of the medical records for the following medical texts?\n{input}\n"; the placeholders are {input} and {choices}, which will be replaced by the actual medical text and the provided set of field options in actual use; the example is "Options: {choices}\n", which provides certain candidate options for the model.
[0092] S3: For the task of automatically generating daily medical records, the initial manually written instruction Prompt is represented as p. mThe statement is: "Given the patient's medical record for the given date {date}:\n{input}\n"; the task description is this entire statement; the placeholders are {input} and {date}, which will be replaced by the actual medical text and the selected date in actual use; there are no examples or instructions.
[0093] Step 1033: Expand the initial instruction prompts of each downstream task using ChatGPT to obtain the corresponding instruction prompt set for each downstream task.
[0094] In practical applications, ChatGPT is used to expand the initial instruction prompts, resulting in an instruction prompt set. The initial manually constructed instruction statements are then expanded using the open-source ChatGPT model, yielding an instruction prompt template set containing no fewer than 10 instructions. It is worth noting that ChatGPT is an open-source tool that can receive and understand user input and provide corresponding responses.
[0095] S1: First, in order for ChatGPT to understand and complete the extended initial instruction Prompt task, construct the extended instruction p input to ChatGPT. c The prompt is: "Please generate five synonyms for the following instruction sentences while keeping the meaning of the sentences unchanged."
[0096] S2: Next, the extended instruction p c The initial prompt obtained in step 1032 is concatenated with this, and input into ChatGPT to obtain the expanded prompt. This expansion step can be repeated multiple times until the final prompt template set contains at least 10 prompts. w p y and p m After expansion, we obtain the Prompt template set P. w P y and P m .
[0097] Step 104: Using the synonym replacement method, determine the first task data of the document structuring task based on the structured electronic medical record data and the instruction Prompt template set of the document structuring task; the task data includes Prompt, input data and output data.
[0098] As an alternative implementation method, such as Figure 6 As shown, step 104 specifically includes:
[0099] Obtain the set of all field names from the structured electronic medical record data. In practical applications, any given piece of structured electronic medical record data is selected as the current electronic medical record data, and all field names within it are obtained; the set of field names is represented as key_list. all .
[0100] Retrieve the input field set and output field set from the field name set. In practical applications, retrieve the output field set key_list. output With the input field collection key_list input It satisfies the following formula:
[0101]
[0102] Based on the instruction Prompt template set, the input field set, and the output field set of the document structuring task, the first task data is determined using a synonym substitution method. The task data consists of three parts: Prompt, input data, and output data. Prompt is a specific task instruction; input data is the task data input; and output data is the expected corresponding output. The three parts flow as follows (in parallel):
[0103] S1: Construct the Prompt for the first task data. (In P) w Randomly select one entry and use the placeholder {keys} within it to output the key_list of field names. output filling.
[0104] S2: Input for constructing the first task data.
[0105] First, based on the input field set key_list input The current electronic medical record data is indexed at the field level to obtain structured input data.
[0106] Secondly, based on each field k in the structured input data ori Use the field thesaurus dict key Index the dictionary to obtain a list of synonyms, as shown in Table 2; randomly select a name from the list as the replacement field name k. new The formula is as follows:
[0107] k new =RandomChoice(dict) key [k ori ]),k ori ∈key_list input
[0108] RandomChoice() means randomly selecting an element from the list.
[0109] Next, the random library in Python is used to sort the fields in random order.
[0110] Finally, the shuffled structured medical record data is converted into unstructured text format by using colons (:) to concatenate field names and values, and newlines (\n) to concatenate between fields. The resulting unstructured text data is used as input for the task.
[0111] Table 2: Field Thesaurus Table
[0112]
[0113] S3: Construct the output of the first task data.
[0114] First, based on the output field set key_list output The system performs field-level indexing on the current electronic medical record data to obtain structured output data.
[0115] Subsequently, the structured output data is serialized using Python's json library and converted into an unstructured text format, which is then used as the task data output.
[0116] Step 105: Using candidate constraints and negative guidance strategies, determine the second task data of the field to which the estimated text content belongs or the document task instruction Prompt template set based on the structured electronic medical record data and the field to which the estimated text content belongs or the document task.
[0117] As an alternative implementation method, such as Figure 7 As shown, step 105 specifically includes:
[0118] Obtain the set of all field names from the structured electronic medical record data. In practical applications, any given piece of structured electronic medical record data is selected as the current electronic medical record data, and all field names within it are obtained; the set of field names is represented as key_list. all .
[0119] Based on the field to which the estimated text content belongs or the instruction Prompt template set of the document task and the set of field names, the second task data is determined using candidate constraints and negative guidance strategies. The specific process is as follows:
[0120] S1: Construct the Prompt for the second task data. (In p) y Randomly select one entry and use the placeholder {choices} within it with the key_list of all field names.all A randomly selected subset of keys_list random filling.
[0121] S2: Input for constructing the second task data.
[0122] First, in the set of all field names key_list all Randomly select a field name and obtain the corresponding content text.
[0123] Secondly, the text content is sliced. The text content is scanned, meaning each character is traversed, and each punctuation mark is marked as a segmentation point. Then, based on the marked segmentation points, the text is divided into multiple sub-text segments. Furthermore, each sub-text segment is trimmed, removing unnecessary whitespace or characters.
[0124] Finally, randomly select one or more continuous sub-text segments as the task input data.
[0125] S3: Output the data for the second task.
[0126] First, initialize the list key_list pred Create an empty list to store all fields that appear in the text to be predicted.
[0127] Next, all fields are iterated through for text string matching, that is, searching for the text to be predicted within the content of each field. If the text to be predicted is found in a field, the name of that field is added to the key_list. pred The search continues thereafter, relentlessly searching for the text to be predicted in all other fields until all fields have been examined.
[0128] Finally, based on the negative guidance strategy, the data output is constructed for different scenarios. To confirm whether the candidate set contains the correct result, the randomly selected subset key_list is evaluated. random with a list of all fields containing the text to be predicted, key_list pred The intersection of key_list inter Check if the key is not empty; if the result is yes, then add the intersection result key_list. inter As data output; if the judgment result is negative, then the negative statement "neg" is output as data, such as "does not belong to any of the given fields"; the formula is as follows:
[0129]
[0130] Step 106: Using time series technology and adaptive data cleaning algorithm, determine the third task data for the automatic generation of daily medical records based on the structured electronic medical record data and the instruction Prompt template set for the automatic generation task of daily medical records.
[0131] As an alternative implementation method, such as Figure 8 As shown, step 106 specifically includes:
[0132] Obtain the set of all field names from the structured electronic medical record data. In practical applications, any given piece of structured electronic medical record data is selected as the current electronic medical record data, and all field names within it are obtained; the set of field names is represented as key_list. all .
[0133] Based on the instruction prompt template set for automatically generating tasks from the daily medical records and the set of field names, time series technology and adaptive data cleaning algorithms are used to determine the data for the third task. The specific process is as follows:
[0134] S1: Construct the Prompt for the third task data. (In p) y One record is randomly selected from the data and used as the data Prompt.
[0135] S2: Input for constructing the third task data.
[0136] First, the data in the current electronic medical records is segmented by date. The time of all medical record information is standardized to the same format. Each document in the medical record is identified during storage using the format "year-month-day hour:minute:second" (down to the second), which is then simplified to "year-month-day" (down to the day). Subsequently, the electronic medical record data for the same patient is segmented into subsets by date. Furthermore, to ensure data continuity, these subsets are sorted by date.
[0137] Secondly, a date is randomly selected, and a subset of data for that date is obtained. Information other than daily medical records is used as input data.
[0138] S3: Output the data for the third task.
[0139] First, obtain the daily medical record information from the data subset for that date. Then, filter the data subset for that date by document name to obtain the daily medical record information for that day.
[0140] Secondly, identify the laboratory information in the medical record and correct any writing errors. The laboratory tests include a total of Insp items. k Test value Insp v Insp, the testing unit uThere are three key elements to consider. The medical record text is written by doctors in a standard format: "Laboratory Item: Laboratory Value, Laboratory Unit." There are two main issues: errors in laboratory items and errors in laboratory values. To address errors in laboratory items, all patient laboratory information is traversed, and the following regular expression is used to identify laboratory items written by the doctor in the text:
[0141] regrex k =(.*?):Insp v Insp u .
[0142] Compare the search results with the correct examination items in the patient's test. k If the comparison fails and the result does not match, it will be changed to Insp. k .
[0143] On the other hand, to address erroneous test values, all patient test information is iterated through, and the following regular expression is used to identify test values written by doctors in the text:
[0144] regrex v =Insp k :(.*?)Insp u .
[0145] Compare the search results with the correct test value Insp from the patient's test. v If the comparison fails and the result does not match, it will be changed to Insp. v .
[0146] After both types of errors have been identified and corrected, the cleaned daily medical records will be output as data.
[0147] Step 107: Determine the electronic medical record dataset based on the first task data, the second task data, and the third task data.
[0148] This invention uses patient data from a real production environment to construct the instruction dataset, ensuring a high degree of data professionalism and complexity. Through the standardized template conversion of personal medical record information, this application has high scalability and can adapt to the needs of various medical scenarios, multiple hospitals, and different practical tasks.
[0149] This invention identifies three downstream tasks in the field of electronic medical records: document structuring of electronic medical records, prediction of the fields or documents to which text content belongs, and automatic generation of daily medical records. These tasks measure the model's understanding of electronic medical record data from various perspectives. For each downstream task, initial prompts are manually written, and then diverse prompt template sets are constructed using the ChatGPT expansion method. This solves the problems of time-consuming, labor-intensive, and lacking diversity in manually constructing prompt template sets.
[0150] This invention constructs a document structuring task data for electronic medical records (EMRs) based on a synonym substitution strategy, measuring the model's ability to understand the structure of EMRs. This task not only analyzes and transforms unstructured EMR text but also emphasizes cross-system and cross-hospital data sharing and automated processing. The synonym substitution strategy significantly improves data consistency and standardization, making it easier for further data analysis, automated processing, and cross-system sharing. Furthermore, the structuring task makes the EMR document structure clearer, easier to display, and easier to read.
[0151] This invention constructs task data for predicting the fields or documents to which text content belongs, based on candidate constraints and a negative guidance strategy, and measures the model's semantic understanding ability of electronic medical records. This task aims to accurately identify and classify the sources of specific information or paragraphs from a large amount of electronic medical record data. Through candidate constraints and the negative guidance strategy, not only is the model's retrieval efficiency and accuracy for electronic medical record data improved, but its ability to trace the source of generated electronic medical record content is also enhanced, ensuring accurate and efficient extraction of key information when processing electronic medical records.
[0152] This invention, based on time series technology and adaptive data cleaning algorithms, constructs a task data set for automatically generating daily medical records, measuring the model's ability to understand and generate complex electronic medical records. This task requires the model not only to understand and interpret medical terminology, treatment plans, and patient status, but also to use time series technology to extract key information from large amounts of medical record data, track trends and changes in the patient's disease progression, perform logical reasoning, and automatically generate medical records. This task not only enhances the model's professional knowledge and terminology understanding in the field of clinical medicine, but also significantly improves the model's reasoning and summarizing capabilities in complex situations.
[0153] Example 2
[0154] In order to execute the method corresponding to Embodiment 1 above and achieve the corresponding functions and technical effects, an electronic medical record dataset construction system is provided below, including:
[0155] The data acquisition module is used to acquire electronic medical record data for the dataset to be constructed; the electronic medical record data includes a progress record database table, a discharge record database table, a nursing record-temperature chart database table, an outpatient medical record database table, an admission record database table, and a surgical record database table.
[0156] The preprocessing module is used to preprocess the electronic medical record data to obtain structured electronic medical record data; the preprocessing includes data table field analysis, data aggregation, data formatting, and data anonymization.
[0157] The downstream task and template set determination module is used to determine the downstream tasks of the dataset to be constructed based on the structured electronic medical record data, and to establish the corresponding instruction prompt template set for the downstream tasks; the downstream tasks include document structuring tasks of electronic medical records, document tasks of estimating the fields to which the text content belongs, and automatic generation tasks of daily medical records; the instruction prompt template set includes task description, placeholders and / or examples.
[0158] The first task data determination module is used to determine the first task data of the document structured task based on the structured electronic medical record data and the instruction Prompt template set of the document structured task using a synonym replacement method; the task data includes Prompt, input data and output data.
[0159] The second task data determination module is used to determine the second task data of the field to which the estimated text content belongs or the document task by using candidate constraints and negative guidance strategies, based on the structured electronic medical record data and the instruction Prompt template set of the field to which the estimated text content belongs or the document task.
[0160] The third task data determination module is used to determine the third task data for the automatic generation of daily medical records based on the structured electronic medical record data and the instruction Prompt template set for the automatic generation of daily medical records, using time series technology and adaptive data cleaning algorithms.
[0161] The dataset construction module is used to determine the electronic medical record dataset based on the first task data, the second task data, and the third task data.
[0162] Example 3
[0163] The present invention provides an electronic device, including: a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform the electronic medical record dataset construction method of Embodiment 1.
[0164] As an alternative implementation, the memory is a readable storage medium.
[0165] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.
[0166] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, 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 the present invention.
Claims
1. An electronic medical record dataset construction method, characterized by, include: Obtain the electronic medical record data of the dataset to be constructed; the electronic medical record data includes the following database tables: progress record database table, discharge record database table, nursing record-temperature chart database table, outpatient medical record database table, admission record database table, and surgical record database table; The electronic medical record data is preprocessed to obtain structured electronic medical record data; the preprocessing includes data table field analysis, data aggregation, data formatting, and data anonymization; Based on the structured electronic medical record data, determine the downstream tasks of the dataset to be constructed, and establish a corresponding prompt template set for the downstream tasks; the downstream tasks include document structuring tasks for electronic medical records, estimated text content belonging to fields or document tasks, and automatic generation tasks of daily medical records; the prompt template set includes task descriptions, placeholders, and / or examples. Based on the structured electronic medical record data, determine the downstream tasks for the dataset to be constructed, and establish a corresponding set of instruction prompt templates for the downstream tasks, specifically including: Based on the structured electronic medical record data, determine the downstream tasks for the dataset to be constructed; The initial instructions (Prompt) for each of the downstream tasks are constructed manually. ChatGPT is used to expand the initial instruction prompts of each downstream task to obtain the corresponding instruction prompt template set for each downstream task. Using a synonym replacement method, the first task data of the document structuring task is determined based on the structured electronic medical record data and the instruction Prompt template set of the document structuring task; the task data includes Prompt, input data, and output data. Using candidate constraints and negative guidance strategies, the second task data of the field to which the estimated text content belongs or the document task is determined based on the structured electronic medical record data and the instruction Prompt template set of the field or document task to which the estimated text content belongs. Using time series technology and adaptive data cleaning algorithms, the third task data for the automatic generation of daily medical records is determined based on the structured electronic medical record data and the instruction Prompt template set for the automatic generation task of daily medical records. The electronic medical record dataset is determined based on the first task data, the second task data, and the third task data.
2. The method for constructing an electronic medical record dataset according to claim 1, characterized in that, The electronic medical record data is preprocessed to obtain structured electronic medical record data, specifically including: The electronic medical record data is analyzed by performing data table field analysis to obtain the analyzed electronic medical record data; The analyzed electronic medical record data is aggregated to obtain aggregated electronic medical record data; The aggregated electronic medical record data is formatted to obtain initial structured electronic medical record data. The initial structured electronic medical record data is anonymized to obtain structured electronic medical record data.
3. The method for constructing an electronic medical record dataset according to claim 1, characterized in that, Using a synonym replacement method, based on the structured electronic medical record data and the instruction Prompt template set of the document structuring task, the first task data of the document structuring task is determined, specifically including: Obtain the set of all field names of the structured electronic medical record data; Retrieve the input field set and output field set from the field name set; Based on the instruction Prompt template set, the input field set, and the output field set of the document structuring task, the first task data is determined using a synonym replacement method.
4. The method for constructing an electronic medical record dataset according to claim 1, characterized in that, Using candidate constraints and negative guidance strategies, the second task data for determining the field to which the estimated text content belongs or the document task, based on the structured electronic medical record data and the instruction Prompt template set of the estimated text content, specifically includes: Obtain the set of all field names of the structured electronic medical record data; Based on the field to which the estimated text content belongs or the instruction Prompt template set of the document task and the set of field names, the second task data is determined using candidate constraints and negative guidance strategies.
5. The method for constructing an electronic medical record dataset according to claim 1, characterized in that, Using time series analysis and adaptive data cleaning algorithms, based on the structured electronic medical record data and the instruction Prompt template set for the daily medical record automatic generation task, the third task data for the daily medical record automatic generation task is determined, specifically including: Obtain the set of all field names of the structured electronic medical record data; Based on the instruction Prompt template set for automatically generating tasks from the daily medical records and the set of field names, the third task data is determined using time series technology and an adaptive data cleaning algorithm.
6. An electronic medical record dataset construction system, characterized in that, The electronic medical record dataset construction system is used to implement the electronic medical record dataset construction method according to any one of claims 1-5, and the electronic medical record dataset construction system includes: The data acquisition module is used to acquire electronic medical record data for the dataset to be constructed; the electronic medical record data includes a progress record database table, a discharge record database table, a nursing record-temperature chart database table, an outpatient medical record database table, an admission record database table, and a surgical record database table; The preprocessing module is used to preprocess the electronic medical record data to obtain structured electronic medical record data; the preprocessing includes data table field analysis, data aggregation, data formatting, and data anonymization; The downstream task and template set determination module is used to determine the downstream tasks of the dataset to be constructed based on the structured electronic medical record data, and to establish the corresponding instruction prompt template set for the downstream tasks; the downstream tasks include document structuring tasks of electronic medical records, document tasks of estimating the fields to which the text content belongs, and automatic generation tasks of daily medical records; the instruction prompt template set includes task description, placeholders and / or examples. The first task data determination module is used to determine the first task data of the document structured task based on the structured electronic medical record data and the instruction Prompt template set of the document structured task using a synonym replacement method; the task data includes Prompt, input data and output data; The second task data determination module is used to determine the second task data of the field to which the estimated text content belongs or the document task by using candidate constraints and negative guidance strategies, based on the structured electronic medical record data and the instruction Prompt template set of the field to which the estimated text content belongs or the document task. The third task data determination module is used to determine the third task data for the automatic generation of daily medical records based on the structured electronic medical record data and the instruction Prompt template set for the automatic generation of daily medical records, using time series technology and adaptive data cleaning algorithms. The dataset construction module is used to determine the electronic medical record dataset based on the first task data, the second task data, and the third task data.
7. An electronic device, characterized in that, include: A memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to cause the electronic device to perform the electronic medical record dataset construction method according to any one of claims 1-5.
8. The electronic device according to claim 7, characterized in that, The memory is a readable storage medium.