Pathological diagnosis report text information extraction method based on large language model

By using a large language model-based approach to automate the processing of pathology reports, the problems of low efficiency and poor generalization ability in existing technologies are solved. This enables efficient and accurate extraction of structured data, supporting the training of pathology AI models and the secure application of data.

CN121905409APending Publication Date: 2026-04-21GUANGZHOU FANGXIN MEDICAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU FANGXIN MEDICAL TECH CO LTD
Filing Date
2025-12-26
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing technologies for extracting structured information from unstructured pathology reports suffer from inefficiency, high cost, and poor generalization ability, making it difficult to build high-quality pathology datasets on a large scale and incurring high maintenance costs.

Method used

A method based on a large language model is adopted to process pathology reports in a streamlined manner through preprocessing, structured prompts, semantic parsing, and logical verification, so as to automatically, accurately, and efficiently extract key diagnostic elements and generate standardized structured data.

Benefits of technology

It enables automated batch processing of pathology reports, significantly improves the speed of building high-quality structured datasets, supports the training and iteration of pathology AI models, lowers the technical threshold for data integration and use, and ensures data security and privacy protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121905409A_ABST
    Figure CN121905409A_ABST
Patent Text Reader

Abstract

The invention relates to a pathological diagnosis report text information extraction method based on a large language model, and the method comprises the steps: carrying out the cleaning and standardization of an unstructured text, carrying out the precise division according to a material taking part, extracting a key pathological entity through the combination of rule matching, syntactic analysis and a pre-training model, and intelligently judging the diagnosis certainty of the key pathological entity. And in the core link, the extraction result is converted into standardized data containing deterministic diagnosis and uncertainty diagnosis fields under the accurate guidance of structured prompt information by utilizing the strong semantic understanding capability of a large language model, and a high-quality structured report is output by mapping with a medical knowledge base through automatic verification. According to the method, automatic and high-accuracy conversion from the free text to the clinical decision support data is realized, and the pathological information utilization efficiency is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Technical Field This application relates to the field of electronic digital data technology, specifically to a method for extracting text information from pathological diagnosis reports based on a large language model. Background Technology

[0002] Pathology reports are core medical documents that record key information about a patient's disease diagnosis, classification, and staging. The structured data contained within them is invaluable for building pathology knowledge bases, training AI-assisted pathology diagnostic models, and supporting clinical research and cancer registration. Currently, extracting structured information from massive amounts of unstructured pathology reports mainly relies on the following two methods: manual annotation, where professionals manually read the reports and identify and annotate fields such as disease name, pathological subtype, differentiation degree, and TNM stage. While this method is highly accurate, it suffers from significant drawbacks, including low efficiency, high cost, and difficulty in scaling up, which severely restricts the speed of building high-quality pathological datasets. Information extraction is performed by pre-setting keywords, regular expressions, or training the traditional sequence labeling model BiLSTM-CRF. However, these methods have poor generalization ability and are difficult to cover the complex and varied sentence structures, synonyms, and implicit logic in reports. For new report templates or variations of professional terms, the rules need to be updated frequently or the training data needs to be re-labeled, resulting in high maintenance costs. Therefore, there is an urgent need in this field for a method that can automatically, accurately, and efficiently extract key diagnostic elements from diverse unstructured pathology reports and output high-quality structured data, in order to solve the core bottleneck currently faced in the utilization of pathology data.

[0003] Summary of the Invention In order to solve the problems existing in the prior art, the purpose of this application is to provide a method for extracting text information from pathological diagnosis reports based on a large language model.

[0004] The method for extracting text information from pathological diagnosis reports based on a large language model as described in this application includes the following steps: S101. Preprocess the input unstructured pathological diagnosis report text, including text cleaning, standardization, and dividing the text into text segments corresponding to different sampling sites based on content relevance. S102. Generate structured prompt information based on the preset categories of information fields to be extracted. The prompt information shall include at least the task instructions, output format specifications and examples in the pathology field. The output format specifications are used to define a structured data template containing deterministic diagnostic fields and uncertain diagnostic fields. S103. Input the pathology report text preprocessed in S101 and the structured prompt information obtained in S102 into the large language model; S104. Receive the preliminary extraction results of the pathology report text generated by the large language model based on the prompt information; S105. Parse and validate the format of the preliminary extraction results, and convert them into standardized structured data that conforms to the output format specifications.

