Drug production data table processing method based on document analysis and HTML rendering
By constructing a standardized table state dataset, performing structural consistency analysis of nested tables and paragraphs, and adjusting visual salient features, the problem of insufficient parsing granularity in pharmaceutical production tables was solved. This enabled accurate restoration of table structure and integration with business processes, improving the accuracy and consistency of pharmaceutical production data table processing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHENGDU HONGRUI TECH
- Filing Date
- 2026-01-30
- Publication Date
- 2026-05-05
AI Technical Summary
Existing technologies, when processing drug production tables with high nesting, cross-unit merging, or diverse style attributes, suffer from insufficient parsing granularity, missing structural semantics, difficulty in restoring the original expressive intent of the table, and insufficient utilization of visual style information, failing to support dynamic layout and semantic linkage expression in complex drug production scenarios.
By collecting table recognition data, location mapping data, and performance data, a standardized table state dataset is constructed. Structural consistency and semantic association analysis are performed between nested tables and paragraphs. The attribution marking strategy of tables in document paragraphs is dynamically adjusted, the logical hierarchy of table structure is reconstructed, and the layout priority of cells is adjusted based on visually significant features. Finally, structured records are generated and connected to the business processes of the manufacturing execution platform.
It achieves accurate restoration of multi-layered structures and contextual logical relationships in tables, improves the ability to reproduce structures, enhances the consistency and traceability of structural semantics, ensures the consistency of cross-platform parsing, and supports accurate rendering of complex tables and integration with business processes.
Smart Images