[0005] Furthermore, in step S101, the original report is cleaned, irrelevant information such as headers, footers, and hospital headings is removed to obtain plain text, which is then standardized using a unified glossary, synonyms are replaced, typos are corrected, and the format is standardized to obtain standardized text. Using a pre-defined dictionary of source parts, all part names in the text are matched to generate a candidate list of parts. Sentences within a fixed window range before and after each part name are extracted to obtain a preliminary set of part fragments. By performing sentence-level dependency parsing, we determine whether the subject or modifier of each sentence points to the current part. Only the sentences that point to the current part are retained to obtain a set of refined parts. Unclaimed sentences are marked as unrelated parts to obtain the remaining text. For sentences claimed by multiple parts, they are assigned to a single part based on the order of appearance of part names and the principle of closest proximity, generating a unique set of parts fragments. The unique set of parts fragments and the remaining text are then rearranged in the original sentence order to form multiple independent text fragments corresponding to the specific source part.

[0006] Furthermore, in step S102, a pathological entity dictionary is used to perform named entity recognition on the site text fragments, marking entities such as disease and grade to obtain a preliminary entity list; Dependency parsing is used to extract the dependency path of each entity in the sentence. Based on whether the path contains negation or probability words, the entity is labeled with preliminary definiteness tags, including negation, uncertainty or certainty. Sentences are encoded using a pre-trained biomedical language model. The vector similarity between entities and sentences is calculated and compared with the initial labels. If they are inconsistent, they are corrected to uncertain, resulting in a final set of entities with deterministic labels. For uncertain entities, the nearest trigger words and conditional clauses are traced along the dependency tree and concatenated to form a complete uncertainty diagnostic phrase. Entities within the same part are clustered and merged to remove duplicates, resulting in a part-level entity list. According to a preset template, the deterministic entities and uncertain expressions are filled into the structured fields respectively to obtain a complete structured diagnostic record corresponding to the sampling part.

[0007] Furthermore, in step S103, based on the preprocessed pathology report text and structured guidance information, a large language model is used to perform preliminary semantic parsing to obtain a set of semantic units; Information extraction tools are used to identify and label the key fields of each semantic unit, determine the core diagnostic information fragments, and correct any fields in the fragments that do not conform to the preset format by rule matching, thereby obtaining a set of corrected information fragments. The corrected fragments are categorized according to diagnostic categories to form diagnostic information groups. Data is populated into each group using a preset format template. If the data does not meet the template requirements, the fields are filled in to obtain formatted diagnostic data. The integrity of each field is checked by a data validation tool. If any missing data is found, the original text is traced back to fill in the missing data, thereby determining the final structured diagnostic data.

[0008] Furthermore, in step S104, the preliminary extracted content of the pathology report generated by the large language model based on the prompts is obtained to form a preliminary set of text fragments; The core text fragments related to the pathology report are filtered out using a preset field matching tool. The core fragments are then classified by topic using a hierarchical classification tool. If the topic is unclear, the fragments are reclassified based on contextual clues provided in the prompts. The classified text groups are then determined, and the groups are mapped to structured fields using a preset template. If the mapping is incomplete, the initially extracted content is traced back to supplement the data, resulting in the mapped structured fragments. Content verification tools are used to check the completeness of each segment. If any information is missing, it is extracted and supplemented from the original pathology report text. After verification, data units are determined, and logical association tools are used to sort out the contextual relationships between units to obtain a coherent set of pathology information.

[0009] Furthermore, in step S105, the initially extracted content is segmented using a preset text analysis tool to obtain text units, and the content of each unit is categorized and labeled using a field recognition tool to obtain data grouping; If the category label does not conform to the preset specification, it is corrected by using a context comparison tool to obtain a corrected dataset; The fields of each group are populated using a structured template. If there are any gaps, information is extracted from the original content to fill them in, resulting in a populated data framework. A content consistency check tool is used to check the logical relationships between fields to obtain the checked data structure. By using association and organization tools to sort out the hierarchical relationships of the data, the final standardized data units are determined. Then, storage mapping tools are used to transform the standardized units into a format that conforms to the output specifications, thereby obtaining the processed structured data.

[0010] The method for extracting text information from pathological diagnostic reports based on a large language model described in this application has the advantage of effectively guiding the large language model to understand the professional context and extraction target of the pathological report by designing a dedicated structured prompt word containing prior knowledge of the pathology field and output format constraints; and by utilizing the powerful context learning and few-shot learning capabilities of the large language model, it can accurately identify and distinguish the complex semantics of "deterministic diagnosis" and "diagnosis to be excluded", accurately extract professional fields such as disease subtype and grade classification, and overcome the poor generalization of traditional rule-based methods. By streamlining the preprocessing, prompt building, API calls, and result parsing processes, the system enables batch and fully automated processing of pathology reports, freeing up manpower from tedious and repetitive manual annotation work. This significantly increases the speed of building high-quality structured datasets from massive historical reports, greatly accelerating the training and iteration cycle of pathology AI models. It also supports calling large language model APIs through encrypted channels and explicitly proposes a localized deployment scheme for the models. To ensure that sensitive pathological diagnosis report data is not leaked during transmission and processing, and to comply with the strict data security and privacy protection regulations of the medical industry, this method removes obstacles to its deployment and application in real hospital scenarios. By forcibly constraining and parsing the output of a large language model into a predefined standardized JSON format, the structural consistency of the extracted information is ensured. The process involves cleaning and standardizing the original pathology reports, dividing them into independent text fragments based on the sampling site, extracting key diagnostic elements from the fragments through multi-level analysis logic, accurately distinguishing the degree of certainty in the diagnostic conclusions, and automatically generating standardized and structured records containing fields for clear diagnosis and pending diagnosis, thus achieving efficient and accurate conversion from free text to high-quality clinical data. The generated structured data can be directly used for training data annotation of pathology AI models, entry into pathology knowledge bases, or clinical research data analysis without secondary transformation, significantly reducing the technical threshold and cost of data integration and use. Attached Figure Description

[0011] Figure 1 This application describes a method for extracting textual information from pathological diagnostic reports based on a large language model. Figure 1 ; Figure 2 This application describes a method for extracting textual information from pathological diagnostic reports based on a large language model. Figure 2 ; Figure 3 This application describes a method for extracting textual information from pathological diagnostic reports based on a large language model. Figure 3 . Detailed Implementation

[0012] like Figures 1-3 As shown, the method for extracting text information from pathological diagnosis reports based on a large language model, as described in this application, includes: like Figures 1-3 As shown, S101, the input unstructured pathological diagnosis report text is preprocessed, including text cleaning, standardization, and dividing the text into text segments corresponding to different sampling sites based on content relevance.

[0013] Furthermore, in step S101, irrelevant information such as headers, footers, page numbers, hospital headings, and doctor signatures are removed from the original report content to obtain the cleaned plain text; A standardized text was obtained by replacing synonyms and homonyms with a unified glossary, correcting typos, and standardizing capitalization and punctuation. By matching all words mentioning parts in the standardized text with a pre-established dictionary of material parts, and marking each occurrence with the specific part name, a candidate list of parts is obtained; Based on each part name in the part candidate list, extract all sentences containing that part name and the fixed window range before and after it to obtain a preliminary set of part fragments; Sentence-level dependency parsing is used to determine whether the subject or modifier of each sentence in the preliminary fragment set of the part points to the current part. If it does, it is retained; otherwise, it is discarded to obtain the refined fragment set of the part. The remaining set of sentences that have not been claimed by any part is used as irrelevant descriptive segments and directly marked as unrelated parts to obtain the remaining text; In cases where the same sentence is claimed by multiple parts in the refined fragment set, the sentence is assigned to a single part according to the order of appearance of the part name in the sentence and the principle of closest distance, thus obtaining a unique fragment set for the part. The unique fragment set for each location, together with the remaining text, is rearranged and combined according to the sentence order in the original report to form multiple independent final text fragments that correspond to the specific locations from which the material was collected.