Figure CN121615613B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of document data processing technology, specifically to a method for processing pharmaceutical production data tables based on document parsing and HTML rendering. Background Technology
[0002] With the increasing prevalence of digital office scenarios, structured documents are playing an increasingly significant role in pharmaceutical production management, quality control, and batch traceability. Especially in the generation, editing, and transmission of tabular data, accurately identifying key fields, preserving their structural attributes, and achieving high-quality rendering have become crucial aspects supporting the construction of electronic pharmaceutical record systems. Currently, mainstream table processing methods typically rely on general text parsing engines or template-matching-based recognition logic, utilizing OCR technology or rule extraction algorithms to identify cell content and locate table outlines, and then reconstructing and rendering the table based on row and column index information. Some advanced solutions also incorporate machine learning methods to enhance the model's adaptability to different table styles, thereby improving the accuracy and generalization ability of structure recognition.
[0003] For example, the invention patent with announcement number CN105630916B relates to a method for extracting and organizing unstructured tabular document data in a big data environment. First, it analyzes the structural and data flow characteristics of unstructured tabular documents and defines data extraction rules. Second, it presents the data extraction process and algorithm for unstructured tabular documents. Third, it provides a method for converting the extracted results into structured data. Finally, it presents a method for analyzing the obtained structured dataset based on the MapReduce parallel programming model. This method can provide technical support for mining the knowledge hidden in unstructured tabular documents in a big data environment.
[0004] For example, the invention patent with announcement number CN103955497B relates to a method for collecting and summarizing data in a custom table, including the following steps: obtaining attribute data of the custom table from the database and storing it in data table one of the database; receiving data filled in by the reporting end in the corresponding data entry cells of the custom table; saving the reporting records of the reporting end to data table two of the database, and saving the reported data to the server in the form of a text file; extracting the relevant reporting records from data table two of the database; extracting the content of the reported data based on the reporting records and the document names of all reported data, and processing it into a table. This invention can provide users with a data collection and summarization service for custom tables. The initiator only needs to set the table format according to their own needs, and the reporter fills in the table according to the form set by the initiator. Finally, the system can automatically generate a master table composed of the data filled in by all reporters upon request. The format of the data filled in by the reporters is also unrestricted, which is highly flexible.
[0005] However, existing methods still suffer from insufficient parsing granularity, missing structural semantics, and distorted style restoration when processing highly nested, cross-unit merged, or diverse style attributes in pharmaceutical production tables. On the one hand, most parsing logic fails to fully consider implicit attributes such as the table's structural hierarchy, cross-paragraph affiliation, and logical binding within the document, making it difficult to restore the table's original expressive intent during HTML rendering. On the other hand, visual style information such as font weight, color, and border line type is often treated as additional attributes rather than structural features, thus being ignored or weakened, failing to provide end-users with visual guidance on structural differences. Furthermore, existing structural parsing methods generally employ fixed rules and static mapping strategies, lacking adaptive judgment and weight modeling for diverse structural features in the document, making it difficult to support dynamic layout, field recognition, and semantic linkage expression in complex pharmaceutical production scenarios.
[0006] To address the above issues, there is an urgent need for a method for processing pharmaceutical production data tables based on document parsing and HTML rendering. Summary of the Invention
[0007] Technical problems to be solved
[0008] To address the shortcomings of existing technologies, this invention provides a method for processing pharmaceutical production data tables based on document parsing and HTML rendering. This method solves the problem of a lack of binding between document structure and business fields, which seriously hinders the construction of a unified data framework and business-driven processes.
[0009] Technical solution
[0010] To achieve the above objectives, this invention provides the following technical solution: a method for processing pharmaceutical production data tables based on document parsing and HTML rendering, comprising: S1, collecting table identification data, position mapping data, and performance data during the table processing process, and preprocessing the collected table identification data, position mapping data, and performance data to construct a standardized table state dataset; S2, based on the standardized table state dataset, performing correlation analysis on the structural belonging consistency and semantic association tightness between nested tables and their respective paragraphs, and dynamically adjusting the table's belonging labeling strategy in document paragraphs based on the correlation analysis results; S3, based on the standardized table state dataset, evaluating the structural degree of cells from their row and column positioning in the main table structure, and reconstructing the logical hierarchy of the table structure based on the intensity evaluation results; S4, using the correlation analysis results and intensity evaluation results as input, prioritizing the information importance of cells based on structural cascading relationships and visual salient features, and adjusting the layout priority of cells based on the priority evaluation results; S5, generating structured records based on the rendered tables and connecting them to the business processes of the manufacturing execution platform.
[0011] Furthermore, the specific steps for collecting table recognition data, position mapping data, and performance data during the table processing are as follows: Collecting table recognition data during the document structure hierarchy division process, including: row number, column number, number of horizontal columns spanned, number of vertical rows spanned, number of nested levels, number of rows in nested sub-tables within a cell, and height of nested sub-tables; collecting position mapping data during the table structure construction process, including: the table sequence number of the table to which the cell belongs, the paragraph number of the paragraph to which the table belongs, the section number of the section to which the paragraph belongs, the starting and ending row numbers of merged cells vertically, and the starting and ending column numbers horizontally; collecting performance data during the style feature extraction process, including: font weight, font size, font level, italic status, underline status, text font foreground color, and cell background color in each cell.
[0012] Furthermore, the specific steps for preprocessing the collected table recognition data, location mapping data, and performance data to construct a standardized table state dataset are as follows: For the table recognition data, the row and column numbers of each cell are standardized to integers and sorted sequentially. Simultaneously, the number of horizontal columns spanned and the number of vertical rows spanned are normalized to positive integers. A unified hierarchical identifier is used to represent the nesting relationship, and the number of rows and height of nested sub-tables are compressed to a fixed scale range using linear stretching. For the location mapping data, the table sequence number, paragraph number, and section number are encoded and verified to eliminate duplicate and missing numbers and standardize the format to comparable integer values. The starting and ending row numbers of merged cells, as well as the starting and ending column numbers horizontally, are checked for interval validity. If there are cases where the starting and ending numbers are equal, they are retained as the cell body. For the performance data, the font weight information is mapped using a mapping function. The text is standardized into a numerical representation to obtain the visual line thickness of the text, denoted as the font thickness intensity value. Font size, font level, italic cases, and underline cases are input into a weighted superposition model. A multi-dimensional feature attention fusion mechanism is used to dynamically allocate contribution weights, and a sparse constraint-based saliency projection algorithm is used to extract the most discriminative visual combination expression. The fused visual combination expression result is linearly embedded and reconstructed through generalized weighted transformation, finally outputting the text emphasis value. The RGB color values of the foreground color and cell background color of the text font in the cell are extracted by a style parsing algorithm and converted into color components in the HSV color space. The Euclidean distance between the foreground color component of the text font and the cell background color component is calculated as a numerical expression of color contrast intensity, denoted as the color saliency intensity value. The standardized table recognition data, position mapping data, and performance data are normalized to construct a standardized table state dataset.
[0013] Furthermore, the specific steps for performing association analysis on the structural belonging consistency and semantic association tightness between nested tables and their respective paragraphs based on the standardized table state dataset are as follows: Add the number of rows of the nested sub-tables in the current cell to the height of the nested sub-tables, then divide by the sum of the number of horizontal columns spanned and one to obtain the nested structure complexity; add one to the nesting level of the cell to the left of the current cell and multiply by the nested structure complexity to obtain the hierarchical structure correction value; add one to the paragraph number of the current table's paragraph and divide by the sum of the section number of the current paragraph and one to obtain the section belonging reliability ratio; add the hierarchical structure correction value to the section belonging reliability ratio to obtain the nested paragraph association strength value of the current cell.
[0014] Furthermore, the specific steps of the strategy for dynamically adjusting the table's attribution marking in document paragraphs based on the association analysis results are as follows: Real-time comparison of the nested paragraph association strength value and the association strength threshold of the current cell. The association strength threshold includes a first strength threshold and a second strength threshold, where the first strength threshold is higher than the second strength threshold. When the nested paragraph association strength value is greater than the first strength threshold, the current cell is marked as a structural anchor point, and the structured meta-information of the current cell is injected into the HTML rendering. When the nested paragraph association strength value is greater than the second strength threshold and less than or equal to the first strength threshold, the paragraph number and structural path corresponding to the current cell are recorded, and a unique anchor field is generated to mark the cell position, providing a field mapping reference when interfacing with LIMS and MES systems. When the nested paragraph association strength value is less than the second strength threshold, a positional structure is generated. If the warning information is uncertain, a structural confirmation prompt is added during rendering, and the table sequence number, paragraph number, and nesting level of the cell are marked. At the same time, the table identification data of the adjacent cells of the current cell are checked, and the paragraph belonging of the current cell is obtained based on the spatial adjacency relationship and the table header context. The nested paragraph association strength value of each cell in the entire table is averaged to obtain the average nested paragraph association strength value. If the average nested paragraph association strength value is higher than the first strength threshold, the entire table adopts the nest-first rendering template to strengthen the independent presentation of sub-tables. If the average nested paragraph association strength value is greater than the second strength threshold and less than or equal to the first strength threshold, a hybrid structure rendering template is used to balance the stability between the master-detail structure and the field layout. If the average nested paragraph association strength value is less than the second strength threshold, the table is retained as the original image rendering.
[0015] Furthermore, the specific steps for evaluating the strength of cell structure based on the row and column location of a cell in the main table structure using a standardized table state dataset are as follows: Divide the sum of the cell's row and column numbers by the sum of the number of rows spanned vertically and the number of columns spanned horizontally, plus one, to obtain the normalized positional expression value; add one to the table sequence number of the cell's table and take its natural logarithm to obtain the text structure complexity; subtract the starting row number from the ending row number of the merged cell vertically and add one to obtain the row-to-row merge span; subtract the starting column number from the ending column number of the merged cell horizontally and add one to obtain the column-to-row merge span; add the row-to-row merge span and the column-to-row merge span and divide by two to obtain the merged structure complexity; multiply the text structure complexity and the merged structure complexity and add them to the normalized positional expression value to obtain the structured attribute strength value.
[0016] Furthermore, the specific steps for reconstructing the logical hierarchy of the table structure based on the intensity assessment results are as follows: Obtain the structured attribute intensity values of all cells, arrange all cells in descending order of structured attribute intensity values, and construct a sequence of structured attribute intensity values; in the structure restoration stage, first process the cells with the maximum structured attribute intensity value, and then process the subsequent cells in descending order of structured attribute intensity values; in the compression and attribute injection stage, keep cells with structured attribute intensity values greater than or equal to the attribute intensity threshold uncompressed and inject complete merged boundary attributes; scale cells with structured attribute intensity values less than the attribute intensity threshold proportionally and inject only basic coordinate attributes; in the map rendering stage, map the structured attribute intensity values to grayscale pixel brightness values using a normalized linear algorithm, and perform visual image enhancement based on the grayscale pixel brightness values.
[0017] Furthermore, the specific steps for prioritizing the information importance of cells based on structural cascading relationships and visual salience features, using the association analysis results and strength assessment results as input, are as follows: Add the nested paragraph association strength value and the structured attribute strength value, then divide by two to obtain the structural-level basic strength value; divide the sum of the font weight strength value, text emphasis value, and color salience strength value by three, then add this sum to one to obtain the visual expression weight value; multiply the structural-level basic strength value and the visual expression weight value to obtain the rearrangement priority value.
[0018] Furthermore, the specific steps for adjusting the layout priority of cells based on the priority evaluation results are as follows: based on the reorder priority value calculation results, the cells are rendered and arranged sequentially in descending order of their corresponding reorder priority values; during the actual arrangement process, if the target position of the current cell is occupied by a cell with a lower reorder priority value, the cell with the lower reorder priority value is removed from the reorder sequence and added back to the arrangement process after the current cell is inserted; for cells that meet any of the following conditions: font weight value is greater than the standard weight threshold, italic text is marked as italic, or the difference between the RGB color values of the text font foreground color and the cell background color exceeds the color value threshold, the cell is retained. The data is presented in the cell structure buffer. If the cell's rearrangement priority is lower than the rearrangement threshold, it is placed in the structure buffer. After rendering and arranging, the position of each cell in the actual rendering result is compared with the row and column numbers of the original cells to determine if there is a positional offset. If the rearrangement priority of a cell with a positional offset is greater than the average rearrangement priority of all cells in the same row, the position correction operation is performed first, and the cell is rendered again in the empty area before the target coordinates. If the rearrangement priority of a cell with a positional offset is less than or equal to the average rearrangement priority of all cells in the same row, it is filled in the original sequence, and finally an HTML table with a complete two-dimensional structure is generated.
[0019] Furthermore, the specific steps for generating structured records based on the rendered table and connecting them to the manufacturing execution platform are as follows: using an HTML table with a complete two-dimensional structure as the source of structured data, identifying the row and column numbers attached to each cell, establishing a mapping relationship between field coordinates and cell content based on the row and column numbers, forming a raw value extraction table indexed by field position; extracting the logical row structure in the raw value extraction table, combining fields in the same row into structured records, and generating a data format for the business system according to the field meaning conversion rules; after generating the structured records, further calling the field mapping template, and finally connecting the structured records to the relevant business process nodes in the enterprise-level manufacturing execution platform.
[0020] Beneficial effects
[0021] The present invention has the following beneficial effects:
[0022] (1) The method for processing drug production data tables based on document parsing and HTML rendering achieves accurate restoration of multi-level structures and contextual logical relationships in tables by identifying nested hierarchical structures and preprocessing position mapping information, thereby improving the ability to reproduce the structure of complex tables.
[0023] (2) The drug production data table processing method based on document parsing and HTML rendering ensures that key cells maintain structural identification attributes in HTML rendering through structural anchor point identification and threshold judgment mechanism, thereby enhancing the consistency and traceability of structural semantics.
[0024] (3) The drug production data table processing method based on document parsing and HTML rendering realizes the hierarchical expression of the main table structure and the nested sub-table structure through attribute injection rules and structure master-slave relationship differentiation strategy, which improves the parsing accuracy in multi-table parallel scenarios.
[0025] (4) The method for processing drug production data tables based on document parsing and HTML rendering achieves synchronous unification of structural semantics in the visual and logical layers by dynamically injecting structural attributes during the rendering stage, thus ensuring the consistency of cross-platform parsing.
[0026] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description
[0027] Figure 1 This is a flowchart of the pharmaceutical production data table processing method based on document parsing and HTML rendering according to the present invention;
[0028] Figure 2 This is a diagram showing the HTML injection field coverage involved in this invention.
[0029] Figure 3 This refers to the structure-aware grayscale map involved in this invention;
[0030] Figure 4 This is a line graph showing the rearrangement priority values involved in this invention. Detailed Implementation
[0031] 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.
[0032] Please see Figures 1-4This invention provides a technical solution: a method for processing pharmaceutical production data tables based on document parsing and HTML rendering, comprising: S1, collecting table identification data, position mapping data, and performance data during table processing, and preprocessing the collected table identification data, position mapping data, and performance data to construct a standardized table state dataset; S2, based on the standardized table state dataset, performing correlation analysis on the structural belonging consistency and semantic association tightness between nested tables and their respective paragraphs, and dynamically adjusting the table's belonging labeling strategy in document paragraphs based on the correlation analysis results; S3, based on the standardized table state dataset, evaluating the structural degree of cells from the row and column positioning of cells in the main table structure, and reconstructing the logical hierarchy of the table structure based on the intensity evaluation results; S4, using the correlation analysis results and intensity evaluation results as input, prioritizing the information importance of cells from structural cascading relationships and visual salient features, and adjusting the layout priority of cells based on the priority evaluation results; S5, generating structured records based on the rendered tables and connecting them to the business processes of the manufacturing execution platform.
[0033] Specifically, the steps for collecting table recognition data, position mapping data, and performance data during table processing are as follows: First, collect table recognition data during the document structure hierarchy division process. This structure hierarchy data includes: row number, column number, number of horizontal columns spanned, number of vertical rows spanned, number of nested levels, number of rows in nested sub-tables within each cell, and height of the nested sub-tables. This accurately describes the spatial arrangement and hierarchical affiliation of each field cell within the table, supporting the identification and processing of multi-level nested structures. Second, collect position mapping data during the table structure construction process. This position mapping data includes: the table sequence number of the cell's table, the paragraph number of the paragraph to which the table belongs, and the paragraph's position... The section number, the starting and ending row numbers of merged cells in the vertical direction, and the starting and ending column numbers in the horizontal direction are used to establish the structural position coordinate relationship of cells in the entire document, supporting table positioning and structural mapping across sections; performance data is collected during the style feature extraction process, including: font weight, font size, font level, italics, underline, text font foreground color, and cell background color in each cell, to help construct visual feature vectors of structural fields, which are used to enhance the cell differentiation ability dominated by style and the perceptual expression effect of rearrangement, and enhance the semantic expression support of table structure and its field combination characteristics.
[0034] This implementation scheme achieves fine-grained semantic analysis of table structures through the collaborative collection of three types of data. First, by collecting row numbers, column numbers, number of columns spanned, number of rows spanned, number of nesting levels, and nested sub-table structure parameters of each cell during the document's hierarchical division process, the scheme accurately reconstructs the cell hierarchy and spatial arrangement characteristics under complex nested structures, providing necessary support for the structural identification and field location of multi-level tables. Second, by collecting positional mapping data during the table construction process, including the sequential numbering of each cell's table, paragraph, and section, as well as the starting and ending row and column positions of the merged range, the scheme establishes the coordinate mapping relationship of cells within the entire document structure. This helps to achieve global positioning and accurate mapping of table structures in complex scenarios with paragraph spanning and section nesting. Finally, the collection of performance data covers font weight, size, font level, italics, underline, and color information. This data can be used to construct visual expression feature vectors for cells, enhancing the ability to identify differences in field style and supporting the rearrangement analysis and perceptual expression optimization of structural fields. Overall, this step provides crucial data support for the accurate structural positioning, visual style analysis, and reorganization sorting of table fields in documents.
[0035] Specifically, the preprocessing of collected table recognition data, location mapping data, and performance data to construct a standardized table state dataset involves the following steps: In the table recognition data section, the row and column numbers of each cell are standardized to integers and arranged in order, ensuring a clear sequence relationship in the spatial position of all cells within the document; the number of horizontal columns spanned and the number of vertical rows spanned are normalized to positive integers, ensuring a consistent scale for the number of cross-boundaries across documents from different sources; a unified hierarchical identifier is introduced based on the nesting level, enabling a complete description of multi-level nested table structures; the number of rows and height of nested sub-tables are compressed to a fixed scale using linear stretching, making cross-document structure comparisons comparable. In the location mapping data section, the table sequence numbering, paragraph numbering, and section numbering are encoded and validated to eliminate duplicate and missing numbers, and then standardized to comparable integer representations; the starting and ending row and column numbers of merged structures are checked for validity, and when the starting and ending numbers are consistent, they are treated as ordinary cells and retained to avoid misidentification as merged cells.
[0036] In the performance data section, a mapping function converts font thickness information into continuous numerical values to characterize the thickness of text lines, thereby generating font thickness intensity values. The model weights four input factors—font size, font level, italics, and underline—are superimposed. Internally, a multi-dimensional feature attention fusion mechanism automatically learns the contribution ratios. All weights are determined during training by minimizing style discrimination error, ensuring that the final text emphasis value accurately reflects visual prominence. During weight determination, a validation set stability index is used as a threshold, enabling the model to adaptively select and retain or weaken certain visual features. For color saliency intensity values, a style parsing algorithm obtains the RGB values of the foreground and background colors and converts them to HSV space. Euclidean distance is used to quantify the contrast between text and background, allowing visual differences to be expressed numerically.
[0037] After converting all the above data to a unified scale, the table recognition data, location mapping data, and performance data are normalized to form a standardized table state dataset with complete structure and clear visual features, providing a reliable data foundation for subsequent field structure inference, visual analysis calculation, and rendering reconstruction.
[0038] This implementation plan establishes a unified, computable, and alignable table structure foundation for subsequent structural analysis, field location, and rendering reconstruction. By standardizing and quantifying three types of raw data, spatial relationships, hierarchical relationships, and visual features in the document can be entered into the calculation process in a clear, stable, and unambiguous manner. By standardizing row numbers, column numbers, the number of rows and columns spanned, and nesting levels, the spatial layout of the table has a consistent digital structural expression, ensuring that complex nesting, merging relationships, and cross-level structures will not be misjudged or missed in subsequent analysis. Subsequently, position numbers, paragraph numbers, and section numbers are uniformly verified and formatted to achieve precise positioning of the table within the entire document, enabling reliable tracking of the source location of field content. Furthermore, by mapping font weight, font size, italics, and underline features into numerical expressions, generating text emphasis through a clear attention fusion mechanism, and obtaining color saliency through color component distance, visual features in the document that were originally difficult to quantify have an analyzable and comparable continuous expression method. After completing the above transformation, all structural information and visual features are normalized according to unified rules to construct a standardized table state dataset. This allows table content from different document sources, formats, and editing styles to be analyzed and compared within the same scale. Ultimately, this step lays a stable data foundation for subsequent field relationship inference, visual weight calculation, table structure rearrangement, and accurate rendering, ensuring consistency, scalability, and accuracy throughout the entire parsing process.
[0039] Specifically, based on a standardized table state dataset, the following steps are taken to analyze the structural belonging consistency and semantic association tightness between nested tables and their corresponding paragraphs: The nested structure complexity is obtained by adding the number of rows and height of the nested sub-tables in the current cell and dividing by the sum of the number of horizontal columns spanned and one; the hierarchical structure correction value is obtained by adding one to the nesting level of the cell to the left of the current cell and multiplying by the nested structure complexity; the section attribution reliability ratio is obtained by adding one to the paragraph number of the current table's corresponding paragraph and one; and the hierarchical structure correction value is added to the section attribution reliability ratio to obtain the nested paragraph association strength value of the current cell.
[0040] The formula for calculating the correlation strength value of nested paragraphs is:
[0041] ;
[0042] In the formula, This indicates the number of nested sub-table rows in the current cell. It is used to quantify the size of the sub-table structure at this position and is a basic parameter for constructing the master-detail table hierarchy. It is derived from the statistical results of nested elements in the table. This indicates the height of the nested sub-tables in the current cell. It is used to assess the vertical complexity of the nested structure and is an important basis for maintaining the original paper logic structure during rendering output. It is derived from the cumulative value of the number of nested table rows extracted by TableInfos. This indicates the number of columns the current cell spans horizontally. It is used to correct the impact of nested structures on the original column layout and is a key denominator in the normalization calculation of nested complexity. It comes from the parsing result of the GridSpan attribute. This indicates the nesting level of the cell to the left of the current cell. It is used to maintain the consistency of nesting logic within the same table row and is an important intermediate variable for calculating the substructure progression relationship. It is derived from the nesting structure identification result of the left neighboring cell during the parsing process. This indicates the paragraph number of the current table, used to establish the correspondence between the document text paragraphs and the table structure. It is the index basis for subsequent field location and business process node binding, and comes from the ParagraphIndex serial number annotation in TextInfos. This indicates the section number of the current paragraph, used to locate the section-level scope in the document structure. It is key to synchronizing the logical paragraph to which the table belongs with the modular structure of the document, and is derived from the structure number of the paragraph tag `sectPr`.
[0043] In this implementation plan, the structural attachment relationship between nested sub-tables in a Word table and their respective paragraphs is quantified. The association strength value of nested paragraphs in each cell is calculated. While preserving the original table hierarchy, it is determined whether the nested sub-tables have a significant structural membership relationship and rendering binding logic with the current paragraph. This helps to maintain the logical presentation order of paper forms during HTML rendering and provides basic support for subsequent MES field alignment and table semantic extraction.
[0044] Specifically, the steps for dynamically adjusting the attribution tagging strategy of tables within document paragraphs based on association analysis results are as follows: Real-time comparison of the association strength value of nested paragraphs in the current cell with the association strength threshold. The association strength threshold is divided into a first strength threshold and a second strength threshold, with the first strength threshold being higher than the second strength threshold. For cells with an association strength value exceeding the first strength threshold, a structural anchor point is immediately triggered, treating the cell as a stable structural core, and injecting complete structured meta-information into it during the HTML rendering stage. To avoid misjudgments due to instantaneous fluctuations, the association strength value must remain above the first strength threshold for a specified time before final confirmation. If it falls below the threshold prematurely, a debouncing stage is initiated for short-term buffering to ensure the tagging has stable reliability.
[0045] For cells whose association strength values fall between the second and first strength thresholds, their paragraph number and structural path are recorded, and a unique anchor field marker is generated to support subsequent field mapping. When interfacing with the production data platform, the aforementioned marker serves as reference information for field position inference, ensuring the continuity of cross-paragraph and cross-table associations. The markers for these cells also include a buffer time setting; confirmation is only granted if several consecutive checks show the cell is within this range, filtering out false triggers caused by short-term fluctuations.
[0046] When the correlation strength value of nested paragraphs falls below the second strength threshold, a positional structure uncertainty warning mechanism is triggered. During the rendering phase, a structure confirmation flag is attached to the cell, and its table sequence number, paragraph number, and nesting level are recorded simultaneously. To avoid rendering errors caused by low correlation, a rollback logic is automatically executed, backtracking the structure recognition results of adjacent cells and combining spatial adjacency, table header context, and row / column pattern to infer the paragraph affiliation of the current cell, restoring its true structural position to the greatest extent possible.
[0047] Beyond cell-level processing, the nested paragraph association strength values for the entire table are statistically analyzed, and the average value is calculated. If the average value is higher than the first strength threshold, a nested-first rendering template is used to emphasize the independent presentation of sub-tables and ensure clear visual layering of complex nesting. If the average value is between the second and first strength thresholds, a hybrid structure rendering template is used to strike a balance between the stability of the main structure and the layout of local fields, reducing layout instability caused by structural conflicts. If the average value is lower than the second strength threshold, a global fallback strategy is executed, directly preserving the basic image rendering format to avoid structural errors caused by forced parsing.
[0048] like Figure 2 The diagram shows the HTML field coverage provided in this application example, illustrating the nesting depth distribution of key fields in a pharmaceutical production data table within the HTML rendering structure. The horizontal axis lists seven typical fields: production batch number, active pharmaceutical ingredient concentration, sterilization temperature, sterilization time, filling volume, packaging method, and inspection record. The vertical axis represents the HTML structural hierarchy of each field; higher values indicate deeper DOM structures, increasing rendering difficulty and extraction complexity. The diagram shows that the inspection record field has the highest nesting level (level 5), reflecting its nesting within complex components, collapsible containers, and script generation areas. In contrast, the active pharmaceutical ingredient concentration and packaging method are only at level 2, indicating their location within shallower, less complex standard table cells. Overall, the nesting levels of the fields exhibit significant differences, revealing uneven field distribution and inconsistent structural levels in the current HTML table rendering process. This provides a basis for subsequent field standardization and rendering logic unification.
[0049] In this implementation scheme, multi-level strength threshold judgment, stability detection, debouncing control, and necessary backtracking inference ensure the stable and reliable recognition of nested paragraph structures. When the association strength value of nested paragraphs reaches a high level, the cell is identified as a structural anchor point and injected with structured metadata; when the association strength is in the middle range, the paragraph number and structural path are recorded to generate a unique marker, providing a consistent reference for subsequent field positioning; when the association strength is low, a structure confirmation prompt is triggered, and its true paragraph position is restored through adjacency relationships and context backtracking inference. Simultaneously, the average association strength value across the entire table is calculated, and three rendering templates—nesting priority, mixed structure, or basic image—are automatically selected to make the overall structure presentation adaptive. This step ultimately achieves stability in nested structure recognition, continuity in structure positioning, and reliability in the rendering strategy.
[0050] Specifically, based on a standardized table state dataset, the strength assessment of the structured degree of a cell based on its row and column location within the main table structure involves the following steps: Divide the sum of the cell's row and column numbers by the sum of the number of rows spanned vertically and the number of columns spanned horizontally, plus one, to obtain the normalized positional expression value; Add one to the table sequence number of the cell's table and take its natural logarithm to obtain the text structure complexity; Subtract the starting row number from the ending row number of the merged cell vertically and add one to obtain the row-to-row merge span; Subtract the starting column number from the ending column number of the merged cell horizontally and add one to obtain the column-to-row merge span; Add the row-to-row merge span and the column-to-row merge span and divide by two to obtain the merged structure complexity; Multiply the text structure complexity by the merged structure complexity and then add it to the normalized positional expression value to obtain the structured attribute strength value.
[0051] The formula for calculating the strength value of structured attributes is:
[0052] ;
[0053] In the formula, Indicates the row number of the current cell, used to uniquely identify the cell's vertical position in the main table. It is the basic parameter for calculating table row-level coordinates and comes from the rowIndex attribute in the Word table structure. Indicates the current cell column number, used to uniquely identify the cell's horizontal position in the main table. It is the basic parameter for calculating column-level coordinates in the table and comes from the colIndex attribute in the Word table structure. This indicates the number of rows spanned vertically by the current cell. It is used to identify whether the cell is merged with the cell below it and is a key indicator for merging cell recognition and rowspan rendering. It comes from the rowCount attribute in the Word table structure. This indicates the number of columns the current cell spans horizontally. It is used to correct the impact of nested structures on the original column layout and is a key denominator in the normalization calculation of nested complexity. It comes from the parsing result of the GridSpan attribute. The table index of the cell is used to describe the cell's position in the document's table sequence. It is an important parameter for identifying the table partition structure and comes from the tableIndex property output by the table layer structure parsing module. This indicates the end row number of the current merged cell in the vertical direction. It is used to identify the end position of the merged area from top to bottom in the main table. It is the lower boundary reference value for calculating the rowspan merging logic and comes from the merge-end-row attribute in WordXML. This indicates the starting row number of the current merged cell in the vertical direction. It is used to identify the starting position of the merged area from top to bottom in the main table. It is the upper boundary reference value for calculating the rowspan merging logic and comes from the merge-start-row attribute in WordXML. This indicates the horizontal end column number of the current merged cell, used to identify the end position of the merged area from left to right in the main table. It is the right boundary reference value for calculating the colspan merge logic and comes from the merge-end-col attribute in WordXML. This indicates the starting column number of the current merged cell in the horizontal direction. It is used to identify the starting position of the merged area from left to right in the main table. It is the reference value for calculating the left boundary of the colspan merge logic and comes from the merge-start-col attribute in WordXML.
[0054] In this implementation plan, the degree of structural normalization is evaluated based on the row and column position number of the cell in the main table structure, the row and column merging span, and the difference in adjacent positions. Based on the evaluation results, a structural position expression value is constructed to quantify the structural nesting complexity and belonging clarity of the cells in the table. This supports field grouping identification, structural alignment restoration, and batch data structure consistency judgment. By combining position information and merged structural information, the system reflects the belonging location and structural boundary clarity of the current cell in the two-dimensional structure, thereby serving the structural evaluation needs of field structure extraction and semantic alignment in complex tables.
[0055] Specifically, the steps for reconstructing the logical hierarchy of the table structure based on the intensity assessment results are as follows:
[0056] The system retrieves the structured attribute strength values of all cells within the entire table and sorts them from largest to smallest to form a sequence of structured attribute strength values. This sequence clearly prioritizes the overall structure processing. During the structure reconstruction phase, the cell with the highest structured attribute strength value is processed first, serving as the baseline for rebuilding the structural skeleton. Subsequently, other cells are processed in descending order of structured attribute strength value, ensuring that the reconstruction order aligns with the importance of the structure and preventing low-strength cells from disrupting the overall structural framework.
[0057] During the compression and attribute injection phase, cells with structured attribute strength values greater than or equal to the attribute strength threshold are kept at their original size and not compressed. They are also injected with complete merged boundary attributes to maintain the original appearance and complete boundaries of key structures. For cells with structured attribute strength values lower than the attribute strength threshold, they are scaled proportionally according to their relative position in the sequence. The visual area occupied is compressed by a uniform scaling factor, and only basic coordinate attributes are injected to keep the structural expression simple and avoid weak structures occupying too much display area.
[0058] During the graph rendering stage, the structured attribute intensity value is used as the dominant factor in grayscale mapping, and it is mapped to grayscale pixel brightness values through a normalized linear algorithm. Upper and lower bound controls are introduced during the mapping process: the minimum structured attribute intensity value is mapped to the lowest brightness, and the maximum structured attribute intensity value is mapped to the highest brightness. The remaining cells are distributed proportionally within this linear range, thus forming a continuous and controllable visual gradient. Based on the mapped grayscale pixel brightness values, visual enhancement is performed on the structure graph, making cells with high structured intensity appear brighter and cells with low structured intensity appear softer, thereby highlighting the visual differences in structural levels and facilitating observation, alignment, and analysis.
[0059] like Figure 3 The image shown is a structure-aware grayscale map used in this application to reflect the strength of structured attributes in different fields and record units of a pharmaceutical production data table. The horizontal axis represents the table's field sequence, and the vertical axis represents different records. Each rectangular unit in the image represents a cell, and its structural complexity is indicated by the intensity of its grayscale pixel brightness: darker colors indicate lower structure-aware intensity, and lighter colors indicate higher structure-aware intensity. Each grayscale pixel brightness value is labeled in orange in the corresponding cell for easy identification of its numerical value. The color bars on the right show the distribution range of grayscale pixel brightness values across the entire image, further aiding in understanding the relationship between image brightness and structural features. This rendering method can help identify the distribution pattern of the main structural elements and auxiliary units in the table, providing data support for subsequent HTML structure optimization and style injection.
[0060] In this implementation, the sorting, reconstruction, compression, and visual presentation of the table structure are driven by the strength values of structured attributes, ensuring that the structural hierarchy has a clear primary and secondary relationship and a perceptible visual weight in the rendering result. By introducing strength sorting, priority reconstruction, threshold-based compression, and grayscale linear mapping into the processing flow, this step achieves the enhanced preservation of key structures, the orderly compression of secondary structures, and the visually differentiated expression of the overall rendering. This ensures that the table is not only structurally correct when restored and displayed, but also that the structural hierarchy is immediately apparent. Ultimately, this step ensures that the structural skeleton is stably presented, weak structures do not interfere with the main structure, and cells of different strengths form a natural gradient distribution visually, providing a clear and reliable structural foundation for subsequent field extraction, rendering verification, and structural auditing.
[0061] Specifically, using the results of association analysis and strength assessment as input, the priority assessment of the information importance of cells based on structural cascading relationships and visual salience features is carried out in the following steps: add the association strength value of nested paragraphs to the strength value of structured attributes and divide by two to obtain the basic structural strength value; add the font weight strength value, text emphasis value and color salience strength value, divide by three and add by one to obtain the visual expression weight value; multiply the basic structural strength value and the visual expression weight value to obtain the rearrangement priority value.
[0062] ;
[0063] In the formula, The value representing the strength of nested paragraph association is used to quantify the nesting depth and reference association of the cell in the i-th row and j-th column in the semantic structure of the paragraph. It is a basic indicator for identifying the stability of the hierarchical structure and the consistency of references. This represents the strength value of the structured attribute, used to quantify the span of the merged structure boundary of the cell in the i-th row and j-th column. It is a key parameter for restoring the true boundary range of the cell and supporting accurate coordinate mapping. It represents the font weight intensity value, which is used to quantify the expressive weight of text in terms of stroke thickness in a cell. It is a visual criterion for identifying prominence and title attributes, and is derived from the numerical mapping result of the font weight attribute. The text emphasis value is used to quantify the visual prominence of text in a cell. It is an auxiliary indicator for distinguishing primary and secondary information and identifying key content. It is derived from the combined extraction results of style information, including font size and italic status, in TextInfos. This represents the color saliency intensity value, used to measure the contrast between cell color and background. It serves as a reference factor for building visual perception models and supporting style recognition and classification. It is derived from the distance difference calculation results between font color and background color in the HSV color space in TextInfos.
[0064] In this implementation example, the nested paragraph association strength value of cell 1 is set to 0.72, the structured attribute strength value is 0.65, the font weight strength value is 0.62, the text emphasis strength value is 0.59, and the color salience strength value is 0.66;
[0065] The nested paragraph association strength value of cell 2 is set to 0.68, the structure attribute strength value to 0.70, the font weight strength value to 0.64, the text emphasis strength value to 0.57, and the color salience strength value to 0.63;
[0066] The nested paragraph association strength value of cell 3 is set to 0.75, the structure attribute strength value to 0.72, the font weight strength value to 0.60, the text emphasis strength value to 0.60, and the color salience strength value to 0.65;
[0067] The nested paragraph association strength value of cell 4 is set to 0.81, the structure attribute strength value to 0.78, the font weight strength value to 0.66, the text emphasis strength value to 0.62, and the color salience strength value to 0.67;
[0068] The nested paragraph association strength value of cell 5 is set to 0.69, the structured attribute strength value to 0.68, the font weight strength value to 0.65, the text emphasis strength value to 0.61, and the color salience strength value to 0.64;
[0069] The nested paragraph association strength value of cell 6 is set to 0.77, the structure attribute strength value to 0.75, the font weight strength value to 0.67, the text emphasis strength value to 0.60, and the color salience strength value to 0.68;
[0070] In cell 7, the nested paragraph association strength is set to 0.73, the structure attribute strength to 0.71, the font weight strength to 0.63, the text emphasis strength to 0.58, and the color salience strength to 0.66. The rearrangement priority values for each instance are calculated as shown in Table 1.
[0071] Table 1 Rearrangement Priority Data Table
[0072] Field Cell Nested paragraph association strength value Structured attribute strength value Font weight intensity value Text emphasis intensity Color saliency intensity value Reordering priority Cell 1 0.72 0.65 0.62 0.59 0.66 1.112 Cell 2 0.68 0.7 0.64 0.57 0.63 1.113 Cell 3 0.75 0.72 0.6 0.6 0.65 1.188 Cell 4 0.81 0.78 0.66 0.62 0.67 1.312 Cell 5 0.69 0.68 0.65 0.61 0.64 1.119 Cell 6 0.77 0.75 0.67 0.6 0.68 1.254 Cell 7 0.73 0.71 0.63 0.58 0.66 1.169
[0073] like Figure 4 As shown, this is a line graph of rearrangement priority values provided in this application example. (See Table 1 and...) Figure 4 As can be seen, cell 4 has the highest reorder priority value, indicating that its nested paragraph association strength and structural attribute strength values are significantly higher than other cells. Simultaneously, the distribution of font weight, text emphasis, and color salience indicators is coordinated, reflecting its strongest guiding role in field sorting, display logic, and visual rendering during the current document parsing process. Therefore, it is suitable for priority structural reordering and layout optimization to improve table readability and semantic continuity. Cell 2 has the lowest reorder priority value. Although its structural attribute indicators are high, its font construction, text emphasis, and color salience do not form a concentrated guiding trend, resulting in a weak overall sorting intent. Its priority will be automatically downgraded during table reconstruction, retaining only its basic presentation relationship as a layout auxiliary item to avoid introducing redundant reordering operations and ensure the reasonable allocation of parsing resources and stable execution of layout logic. The reorder priority value line chart intuitively reflects the visual guidance strength and semantic prominence of each field cell in the current table structure. The higher the reorder priority value, the more structurally dominant and necessary it is in the field display order adjustment process, serving as a key reference indicator for field hierarchy optimization and nested display strategy adjustment.
[0074] Specifically, the steps for adjusting cell layout priority based on priority evaluation results are as follows: Based on the reordering priority value calculation results, the rendering and arrangement are performed sequentially according to the reordering priority value of each cell from high to low, with cells with high reordering priority values serving as the core elements of the main arrangement sequence. During the actual arrangement process, if the target position of the current cell is already occupied by a cell with a lower reordering priority value, the sequence yielding rule is immediately triggered, removing the cell with the lower reordering priority value from the current sequence. After the cell with higher priority is inserted, it is then added back into the arrangement process, ensuring that the arrangement order is completely driven by priority values and that no primary or secondary conflicts occur.
[0075] During the performance processing stage, for cells whose font weight value is greater than the standard weight threshold, whose font is italicized, or whose RGB difference between the text foreground color and the cell background color exceeds any of the color value thresholds, the original performance data is retained. This ensures that the visual enhancement information is fully preserved in the rendering process, and that the highlighted fields still have obvious visual guidance capabilities after being arranged.
[0076] When a cell's rearrangement priority is lower than the rearrangement threshold, it is placed in the structure buffer and temporarily excluded from preorder arrangement to prevent low-priority structures from interfering with the main order structure. After all high-priority structures have been processed, the cells in the structure buffer are then padded with blank areas according to a predetermined sequence to maintain the integrity and coherence of the overall structure.
[0077] After the overall layout is completed, the actual rendering position of each cell is compared with its original row and column numbers to determine if there is any positional offset. If a cell is offset and its rearrangement priority value is higher than the average rearrangement priority value of all cells in the same row, a position correction operation is performed to prioritize occupying the empty area in front of the target coordinates to ensure that high-priority structures obtain accurate positions. If the rearrangement priority value of the offset cell is less than or equal to the average rearrangement priority value of the same row, it is filled naturally according to the existing sequence to maintain layout stability.
[0078] In this implementation, rearrangement priority is used as the core sorting criterion. A priority-driven arrangement, yielding, filling, and position correction mechanism ensures that high-priority cells always dominate the structural layout, preventing low-priority cells from interfering with the layout of key structures. During the arrangement process, visual features are preserved through performance-based filtering, ensuring key fields remain salient after rendering. A structural buffer manages low-priority cells, preventing positional conflicts with the main structure. After arrangement, offset detection and position correction ensure high-priority cells obtain accurate coordinates in the final structure, while low-priority cells fill naturally in order, ensuring the integrity and stability of the overall two-dimensional structure. Ultimately, this step guarantees that the rendered HTML table conforms to the rearrangement logic and possesses structural continuity and visual rationality, providing a reliable rendering foundation for subsequent field extraction and structural inspection.
[0079] Specifically, the business process of generating structured records based on the rendered table and connecting them to the manufacturing execution platform involves the following steps: Using an HTML table with a complete two-dimensional structure as the source of structured data, firstly, the row and column numbers attached to each cell are identified. Based on these coordinates, a binding relationship is established between field coordinates and cell content, constructing a raw value extraction table indexed by field positions, ensuring that each piece of structured data has a clear coordinate location. Then, based on the logical row layout in the raw value extraction table, fields within the same row are grouped into structured records according to row order. Finally, data formats conforming to business requirements are generated according to field meaning conversion rules, enabling the records to express the specific parameter meanings in the production batch.
[0080] After generating structured records, template version management is introduced when calling the field mapping template. A version verification mechanism ensures that the template used is consistent with the current data structure. If version mismatch, missing fields, or expired mapping relationships are found during verification, template rollback logic is initiated, automatically switching to the previous available version and recording the reason for rollback for review. If inconsistencies in coordinates occur during field mapping, a coordinate correction process is triggered, restoring the true position by comparing the row and column distribution of surrounding cells. If null values are detected, null value handling strategies are triggered according to the field type, including placeholder filling, default value backfilling, and skipping the write. When the table has page-spanning splits, page-spanning splicing is automatically performed, merging the row and column structures scattered in different segments into a continuous layout to ensure that subsequent field writing is not affected by page breakpoints.
[0081] Finally, after template version verification, error handling, and necessary rollback compensation, the structured records are accurately connected to the corresponding process nodes of the manufacturing execution platform, so that the fields have traceable sources, verifiable transformation links, and verifiable write locations, thereby ensuring the integrity and consistency of data flow.
[0082] This implementation plan reliably converts rendered HTML tables into structured data output suitable for production monitoring and batch record flow, ensuring stability, traceability, and fault tolerance throughout the field mapping process. By identifying cell row and column numbers to establish field coordinate binding relationships, any field has a clear location source within the structure. Logical row combinations generate structured records, enabling table content to be transformed into parameter expressions that meet business requirements. Version verification, error detection, and rollback compensation mechanisms for field mapping templates ensure consistency in mapping relationships despite version changes, missing fields, cross-page distribution, and coordinate anomalies. Null value handling, coordinate correction, and cross-page concatenation ensure that the structured output remains complete, usable, and accurate even in complex scenarios. Ultimately, this step transforms table content from visual rendering into readily accessible structured data, providing a stable data foundation for batch record generation, parameter passing, process tracking, and audit verification.
[0083] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0084] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.
Claims
1. A method for processing pharmaceutical production data tables based on document parsing and HTML rendering, characterized in that: include: S1: Collect table recognition data, location mapping data, and performance data during the table processing process, and preprocess the collected table recognition data, location mapping data, and performance data to construct a standardized table state dataset. The specific steps for collecting table recognition data, location mapping data, and performance data in the table processing process are as follows: Collect table recognition data during the document structure hierarchy division process. The table recognition data includes: row number, column number, number of columns spanned horizontally, number of rows spanned vertically, number of nesting levels, number of rows of nested sub-tables in the cell, and height of nested sub-tables. Collect position mapping data during the table structure construction process. The position mapping data includes: the table sequence number of the cell, the paragraph number of the paragraph to which the table belongs, the section number of the paragraph, the starting and ending row numbers of the merged cell in the vertical direction, and the starting and ending column numbers in the horizontal direction. The performance data collected during the style feature extraction process includes: font weight, font size, font level, italics, underline, text font foreground color, and cell background color in each cell; S2, based on a standardized table state dataset, performs correlation analysis on the structural belonging consistency and semantic association tightness between nested tables and their respective paragraphs, and dynamically adjusts the table's belonging labeling strategy in document paragraphs based on the correlation analysis results. The specific steps for analyzing the structural consistency and semantic relevance between nested tables and their corresponding paragraphs based on a standardized table state dataset are as follows: The complexity of the nested structure is obtained by adding the number of rows of the nested sub-table in the current cell to the height of the nested sub-table and then dividing by the sum of the number of columns spanned horizontally and one. Add one to the nesting level of the cell to the left of the current cell, and multiply this by the nesting structure complexity to obtain the hierarchical structure correction value; The section attribution reliability ratio is obtained by adding one to the paragraph number of the current table and dividing it by the sum of the section number of the current section and one. Add the hierarchical structure correction value to the segment affiliation confidence ratio to obtain the nested paragraph association strength value of the current cell; S3, based on a standardized table state dataset, assesses the strength of cell structure by determining the row and column location of cells in the main table structure, and reconstructs the logical hierarchy of the table structure based on the strength assessment results. The specific steps for assessing the structural strength of cells based on their row and column locations within the main table structure, using a standardized table state dataset, are as follows: Divide the sum of the cell row number and column number by the sum of the number of rows spanned vertically and the number of columns spanned horizontally, and one, to obtain the normalized positional representation value; The text structure complexity is obtained by incrementing the table number of the cell by one and taking the natural logarithm. Subtract the starting row number from the ending row number of the merged cell in the vertical direction and add one to get the row-to-row merge span. Subtract the starting column number from the ending column number of the merged cell in the horizontal direction and add one to get the column-to-row merge span. Add the row-to-row merge span and the column-to-row merge span and divide by two to get the merge structure complexity. The structured attribute strength value is obtained by multiplying the text structure complexity by the merged structure complexity and then adding it to the normalized positional representation value. S4 takes the results of association analysis and intensity assessment as input, prioritizes the information importance of cells based on structural cascade relationships and visual salient features, and adjusts the layout priority of cells based on the priority assessment results; S5 generates structured records based on the rendered tables and connects them to the business processes of the manufacturing execution platform.
2. The method for processing pharmaceutical production data tables based on document parsing and HTML rendering according to claim 1, characterized in that: The specific steps for preprocessing the collected table recognition data, location mapping data, and performance data to construct a standardized table state dataset are as follows: For table-based data recognition, the row and column numbers of each cell are standardized to integers and sorted in order. At the same time, the number of horizontal columns and vertical rows is normalized to positive integers. The nesting relationship is represented by a unified hierarchical identifier based on the number of nesting levels. The number of rows and height of nested sub-tables are compressed to a fixed scale range by linear stretching. For the location mapping data, the table sequence number, paragraph number and section number are encoded and verified to eliminate duplicate and missing numbers and unify the format to comparable integer values. The starting and ending row numbers of merged cells, as well as the starting and ending column numbers in the horizontal direction, are checked for range validity. If there are cases where the starting and ending numbers are equal, they are retained as the cell body. For expressive data, font thickness information is standardized into a numerical expression through a mapping function to obtain the visual line thickness of the text, denoted as the font thickness intensity value. Font size, font level, italic status, and underline status are input into a weighted superposition model. A multi-dimensional feature attention fusion mechanism is used to dynamically allocate contribution weights, and a sparse constraint-based saliency projection algorithm is used to extract the most discriminative visual combination expression. The fused visual combination expression result is linearly embedded and reconstructed through generalized weighted transformation, finally outputting the text emphasis value. The RGB color values of the foreground color and background color of the text font in the cell are extracted through a style parsing algorithm and converted into color components in the HSV color space. The Euclidean distance between the foreground color component of the text font and the background color component of the cell is calculated as a numerical expression of color contrast intensity, denoted as the color saliency intensity value. The standardized table recognition data, location mapping data, and performance data are normalized to construct a standardized table state dataset.
3. The method for processing pharmaceutical production data tables based on document parsing and HTML rendering according to claim 1, characterized in that: The specific steps of the strategy for dynamically adjusting the attribution markers of tables in document paragraphs based on the results of association analysis are as follows: The system compares the nested paragraph association strength value of the current cell with the association strength threshold in real time. The association strength threshold includes a first strength threshold and a second strength threshold, where the first strength threshold is higher than the second strength threshold. When the nested paragraph association strength value is greater than the first strength threshold, the current cell is marked as a structural anchor point, and the structured meta-information of the current cell is injected into the HTML rendering; When the nested paragraph association strength value is greater than the second strength threshold and less than or equal to the first strength threshold, record the paragraph number and structural path corresponding to the current cell, generate a unique anchor field to mark the cell position, and provide field mapping reference when interfacing with LIMS and MES systems; When the nested paragraph association strength value is less than the second strength threshold, an uncertain position structure warning message is generated. During rendering, an additional structure confirmation prompt message is added, and the table sequence number, paragraph number and nesting level of the cell are marked. At the same time, the table recognition data of the adjacent cells of the current cell are traced back, and the paragraph belonging of the current cell is obtained based on the spatial adjacency relationship and the table header context. The nested paragraph association strength values of each cell in the entire table are averaged to obtain the average value of nested paragraph association strength. If the average value of nested paragraph association strength is higher than the first strength threshold, the entire table adopts the nesting priority rendering template to strengthen the independent presentation of sub-tables; if the average value of nested paragraph association strength is greater than the second strength threshold and less than or equal to the first strength threshold, a hybrid structure rendering template is adopted to balance the stability between the master-detail structure and the field layout. If the average strength value of nested paragraph associations is less than the second strength threshold, the table will retain the original image rendering.
4. The method for processing pharmaceutical production data tables based on document parsing and HTML rendering according to claim 1, characterized in that: The specific steps for reconstructing the logical hierarchy of the table structure based on the intensity assessment results are as follows: Get the structured attribute strength values of all cells, sort all cells in descending order of structured attribute strength values, and construct a sequence of structured attribute strength values; During the structure restoration phase, the cells with the maximum structure attribute strength value are processed first, and then the subsequent cells are processed in descending order of structure attribute strength value. During the compression and attribute injection phase, cells with structured attribute strength values greater than or equal to the attribute strength threshold are not compressed and are injected with complete merge boundary attributes. Cells with structured attribute strength values less than the attribute strength threshold are scaled proportionally and only basic coordinate attributes are injected. During the image rendering stage, the structured attribute intensity values are mapped to grayscale pixel brightness values using a normalized linear algorithm, and visual image enhancement is performed based on the grayscale pixel brightness values.
5. The method for processing pharmaceutical production data tables based on document parsing and HTML rendering according to claim 1, characterized in that: The specific steps for prioritizing the information importance of cells based on structural cascading relationships and visual salient features, using association analysis results and strength assessment results as input, are as follows: Add the nested paragraph association strength value to the structured attribute strength value and then divide by two to obtain the basic structure-level strength value; The sum of the font weight intensity value, text emphasis value, and color salience intensity value is divided by three and then added to one to obtain the visual expression weight value. Multiply the structural-level basic strength value by the visual expression weight value to obtain the rearrangement priority value.
6. The method for processing pharmaceutical production data tables based on document parsing and HTML rendering according to claim 1, characterized in that: The specific steps for adjusting the layout priority of cells based on the priority evaluation results are as follows: Based on the rearrangement priority value calculation results, the cells are rendered and arranged in descending order of their respective rearrangement priority values. In the actual layout process, if the target position of the current cell is occupied by a cell with a lower rearrangement priority value, the cell with the lower rearrangement priority value will be removed from the rearrangement sequence and added back to the layout process after the current cell has been inserted. For cells that meet any of the following criteria: font weight value greater than the standard weight threshold, font italics marked as italics, or the difference between the RGB color values of the text font foreground color and the cell background color exceeds the color value threshold, retain the cell's performance data. If a cell's rearrangement priority is lower than its rearrangement threshold, it is placed in the structure buffer. After rendering and arranging, the position of each cell in the actual rendering result is compared with the row and column numbers of the original cells to determine if there is a positional offset. If the rearrangement priority value of a cell with a positional offset is greater than the average rearrangement priority value of all cells in the same row, the position correction operation is performed first, and the cell is rendered again in the empty area before the target coordinates. If the rearrangement priority value of a cell with a positional offset is less than or equal to the average rearrangement priority value of all cells in the same row, it is filled in the original sequence, and finally an HTML table with a complete two-dimensional structure is generated.
7. The method for processing pharmaceutical production data tables based on document parsing and HTML rendering according to claim 1, characterized in that: The specific steps of the business process of generating structured records based on the rendered table and connecting them to the manufacturing execution platform are as follows: Using an HTML table with a complete two-dimensional structure as the source of structured data, the row and column numbers attached to each cell are identified, and a mapping relationship between field coordinates and cell content is established based on the row and column numbers to form a raw value extraction table indexed by field position. Extract the logical row structure from the table based on the original values, combine the fields in the same row into structured records, and generate a data format for business systems based on the field meaning conversion rules; After generating the structured record, the field mapping template is called to finally connect the structured record to the relevant business process node in the enterprise-level manufacturing execution platform.
Citation Information
Patent Citations
Data collection and summary methods for custom tables
CN103955497B
A data extraction and organization method for unstructured tabular documents in a big data environment
CN105630916B
Systems and methods of identifying chunks within multiple documents
CA2716345A1
Table analysis method and device, computer equipment and storage medium
CN114581931A