[0014] Specifically, in step S101, the preprocessing of unstructured pathology diagnosis report text can be implemented from three aspects: text cleaning, standardization, and content relevance classification. In the text cleaning stage, assuming the input pathology report text contains a large amount of noisy data, such as redundant spaces, special characters, and irrelevant annotation information, we can remove this noise using regular expression algorithms. For example, we can replace consecutive spaces with single spaces, delete irrelevant symbols like "***", and extract percentage data from the text, such as "positive rate: 45.3%", retaining the key value 45.3 for subsequent analysis. After cleaning, the text length was reduced from the original 2000 characters to 1500 characters, improving the data purity by approximately 25%. In the standardization process, to address potential heterogeneous expressions in the report, such as "adenocarcinoma" and "adenomatous carcinoma" referring to the same pathological type, a standardized dictionary containing 500 common pathological terms was constructed. A string matching algorithm was used to unify heterogeneous expressions to the standard term "adenocarcinoma," and time formats such as "2023-1-5" were standardized to "2023-01-05" to ensure data consistency. Statistics show that after standardization, terminology consistency increased from 75% to 95%. In the content relevance segmentation, a keyword- and semantic clustering algorithm was used to segment text fragments from different sources. Keywords such as "stomach" and "intestine" were extracted from the report. The TF-IDF algorithm was used to calculate the relevance score of each sentence to the corresponding part. A threshold of 0.6 was set, and sentences with scores higher than 0.6 were classified into the corresponding parts. After analyzing 1,000 sentences, 400 sentences related to the stomach and 350 sentences related to the intestine were successfully segmented, and the rest were classified into other categories. The accuracy rate reached 88%. This method achieves automated classification of text fragments. From cleaning to standardization and then to segmentation, we gradually improve data quality to ensure that the processing results are used for in-depth analysis of pathological diagnoses, while closely integrating with business needs to provide doctors with more accurate diagnostic basis for different sites.

[0015] like Figures 1-3 As shown, in step S102, according to the preset categories of information fields to be extracted, structured prompt information is obtained. The prompt information includes at least task instructions, output format specifications, and examples in the pathology field. The output format specifications are used to define a structured data template containing deterministic diagnostic fields and uncertain diagnostic fields.

[0016] Further, in step S102, a pre-built pathological entity dictionary is used to perform named entity recognition that combines precise matching and fuzzy matching on the site text fragments, marking entities such as disease, tumor grade, invasion depth, resection margin, lymph node and their location boundaries to obtain a preliminary entity list; The sentence containing entities is parsed using a dependency parsing tool, and the dependency paths from each entity to the sentence root node and to all modifiers are extracted to obtain the entity dependency path set. Based on the set of entity dependency paths, traverse all dependencies on the path. If a negative word appears in the path, mark the entity as negative. If a possibility word appears in the path, mark the entity as uncertain. Otherwise, mark it as certain, and obtain a set of entities with preliminary certainty labels. A pre-trained biomedical language model is used to encode the sentence containing each entity, and the entity span vector and the whole sentence vector are obtained. The vector cosine similarity is compared with a preset threshold to determine whether the preliminary deterministic labels are consistent. If they are inconsistent, the diagnosis is corrected to uncertainty, and the final set of deterministic label entities is obtained. For entities whose final determination label is uncertain, trace back along the dependency tree to the nearest trigger word and conditional clause, and concatenate them to form a complete uncertainty diagnostic phrase, thus obtaining an extended uncertainty expression set; Clustering and merging are performed on text fragments within the same part based on entity type and semantic similarity, and duplicate entity expressions are removed to obtain a part-level deduplicated entity list; According to the predefined structured template, the deterministic diagnostic entities are filled into the corresponding deterministic fields, and the extended set of uncertainty statements are filled into the uncertainty fields to generate a complete structured diagnostic record corresponding to the sampling site.

[0017] Specifically, in step S102, for the extraction of structured information from pathology diagnosis reports, we designed a set of prompts and processing procedures, aiming to transform unstructured text into structured data containing fields for deterministic and uncertain diagnoses. The task instructions explicitly require the system to extract key information from the input pathology report, including the nature of the lesion, description of the location, and diagnostic conclusions, and output it according to the preset template; The output format specification is defined as a structured data template, in which the deterministic diagnosis field includes a clear pathological type such as "squamous cell carcinoma" and a specific location such as "lung", while the uncertain diagnosis field records possible descriptions of suspected diagnoses such as "suspected inflammatory lesion". Each field must be labeled with a confidence score (0.9 indicates high confidence). Taking pathology as an example, suppose the input report mentions "the right lung tissue shows characteristics of a malignant tumor, consistent with squamous cell carcinoma, accompanied by local necrosis", the system needs to extract "squamous cell carcinoma" as a definitive diagnostic field, with the location being "right lung" and a confidence level of 0.95; Meanwhile, if the report mentions "abnormal hyperplasia is visible in the left lung, nature to be determined", it is classified as an uncertain diagnostic field, described as "suspected abnormal hyperplasia", with a confidence level of 0.7; To achieve this goal, the system uses natural language processing algorithms to segment and identify entities in the text. After analyzing a 5,000-word report, it identified 120 key entities, of which 85 were related to deterministic diagnoses and 35 were related to uncertain diagnoses, achieving a recognition rate of 92%. A rule-based classification algorithm is used to match entities with template fields, and contextual semantic analysis is combined (the semantic similarity between "malignant tumor" and "squamous cell carcinoma" is calculated to be 0.88 using a word vector model) to improve classification accuracy. Furthermore, the system uses a Bayesian probability model to calculate the confidence level for the uncertainty description. After analyzing 1,000 historical data points, the confidence level calculation deviation is controlled within 0.05. The extracted information is integrated according to the template to obtain structured output, which is combined with the needs of pathology business to provide a data foundation for subsequent case tracking and automatically generate diagnostic summaries.

[0018] like Figures 1-3 As shown, in step S103, the pathology report text preprocessed in step S101 and the structured prompt information obtained in step S102 are input into the large language model.

[0019] Further, in step S103, the preprocessed pathology report text data is obtained, and combined with the pre-constructed structured guidance information, the text content is initially semantically parsed using a large language model to obtain a preliminary set of semantic units; For the initial set of semantic units, information extraction tools are used to identify and label key fields of each unit to determine the core information fragments related to diagnosis. Based on the annotated core information fragments, if the fragments contain fields that do not conform to the preset format, the field correction is performed using a rule matching tool to obtain a set of corrected information fragments; By classifying the corrected set of information fragments, the fragments are grouped according to diagnostic categories to obtain the classified diagnostic information groups. For the grouped diagnostic information after classification, the data is populated using a preset format template. It is then determined whether all groups meet the template requirements. If not, the fields are filled in to obtain formatted diagnostic data. Based on the formatted diagnostic data, the integrity of each field is checked using a data validation tool. If any missing items are found, the original text content is traced back to supplement them, thus determining the final structured diagnostic data.

[0020] Specifically, in step S103, in the pathology report processing flow, the system performs deep analysis on the preprocessed text and uses a deep learning-based text segmentation algorithm to split a pathology report of about 3,000 words into 200 independent semantic units, with a segmentation accuracy of 90%. The system extracts features from each semantic unit using a pre-trained language model, generating a 768-dimensional semantic vector. It then uses a clustering algorithm to classify semantically similar units, forming 30 pathological feature clusters, of which 15 are related to definite lesions and the remaining 15 involve descriptions of potential abnormalities. Combining pre-defined structured prompts, the system uses a conditional random field model to label feature clusters and map them to predefined field templates. For example, "gastric mucosal thickening" is labeled as a definite lesion field with a confidence level of 0.85, while "possible erosion" is labeled as a potential abnormality field with a confidence level of 0.6, achieving a labeling coverage of 88%. Building on this, semantic dependency analysis was further used to identify logical relationships between fields, such as the causal relationship between "gastric mucosal thickening" and "accompanied by inflammatory response". After analyzing 200 dependency pairs, the correct identification rate reached 83%. The system integrates all labeled fields into structured data and uses knowledge graph technology to link pathological features with 5,000 records in the historical case database to obtain disease trend analysis data. The entire process is completed automatically by algorithms, building a complete logical chain from text analysis to data integration.

[0021] like Figures 1-3 As shown, S104: Receive the preliminary extraction results of the pathology report text generated by the large language model based on the prompt information.

[0022] Further, in step S104, the preliminary extracted content of the pathology report generated by the large language model based on the prompt information is obtained, and the set of text fragments after preliminary parsing is determined; For the set of text fragments after preliminary analysis, a preset field matching tool is used to filter the content and obtain the core text fragments related to the pathology report; Based on the core text fragments, the text fragments are classified by topic using a hierarchical classification tool. If the topic classification of a certain fragment is unclear, it is reclassified by combining the context clues in the prompt information to determine the text grouping after classification. For the categorized text groups, a preset template is used for field mapping. If incomplete items are found in the field mapping, the information is supplemented by tracing back to the initially extracted content to obtain the mapped structured fragments. Based on the mapped structured fragments, the integrity of each fragment is checked using a content verification tool. If missing information is detected, relevant supplementary information is extracted from the original text of the pathology report to determine the verified data unit. For the verified data units, a logical association tool is used to sort out the contextual relationships between each unit, resulting in a coherent set of pathological information.

[0023] Specifically, in step S104, after the pathology report processing system receives the preprocessed plain text, it uses a Transformer-based BiLSTM-CRF named entity recognition model to extract medical entities from the entire text. For a gastroscopy biopsy report of approximately 2,800 words, the model identifies 182 candidate entities, including 72 anatomical location entities, 56 lesion description entities, 34 morphological modifiers, and 20 uncertain modifiers, with an entity-level F1 score of 0.91. The system constructs a heterogeneous entity co-occurrence network, treating all entities as nodes. If entities appear simultaneously in the same sentence, an undirected edge is established, ultimately forming a dense graph containing 182 nodes and 1268 edges. The Louvain community detection algorithm divides the system into 26 entity communities, of which 8 communities are highly clustered with clearly diagnostic entities, 12 communities contain fuzzy descriptive entities, and the remaining 6 are auxiliary descriptive communities. The system further calculated the mutual information PMI value of entity pairs within each community and screened out 87 strongly associated pairs with PMI > 3.5. For example, the PMI of "Helicobacter pylori infection" and "active inflammation" reached 6.8 and was marked as a high-confidence causal chain. The system performs cosine similarity matching between community-level features and 36 pre-set structured prompt templates, automatically selecting the optimal prompt with a maximum similarity of 0.94. Combined with the extracted entities and relationships, the prompts are filled into the 21 standard fields defined by the JSON Schema, achieving a field completeness rate of 93%. Based on the Neo4j knowledge graph, the system performs subgraph matching between the extracted triples and the cumulative 120,000 pathological structured data in the hospital. Among the 87 historical cases most similar to this case, 68 were eventually diagnosed as chronic atrophic gastritis with intestinal metaplasia, thus generating a lesion progression risk assessment report. The entire process is fully automated and closed-loop.

[0024] like Figures 1-3 As shown in step S105, the preliminary extraction results are parsed and format verified, and then converted into standardized structured data that conforms to the output format specifications.

[0025] Furthermore, in step S105, for the initially extracted content, a preset text analysis tool is used to segment the data to obtain segmented text units; Based on the segmented text units, the content of each unit is categorized using a field recognition tool to determine the labeled data grouping; If the category labeling is found to be inconsistent with the preset specifications after the data grouping is labeled, the category is corrected by the context comparison tool to obtain the corrected data set; Based on the revised dataset, a structured template is used to populate the fields of each data group. If there are gaps in the field population, relevant information is extracted from the original content to determine the populated data framework. For the populated data framework, a content consistency check tool is used to verify the logical relationships between each field, resulting in the verified data structure; Based on the verified data structure, the hierarchical relationships between the data are sorted out using association and organization tools to determine the final standardized data units; For the final standardized data units, a storage mapping tool is used to transform them into a format that conforms to the output specifications, resulting in processed structured data.

[0026] Specifically, in step S105, after receiving the preliminary extraction results, the pathology report processing system immediately starts the parsing module and uses a preset JSON Schema validator to perform field-by-field validation on the input JSON object. For example, for the extraction results of a colonoscopy biopsy report of about 3,500 words, the validator scans 21 standard fields and finds that 3 fields have blank values ​​or type mismatches. Specifically, the "lesion location" field is expected to be a string array but a single string is received. Therefore, the system automatically calls a type conversion algorithm to expand it into an array containing two elements: "sigmoid colon" and "rectum". The validation pass rate is 96.7%. The system integrates a rule engine, using the Drools rule base to load 85 medical logic rules formulated within the hospital. It performs consistency checks on the parsed entities. For example, rule R12 stipulates that if the entity "inflammation" is accompanied by the modifier "moderate", it must be associated with the sub-entity "immune response". If it is missing, it is supplemented from the context sentence. In processing this case, 7 rule conflicts were identified, such as "adenoma" and "cancer" co-occurring but without the "grading" field. Therefore, the engine triggers a fuzzy matching algorithm to calculate candidate word replacements with a Levenshtein edit distance of less than 2, corrects 2 conflicts and generates a correction log. The rule execution time is only 0.23 seconds. After the parsing and verification are completed, the system calls the standardized converter to map entities to international coding standards based on the predefined ICD-10 mapping table. For example, "polypoid lesion" is mapped to the K63.5 code, and "low-grade dysplasia" is mapped to D12.6. During the conversion process, the TF-IDF weighted algorithm is used to evaluate the mapping confidence, and the threshold is set to 0.85. In this example, 89% of the entities are successfully mapped. Among them, "multiple polyps" triggers manual, uninterrupted Bayesian network inference due to its ambiguity. The most likely code K63.5 is inferred from 4,500 cases in the historical dataset and filled with a probability of 0.92 to ensure the uniqueness of the code. The converter further integrates the SNOMED CT ontology library and performs semantic enhancement on relation triples. For example, the original triple "gland-accompanying-dysplasia" is expanded into "gland-causing-increased risk of precancerous lesions" through ontology reasoning. The reasoning chain traverses the ontology graph with a path length of no more than 3 through SPARQL query, and finally outputs a structured dataset containing 156 enhanced triples. Meanwhile, the system embeds a verification feedback loop, using the BERT embedding model to calculate the cosine similarity between the original extracted and standardized data. For example, in this case, the average similarity is 0.88, which is lower than the threshold of 0.9. Some communities trigger local re-parsing. 15 pairs of entities with a PMI value greater than 4.2 are selected and re-injected into the BiLSTM model for fine-tuning. After adjustment, the similarity is improved to 0.93, forming a closed-loop optimization. Standardized data is exported in HL7 FHIR-compatible JSON format, including a complete diagnostic summary, risk stratification such as "intermediate risk cancer probability 28.4%", and an evolution path diagram. The entire parsing, verification, and transformation process is automated. The logical chain from verification to mapping to enhancement ensures the seamless evolution of data from preliminary results to clinically usable structured knowledge, supporting downstream decision-making such as personalized treatment recommendations.

[0027] The above description is merely a preferred embodiment of one or more embodiments of this specification and is not intended to limit the scope of one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of one or more embodiments of this specification should be included within the scope of protection of one or more embodiments of this specification.

Claims

1. A method for extracting textual information from pathological diagnosis reports based on a large language model, characterized in that, S101. Preprocess the input unstructured pathological diagnosis report text, including text cleaning, standardization, and dividing the text into text segments corresponding to different sampling sites based on content relevance. S102. Generate structured prompt information based on the preset categories of information fields to be extracted. The prompt information shall include at least the task instructions, output format specifications and examples in the pathology field. The output format specifications are used to define a structured data template containing deterministic diagnostic fields and uncertain diagnostic fields. S103. Input the pathology report text preprocessed in S101 and the structured prompt information obtained in S102 into the large language model; S104. Receive the preliminary extraction results of the pathology report text generated by the large language model based on the prompt information; S105. Parse and validate the format of the preliminary extraction results, and convert them into standardized structured data that conforms to the output format specifications.

2. The method for extracting textual information from pathological diagnostic reports based on a large language model according to claim 1, characterized in that, Specifically, S101 includes: Clean the original pathology diagnosis report text, remove irrelevant information such as headers, footers, and hospital headings, and obtain plain text; The plain text was standardized using a unified terminology list, which replaced synonyms, corrected typos, and standardized the format to obtain standardized text. The candidate list of parts is obtained by matching the part names in the standardized text with the preset part dictionary; For each part name, extract the sentences within the preset window range before and after it to obtain a preliminary set of part fragments; Dependency parsing is performed on each sentence in the preliminary fragment set of the part to determine whether its subject or modifier relationship points to the current part. Only sentences that point to the part are retained to obtain the refined fragment set of the part, and sentences that are not claimed are marked as unrelated parts. For sentences claimed by multiple parts, they are assigned to a single part based on the order of appearance of the part names and the principle of closest proximity, resulting in a set of unique fragments for each part. The unique set of fragments for the specified location and the text of the unrelated location are rearranged in their original order to obtain independent text fragments corresponding to the specific source location.

3. The method for extracting textual information from pathological diagnostic reports based on a large language model according to claim 1, characterized in that, Specifically, S102 includes: Named entity recognition is performed on the segmented text fragments to identify at least one entity from disease, grade, depth of invasion and resection margin status, and lymph node status, thus obtaining a preliminary entity list. Dependency parsing is used to extract the dependency path of each entity in the sentence. Based on whether the dependency path contains a negation word or a probability word, the entity is labeled with a preliminary deterministic tag. The sentence containing the entity is encoded using a pre-trained biomedical language model, the semantic similarity between the entity and the sentence is calculated, and the preliminary deterministic labels are verified and corrected to obtain a set of entities with final deterministic labels. For entities whose final determination label is uncertain, trace the nearest trigger word and conditional clause along the dependency tree and concatenate them to form a complete uncertainty diagnostic phrase; Cluster and merge entities within the same location to remove duplicates, resulting in a location-level entity list. According to the preset structured data template, the deterministic diagnostic entities and uncertain diagnostic phrases are filled into the corresponding deterministic diagnostic fields and uncertain diagnostic fields, respectively, to generate a structured diagnostic record corresponding to the sampling site.

4. The method for extracting textual information from pathological diagnostic reports based on a large language model according to claim 1, characterized in that, Specifically, S103 includes: The preprocessed pathology report text and the structured prompt information are used as combined input; The combined input is submitted to the large language model for processing via an application programming interface or local call.

5. The method for extracting textual information from pathological diagnostic reports based on a large language model according to claim 1, characterized in that, In step S104, the large language model obtains natural language text containing preliminary diagnostic information as the preliminary extraction result based on the task instructions and output format specifications in the prompt information.

6. The method for extracting textual information from pathological diagnostic reports based on a large language model according to claim 1, characterized in that, Specifically, S105 includes: The preliminary extraction results are parsed to extract the content corresponding to the preset fields; The extracted content is mapped and standardized with a medical knowledge base to unify terminology. Verify the completeness and logical consistency of the data, and supplement any missing information; Convert the validated data into a standardized structured data format.

7. The method for extracting textual information from pathological diagnostic reports based on a large language model according to claim 6, characterized in that, The medical knowledge base includes at least an International Classification of Diseases (ICD) coding mapping table and a medical terminology ontology.

8. The method for extracting textual information from pathological diagnostic reports based on a large language model according to claim 6, characterized in that, The logical consistency verification is performed by loading a preset medical logic rule library to automatically check and correct the relationships between parsed entities and fields.

9. The method for extracting textual information from pathological diagnostic reports based on a large language model according to claim 1, characterized in that, The output format specification is one of JSON format, XML format, or relational database table structure.

10. The method for extracting textual information from pathological diagnostic reports based on a large language model according to claim 1, characterized in that, The method employs an encrypted channel during data transmission and processing, and supports the localized deployment of the large language model.