Campus per-capita recipe disassembling and accounting method and system
By processing the data of the campus menu system, unified association and hierarchical accounting of menu execution data were achieved, solving the problems of authenticity and consistency of accounting results and improving the accuracy and traceability of campus menu accounting.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUNAN ANZHI NETWORK TECH CO LTD
- Filing Date
- 2026-05-12
- Publication Date
- 2026-06-09
AI Technical Summary
The existing campus menu system lacks a unified association and hierarchical accounting mechanism for different weight semantics, different collection stages and different execution records, which makes it difficult to guarantee the authenticity and consistency of the accounting results.
By acquiring the execution data of recipes with volume, we perform timeline relocation, field unification, weight semantic labeling and normalization, construct the penetration relationship of recipes, generate an ingredient expansion dataset, identify the start and end points of accounting, generate ingredient nutritional contribution vectors, perform link consistency recursion verification, identify abnormal link states, and generate accounting behavior labels.
It has enabled the seamless processing of campus-wide quantitative recipe execution data, improved the accuracy of data correspondence, avoided confusion in accounting standards, and enhanced the credibility and traceability of accounting results.
Smart Images

Figure CN122173576A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, specifically to a method and system for breaking down and calculating campus-based menus. Background Technology
[0002] With the development of campus food safety supervision, nutrition and health management, and the digitalization of canteens, schools have placed higher demands on recipe publishing, nutritional calculation, execution verification, and full-process traceability. While existing systems can support functions such as recipe management, ingredient nutrition calculation, product acceptance, inventory management, and inbound / outbound records, most still operate at the dish name level or coarse-grained ingredient level. They lack a unified association and hierarchical accounting mechanism for different weight semantics, different data collection stages, and different execution records, making it difficult to guarantee the authenticity and consistency of the final accounting results.
[0003] For example, invention patent CN108681826B discloses a school cafeteria food safety management information system based on modern information technology, including: a hardware system and a software system; the hardware system includes video recording equipment, temperature and humidity measuring equipment, pesticide residue measuring equipment, bacterial residue measuring equipment, SMS communication equipment, client machines, smart terminals, and servers; the software system includes six parts: a system database, a data access layer, a system component library, a data interface, a World Wide Web server, and a wireless application protocol server. This system can guarantee its own security and stability, and has functions such as access control, identity authentication, log recording, and encrypted storage of important information; it has the advantages of simplicity, flexibility, scalability, and ease of operation, maintenance management, and functional expansion.
[0004] For example, invention patent CN113496427B discloses a method, device, electronic device, and storage medium for determining the portion size of a recipe. This includes: determining a portion size determination method based on the type of each ingredient in the recipe; determining corresponding determination parameters based on the portion size determination method; and calculating the determination parameters of the recipe based on the portion size determination method to determine the single-person portion size of the recipe; wherein the single-person portion size represents the recommended number of diners for the recipe. This invention, by determining the type of each ingredient in the recipe, identifying the corresponding portion size determination method based on the ingredient type, and calculating the single-person portion size of the recipe using this method, allows users to choose different nutritious recipes based on the number of diners, achieving more precise nutritional meal planning.
[0005] In the existing technology, the existing system lacks a structured distinction between net material, raw material, edible portion and cooking changes in the quantity data, which leads to inconsistent physical meanings of the same weight field in different stages. The quantity in the recipe may look like a weight value, but in the real scenario of a school kitchen, this value may be the gross weight of the purchase, the weight of the acceptance weighing, the net material after washing and peeling, the weight of the edible portion after cutting and preparation, or even the reference amount of the finished product after cooking.
[0006] Therefore, in order to address the above issues, there is an urgent need for a method and system for breaking down and calculating campus menus. Summary of the Invention
[0007] To address the shortcomings of existing technologies, this invention provides a method and system for breaking down and calculating campus-based recipes, which solves the problems of inconsistent data definitions, disconnected data links, mixed use of weight semantics, and difficulty in backtracking calculation results.
[0008] To achieve the above objectives, the present invention provides the following technical solution: a method for campus-based recipe breakdown and accounting, comprising: S1, acquiring recipe execution data and performing time axis relocation, field unification, weight semantic labeling, and normalization on the recipe execution data; S2, constructing a recipe penetration relationship based on the recipe execution data, evaluating the convergence of weight semantic mapping, and generating an ingredient expansion dataset; S3, identifying the accounting start point and accounting end point based on the ingredient expansion dataset, generating ingredient nutritional contribution vectors, and constructing a dish accounting dataset; S4, evaluating the consistency recursion verification between the current accounting link and the execution link based on the dish accounting dataset, identifying abnormal link states, and generating accounting behavior labels.
[0009] Furthermore, the specific process of acquiring the quantity-based recipe execution data and performing timeline relocation, field unification, weight semantic labeling, and normalization on the quantity-based recipe execution data is as follows: The entire process of executing the quantity-based recipes on campus is collected to obtain the quantity-based recipe execution data, which includes recipe date, meal type identifier, dish identifier, ingredient identifier, ingredient quantity, acceptance weight, inbound weight, inventory weight, outbound weight, batch identifier, collection time identifier, and collection source identifier. A constraint optimization strategy based on minimum error matching is adopted, and the optimal alignment is solved through sliding window matching and dynamic programming to relocate the timeline of the quantity-based recipe execution data. A unified mapping method based on field integrity constraints is used to unify the dish, ingredient, weight, batch, and time fields in records from different sources. A sliding smoothing method based on weight change rate constraints is used to dynamically denoise the product acceptance weighing value, inventory fluctuation value, and outbound deduction value. A semantic recognition method based on the data collection stage and field source is used to perform weight semantic labeling on each weight field, marking it as raw material quantity, net material quantity, edible quantity, or cooked equivalent quantity. A hierarchical normalization processing method based on field category is used to perform normalization processing on the weight field, quantity field, and related statistical fields after semantic labeling.
[0010] Furthermore, the specific process of constructing the recipe penetration relationship based on the quantity-based recipe execution data is as follows: Based on the quantity-based recipe execution data, extract the dish identifier, meal type identifier, and ingredient quantity fields from the recipe record, and call the structured recipe record of the corresponding dish to generate a dish-level ingredient composition sequence; at the same time, extract the corresponding weight records of the same ingredient in the acceptance record, warehousing record, inventory record, and outbound record, and establish an ingredient-level candidate weight set according to the time association and batch association; by reading the weight semantic field of the ingredient in the structured recipe record of the dish, number mapping is performed according to the weight semantic enumeration coding rules, and the enumeration values 1, 2, 3, and 4 correspond to the raw material quantity, net material quantity, edible quantity, and cooked quantity, respectively. The equivalent quantity is used to obtain the weight semantic category number of the ingredient in the recipe record. By reading the collection link identifier, field source identifier, and weight field type in the collection record corresponding to the ingredient, and determining its current weight semantic type based on the weight semantic recognition rule, the weight semantic enumeration encoding rule is used to perform encoding mapping to obtain the weight semantic category number of the ingredient in the collection record. For each ingredient in the dish-level ingredient composition sequence, the corresponding records of raw material quantity, net material quantity, edible quantity, and cooked equivalent quantity are read respectively. Then, semantic mapping is performed based on the unified caliber conversion rule so that each ingredient is converted to the current accounting target caliber. After completing the semantic mapping, structured binding is performed to generate the ingredient unfolded dataset.
[0011] Further, the specific process for evaluating the convergence of weight semantic mapping is as follows: Divide the raw material quantity by the sum of the net material quantity and the zero-prevention constant, add a constant term of 1, and take the natural logarithm to obtain the weight conversion characterization value of the food in the pre-processing stage; take the absolute value of the difference between the edible quantity and the cooked equivalent quantity, and divide it by the sum of the cooked equivalent quantity and the zero-prevention constant to obtain the relative deviation value in the post-processing stage; then take the negative of the relative deviation value and perform an exponential transformation to obtain the weight processing characterization value of the food in the post-processing stage; obtain the semantic distance value based on the weight semantic category number in the recipe record and the weight semantic category number in the collection record; the distance between the same semantic category is 0, and the distance between different semantic categories is uniformly set to 1; add 1 to the semantic distance value to obtain the semantic difference suppression term; multiply the weight conversion characterization value and the weight processing characterization value, and then divide by the semantic difference suppression term to obtain the weight semantic mapping convergence value.
[0012] Furthermore, the specific process for generating the food ingredient unfolding dataset is as follows: The convergence value of the weight semantic mapping and the weight semantic mapping threshold are compared in real time. When the convergence value is less than the threshold, it is determined that the current food ingredient still has a risk of semantic misuse. The current food ingredient is paused from entering the unified accounting process, and the candidate weight records of the same batch are called back to re-execute the semantic mapping evaluation. Simultaneously, the number of backtracking attempts is recorded. If the number of backtracking attempts does not reach the maximum backtracking attempt threshold, the candidate weight records are called back. If the maximum backtracking attempt threshold has been reached and convergence is still not achieved, the backtracking is terminated, the current food ingredient is marked as having a semantic mapping anomaly, and the default weight from the current candidate weight record is used to enter the unified accounting process. When the convergence value of the weight semantic mapping is greater than or equal to the weight semantic mapping threshold, it is determined that the current food ingredient has completed semantic mapping. The current unified weight is recorded, and the food ingredient unfolding dataset is constructed starting from the current food ingredient.
[0013] Furthermore, based on the ingredient unfolding dataset, the specific process for identifying the accounting start and end points is as follows: Based on the ingredient unfolding dataset, extract all ingredient unfolding records for the same dish under the same meal category; group and sort the ingredient unfolding records according to the recipe date, meal category identifier, dish identifier, and correction time identifier, and construct weight change sequence, source switching sequence, and batch switching sequence; analyze the weight change sequence, source switching sequence, and batch switching sequence using a mutation identification method based on local change trend detection and continuous state confirmation to identify weight change trend mutation points, source mutation points, and batch mutation points; merge the identified mutation points by time, and take the earliest mutation point corresponding to the time as the candidate accounting start point; extract the ingredient unfolding records within the continuous fixed record window starting from the candidate accounting start point, and calculate the consistency ratio of weight semantic category, the continuity ratio of source identifier, and the batch association stability ratio respectively using a method based on window dominant category statistics; if the consistency ratio of weight semantic category, the continuity ratio of source identifier, and the batch association stability ratio of the three indicators are all greater than or equal to the corresponding starting point within the current continuous fixed record window... If a threshold is reached, the current candidate point is confirmed as a valid starting point for accounting, and the food ingredient expansion records after the starting point are extracted as candidate accounting segments. Starting from the valid accounting starting point, a sliding window analysis is performed on the food ingredient expansion records in the candidate accounting segments, and the accounting end position is determined based on the degree of weight change, source switching frequency, and batch switching frequency within the window. The absolute value of the uniform weight difference between adjacent records within the current sliding record window is calculated, and the average value is obtained to obtain the weight change index. The number of times the source identifier changes between adjacent records within the current sliding record window is calculated to obtain the source switching index. The number of times the batch identifier changes between adjacent records within the current sliding record window is calculated to obtain the batch switching index. When the weight change index, source switching index, and batch switching index are all lower than the corresponding lower limit threshold, the current sliding record window is determined to have entered the convergence zone. If N consecutive sliding record windows enter the convergence zone, the recording time corresponding to the starting position of the first stable window is determined as the accounting end point. If the current sliding record window does not enter the convergence zone, the analysis window continues to slide forward and the stability determination is repeated until the accounting end point is identified.
[0014] Further, the specific process of generating ingredient nutritional contribution vectors and constructing a dish accounting dataset is as follows: Extract the ingredient expansion records between the effective accounting start point and the accounting end point as the target accounting segment; for each ingredient expansion record within the target accounting segment, extract the unified weight, ingredient identifier, weight semantic category, source identifier, and batch association identifier, and call the ingredient nutritional element record corresponding to the ingredient identifier to obtain the nutritional element baseline vector per unit weight; through a homogeneous merging method based on ingredient identifier, source identifier, and batch association identifier, merge and filter ingredient expansion records within the target accounting segment that have duplicate sources, duplicate batches, or overlapping times. For records with identical ingredient identifier, source identifier, and batch association identifier, if multiple records exist, the latest record based on the collection time identifier is taken as the valid record. For records with the same ingredient identifier but different source identifier or batch association identifier, and whose recording time intervals overlap, the arithmetic mean of the uniform weight is taken as the merged weight, and the remaining field information of any one of the records is retained, retaining the valid ingredient records participating in the current accounting segment. For the merged valid ingredient records, the uniform weight under the target nutritional caliber is vector-mapped with the corresponding nutritional element benchmark vector to generate the ingredient nutritional contribution vector, and the dish accounting dataset is constructed.
[0015] Furthermore, based on the dish accounting dataset, the specific process for evaluating the consistency recursive verification between the current accounting link and the execution link is as follows: Based on the dish accounting dataset, the number of successfully connected link fields is obtained by matching and statistically analyzing the associated fields in the recipe record, dish formula record, ingredient expansion record, acceptance and warehousing record, inventory record, and outbound record at the current processing time. Associated fields may include one or more of the following: dish identifier, ingredient identifier, meal type identifier, recipe date, batch identifier, source identifier, and time identifier. When a field can be effectively mapped between link levels, it is recorded as a successfully connected field. After performing missing detection, misalignment detection, and mapping failure detection on the associated fields in each link level at the current processing time, the number of broken link fields is statistically analyzed. This is then compared with the ingredient expansion dataset corresponding to the current processing time. After performing unified-caliber decomposition and theoretical calculation, the theoretical expansion result value is obtained. The receiving record, inventory change record, and outbound execution record corresponding to the current processing time are read and extracted according to the same field structure as the theoretical expansion result value to obtain the execution record result value. The link consistency recursive verification value of the previous processing time is multiplied by the consistency inheritance coefficient to obtain the inheritance item. The number of successfully connected link fields at the current processing time is divided by the sum of the constant item 1 and the number of broken link fields, and then 1 is added and the natural logarithm is taken to obtain the enhancement item. The absolute value of the difference between the theoretical expansion result value and the execution record result value at the current processing time is calculated, and the absolute value of the difference is multiplied by the execution deviation suppression coefficient to obtain the deviation item. The inheritance item and the enhancement item are added together and then the deviation item is subtracted to obtain the recursive value. The hyperbolic tangent transformation is performed on the recursive value to obtain the link consistency recursive verification value.
[0016] Furthermore, the specific process for identifying link anomalies and generating accounting behavior labels is as follows: The link consistency recursive verification value is compared with the link consistency threshold. When the link consistency recursive verification value is greater than or equal to the link consistency threshold, the current accounting link is determined to be consistent with the execution link, and the current accounting result is a valid accounting result. When the link consistency recursive verification value is less than the link consistency threshold, the process enters the local anomaly analysis stage, where feature threshold judgments are performed on link continuity items, link breakage items, and execution deviation items. The identified link status is structurally bound to the current dish identifier, meal identifier, recipe date, and processing time information to generate accounting behavior labels. Simultaneously, a review flag is set for dishes or meals identified as abnormal, and the corresponding abnormal status is marked.
[0017] Furthermore, a second aspect of the present invention provides a campus-based recipe breakdown and accounting system, applied to a campus-based recipe breakdown and accounting method, comprising: a data acquisition and calibration module, used to acquire recipe execution data and perform time axis relocation, field unification, weight semantic labeling, and normalization processing on the recipe execution data; a weight semantic conversion module, used to construct a recipe penetration relationship based on the recipe execution data, evaluate the convergence of the weight semantic mapping, and generate an ingredient expansion dataset; a breakdown and accounting module, used to identify the accounting start point and accounting end point based on the ingredient expansion dataset, generate ingredient nutritional contribution vectors, and construct a dish accounting dataset; and an execution verification module, used to evaluate the consistency recursion verification between the current accounting link and the execution link based on the dish accounting dataset, identify abnormal link states, and generate accounting behavior labels.
[0018] Beneficial effects
[0019] The present invention has the following beneficial effects:
[0020] (1) This invention, by constructing a unified association link between recipe records, formula records, acceptance and warehousing records, inventory records, and outbound records, realizes the whole-process integrated processing of campus-based bulk recipe execution data, improves the correspondence accuracy between multi-source data, and avoids the accounting chain break problem caused by the isolated existence of data in different links. It realizes the semantic distinction and unified mapping of weight fields in different collection links, avoiding the accounting caliber confusion caused by the mixed use of a single gram weight field in the existing system.
[0021] (2) This invention improves the standardization and computability of the original execution data by relocating the execution timeline of the food ingredient expansion record, unifying fields, dynamically denoising, semantically labeling, and normalizing the data. This reduces the interference of acceptance delays, warehousing delays, duplicate writes, and short-term fluctuations on the subsequent accounting process. By constructing a weight semantic mapping convergence value, the food ingredient items are jointly evaluated in terms of pre-processing weight conversion, post-processing weight conversion, and semantic category matching. This achieves effective food ingredient screening under a unified accounting standard and improves the reliability of the weight semantic conversion process.
[0022] (3) This invention, through an accounting segment extraction mechanism based on candidate accounting start point identification, valid accounting start point confirmation, and accounting end point determination, realizes the automatic extraction of valid accounting intervals from the food ingredient expansion records, avoiding the problem of directly introducing invalid disturbance records, source switching records, or batch mixed records into the accounting process. By constructing food ingredient nutritional contribution vectors, dish nutritional contribution vectors, meal-level accounting data, and period-level accounting data, a hierarchical progressive accounting from the food ingredient layer to the dish layer and from the meal-level layer to the period layer is realized, improving the data organization and result expression capabilities of campus menu nutritional analysis.
[0023] (4) This invention introduces a link consistency recursive verification mechanism to continuously compare and recursively verify the theoretical expansion results and the execution record results, thereby realizing the synchronous identification of the integrity of the accounting link and the execution deviation, improving the credibility of the accounting results and the ability to detect anomalies, and enhancing the traceability and review convenience of the campus quantity-based recipe decomposition accounting results.
[0024] 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
[0025] Figure 1 This is a flowchart of a campus-based quantitative menu breakdown and accounting method according to the present invention;
[0026] Figure 2 This is a diagram illustrating the architecture of a campus-based quantitative recipe breakdown and accounting system according to the present invention.
[0027] Figure 3 This is a semantic evolution trend diagram of the ingredient weight of the present invention;
[0028] Figure 4 Thermographic diagram showing the nutritional contribution of the ingredients in this invention;
[0029] Figure 5 This is a graph showing the change in the link consistency recursive verification value of the present invention. Detailed Implementation
[0030] To enable those skilled in the art to better understand the technical solution, the present invention will be described in detail below with reference to embodiments. The description in this part is only exemplary and explanatory, and should not be used to limit the scope of protection of the present invention in any way.
[0031] Please see Figures 1-5 This invention provides a technical solution: a method for breaking down and calculating a campus recipe, comprising: S1, acquiring recipe execution data and performing time axis relocation, field unification, weight semantic labeling, and normalization on the recipe execution data; S2, constructing a recipe penetration relationship based on the recipe execution data, evaluating the convergence of weight semantic mapping, and generating an ingredient expansion dataset; S3, identifying the calculation start point and calculation end point based on the ingredient expansion dataset, generating ingredient nutritional contribution vectors, and constructing a dish calculation dataset; S4, evaluating the consistency recursion verification between the current calculation link and the execution link based on the dish calculation dataset, identifying abnormal link states, and generating calculation behavior labels.
[0032] Specifically, the process of acquiring the execution data of the recipe with volume, and performing timeline relocation, field unification, weight semantic labeling, and normalization on the execution data of the recipe with volume is as follows:
[0033] The entire process of implementing the campus-wide standardized menu involves data collection, including menu release time, meal type switching time, dish configuration behavior, ingredient composition relationships, ingredient quantity fields, product acceptance and weighing behavior, inbound changes, inventory changes, outbound deductions, batch switching behavior, and differences in data sources. Data sources include the menu release system, structured recipe library, canteen acceptance terminal, inventory management system, outbound record module, and batch management module. The collection method is real-time collection triggered by each operation event, supplemented by daily scheduled full synchronization to ensure data integrity and timeliness. The standardized menu execution data includes menu date, meal type identifier, dish identifier, ingredient identifier, ingredient quantity, acceptance weight, inbound weight, inventory weight, outbound weight, batch identifier, collection time identifier, and collection source identifier.
[0034] A constraint optimization strategy based on minimum error matching is adopted, and optimal alignment is solved by sliding window matching and dynamic programming to reposition the time axis of the recipe execution data and correct the time sequence drift caused by delayed acceptance, delayed warehousing, or supplementary entry for outbound. A unified mapping method based on field integrity constraints is used to unify the dish field, ingredient field, weight field, batch field, and time field in records from different sources. A sliding smoothing method based on weight change rate limit is used, where the sliding window length is set to 5 consecutive valid collection points and the weight change rate limit threshold is set to the absolute value of the weight change rate between two consecutive times not exceeding 30%, to dynamically denoise the product acceptance weighing value, inventory fluctuation value, and outbound deduction value, filtering out abnormal spikes caused by short-term jitter and repeated writing. A semantic recognition method based on collection link and field source is used to perform weight semantic labeling on each weight field, which is marked as raw material quantity, net material quantity, edible quantity, or cooked equivalent quantity, respectively. A hierarchical normalization processing method based on field category is used to perform normalization processing on the weight field, quantity field, and related statistical field after semantic labeling. Specifically, the weight field is scaled according to the historical valid value range under the corresponding weight semantic category, the count field is scaled according to the baseline value, and the discrete identifier field is numerically unified according to the number mapping method. This eliminates the differences in the units, ranges and expressions of data from different sources and realizes the standardized processing of recipe execution data with quantity.
[0035] In this implementation plan, by distinguishing the weight fields generated at different stages into raw material quantity, net material quantity, edible quantity, and cooked equivalent quantity, the accuracy of weight semantic conversion, unified definition breakdown, and nutritional contribution accounting is enhanced. This makes the correspondence between the quantity-based recipe accounting results and the actual execution process clearer, more stable, and traceable, thereby improving the system's ability to standardize the processing of campus quantity-based recipe execution data, its ability to connect links, and its ability to support subsequent accounting.
[0036] Specifically, the process of constructing the penetration relationship of dish recipes based on the execution data of the recipes with volume is as follows:
[0037] Based on the execution data of the recipes with volume, the dish identifier, meal type identifier, and ingredient volume fields are extracted from the recipe records. The corresponding structured recipe record is then called. This structured recipe record contains at least the following fields: dish identifier, ingredient identifier, weight semantic category, raw material quantity, net material quantity, edible quantity, and cooked equivalent quantity, as well as the key coefficients required for conversion: washing and peeling loss rate, edible rate, and cooking coefficient. The washing and peeling loss rate ranges from [0,1), the edible rate ranges from (0,1), and the cooking coefficient ranges from (0,2). A dish-level ingredient composition sequence is generated. Simultaneously, the corresponding weight records of the same ingredient in the acceptance record, warehousing record, inventory record, and outbound record are extracted. The system records ingredients and establishes a candidate weight set at the ingredient level based on time and batch relationships. By reading the weight semantic field of the ingredient in the structured recipe record, the system maps the weights according to the weight semantic enumeration coding rules. The enumeration values 1, 2, 3, and 4 correspond to the raw material quantity, net material quantity, edible quantity, and cooked equivalent quantity, respectively, to obtain the weight semantic category number of the ingredient in the recipe record. By reading the collection link identifier, field source identifier, and weight field type in the corresponding collection record of the ingredient, and determining its current weight semantic type based on the weight semantic recognition rules, the system then maps the weights according to the same weight semantic enumeration coding rules as the recipe record to obtain the weight semantic category number of the ingredient in the collection record.
[0038] For each ingredient in the dish-level ingredient composition sequence, the corresponding records of raw weight, net weight, edible weight, and cooked equivalent weight are read. If the weight semantics in the recipe record are inconsistent with the collected semantics in the candidate weight set, semantic mapping is performed based on the unified caliber conversion rule. Let the target caliber be T and the source caliber be S. The conversion formula is target weight = source weight × conversion coefficient, where the conversion coefficient is determined according to the path S→T, specifically: raw weight → net weight coefficient = 1 - washing and peeling loss rate, net weight → edible weight coefficient = edible rate, edible weight → cooked equivalent weight coefficient = cooking coefficient; the composite path coefficient is the product of the coefficients at each step. All conversion coefficients are preferentially read directly from the corresponding fields in the current dish's structured recipe record; if a coefficient is missing in the recipe record, the default coefficient in the ingredient standard parameter library is called to convert each ingredient to the current calculation target caliber; after completing the semantic mapping, the dish identifier, ingredient identifier, unified caliber weight, weight semantic category, source identifier, and batch association identifier are structurally bound to generate an ingredient expanded dataset.
[0039] In this implementation plan, by generating ingredient expansion datasets through unified caliber conversion and structured binding, the consistency of the data foundation for nutritional contribution calculation, dish-level accounting, and execution link traceability is improved. This makes the recipe decomposition process clearer, the weight mapping process more accurate, and the accounting object organization more standardized, thereby enhancing the stability and reusability of the system for quantity-based recipe penetration, weight unification, and data expansion processing.
[0040] Specifically, the process for evaluating the convergence of the weight semantic mapping is as follows:
[0041] Divide the raw material quantity by the sum of the net material quantity and the zero-prevention constant, add a constant term of 1, and take the natural logarithm to obtain the weight conversion representation value of the food in the pre-processing stage. If the net material quantity is 0 or missing, skip the current record, do not participate in the representation value calculation, and mark it as an outlier. Then, take the absolute value of the difference between the edible quantity and the cooked equivalent quantity, divide it by the sum of the cooked equivalent quantity and the zero-prevention constant, to obtain the relative deviation value in the post-processing stage. Then, take the negative of the relative deviation value and perform an exponential transformation. This exponential transformation maps the relative deviation value to the (0,1) interval. The smaller the deviation, the closer the exponential value is to the next value. The index value is 1, and the larger the deviation, the closer the index value is to 0. It is used to characterize the consistency of weight in the post-processing stage and obtain the weight processing characterization value of the ingredients in the post-processing stage. According to the weight semantic category number in the recipe record and the weight semantic category number in the collection record, the semantic distance value is obtained. The distance between the same semantic category is 0, and the distance between different semantic categories is uniformly set to 1. The semantic distance value is added to 1 to obtain the semantic difference suppression term. The weight transformation characterization value is multiplied by the weight processing characterization value and then divided by the semantic difference suppression term to obtain the weight semantic mapping convergence value.
[0042] The specific formula for calculating the convergence value of the weight semantic mapping is as follows:
[0043] ;
[0044] In the formula, Indicates the first The convergence value of the semantic mapping of the weight of each ingredient is used to characterize the degree of semantic transformation consistency between the current ingredient's raw material quantity, net material quantity, edible quantity and cooked equivalent quantity, as well as the degree of matching between the recipe semantics and the collection semantics. Indicates the first The raw material quantity of an ingredient is used to characterize the initial weight of the ingredient during the procurement, distribution, or initial input stages. Indicates the first The net weight of an ingredient is used to characterize the net weight of the ingredient that can enter the subsequent circulation stage after acceptance and warehousing or completion of preliminary processing. Indicates the first The edible amount of an ingredient is used to characterize the actual weight of the ingredient that can be used in nutritional accounting after peeling, cutting, and removing inedible parts. Indicates the first The equivalent cooked quantity of an ingredient is used to characterize the equivalent weight of the ingredient after steaming, boiling, stir-frying, stewing, or other cooking processes, converted to the target accounting caliber. Indicates the first The weight semantic category number of each ingredient in the recipe record is used to characterize the target weight semantic type assigned to the ingredient during the recipe definition stage. Indicates the first The weight semantic category number of each ingredient in the collection record is used to characterize the current weight semantic type of the ingredient identified during the actual collection phase; represents the zero-prevention constant, which is obtained by adaptively generating the smallest non-zero value based on the current weight values of the four categories of ingredients. The value range is 10−6 to 10−4, which is used to avoid numerical divergence caused by zero or too small a denominator; i represents the current ingredient sequence number participating in the weight semantic mapping calculation. It is obtained by expanding the records of ingredients of the same dish under the same meal category, grouping and sorting them according to the recipe date, meal category identifier, dish identifier and correction time identifier, and then numbering them in the order of the records. It is used to establish a one-to-one correspondence between the same ingredient in terms of raw material quantity, net material quantity, edible quantity, cooked equivalent quantity, recipe semantic category and collection semantic category, to ensure that the same group of variables all point to the same ingredient.
[0045] In this implementation plan, by integrating the weight conversion features of the preprocessing stage, the consistency features of the postprocessing stage, and the semantic difference suppression relationship into a unified weight semantic mapping convergence value, the system's ability to distinguish the availability and consistency of different weight semantic records is enhanced. This improves the screening accuracy of the ingredient unfolding dataset and the stability of the unified caliber conversion, thereby providing a more reliable data foundation for nutritional contribution calculation, dish-level accounting, meal-level summarization, and link consistency verification. It further enhances the accuracy, anti-interference, and traceability of the campus-wide recipe decomposition and accounting process.
[0046] Specifically, the process of generating the food ingredient unfolding dataset is as follows:
[0047] The system compares the convergence value and threshold of the weight semantic mapping in real time. When the convergence value is less than the threshold, it indicates that the current ingredient still has a risk of semantic misuse. The current ingredient is then paused from entering the unified accounting process, and the semantic mapping evaluation is re-executed by calling the candidate weight records of the same batch. The number of backtracking attempts is recorded. If the number of backtracking attempts does not reach the maximum backtracking attempt threshold (the default maximum is 3), the candidate weight records are called again. If the maximum backtracking attempt threshold has been reached and convergence is still not achieved, the backtracking is terminated, the current ingredient is marked as having a semantic mapping anomaly, and the default weight from the current candidate weight record is used to enter the unified accounting process. The default weight is directly taken from the current candidate weight record according to the semantic category closest to the accounting target. If there is no match, the conversion is performed using the priority order of edible weight or net weight. When the convergence value of the weight semantic mapping is greater than or equal to the threshold, it indicates that the current ingredient has completed semantic mapping. The current unified weight is recorded, and the ingredient unfolding dataset is constructed starting from the current ingredient.
[0048] like Figure 3 The semantic evolution trend chart of food weight shows the weight changes of different foods at each stage: raw material quantity, net material quantity, edible quantity, cooked equivalent quantity, and actual consumption quantity. The horizontal axis represents the semantic stage of weight, and the vertical axis represents the weight value. Different broken lines correspond to ingredients such as rice, eggs, pork, green vegetables, carrots, potatoes, chicken, fish, tofu, and tomatoes. The average trajectory and median trajectory are also given to characterize the overall level of change. As can be seen from the figure, the weight of each food generally shows a gradual decreasing trend as the processing stage progresses, indicating that there is continuous weight loss in the process of washing, peeling, cutting, cooking, and actual consumption. Among them, the changes between stages are more obvious for foods with larger initial input, such as rice and pork. Vegetables such as green vegetables, carrots, and tomatoes also show a relatively stable decreasing relationship in the edible quantity and cooked equivalent quantity stages. The average trajectory and median trajectory shift downwards generally, indicating that although the absolute weight of different foods varies, they have a relatively consistent stage decay pattern in the process of weight semantic transformation. This diagram can intuitively reflect the weight evolution path of each ingredient from its initial input to its final consumption, providing a visual basis for weight semantic mapping, standardized conversion, and nutritional contribution accounting.
[0049] In this implementation scheme, by comparing the convergence value of the weight semantic mapping with the weight semantic mapping threshold in real time, and combining the backtracking call mechanism of candidate weight records in the same batch, the maximum backtracking number limit mechanism, and the default caliber weight continuation mechanism, it is possible to promptly block abnormal food records from directly entering the unified accounting process when the semantic mapping is unstable, thereby reducing the interference of semantic mixing, caliber mismatch, and local missing data on the decomposition accounting; avoiding the repeated propagation of abnormal records, and ensuring the continuity and integrity of the food unfolding dataset construction process.
[0050] Specifically, the process of identifying the starting and ending points of the accounting calculation based on the food ingredient dataset is as follows:
[0051] Based on the ingredient unfolding dataset, all ingredient unfolding records for the same dish under the same meal category are extracted. The ingredient unfolding records are grouped and sorted according to recipe date, meal category identifier, dish identifier, and correction time identifier, and weight change sequence, source switching sequence, and batch switching sequence are constructed. The weight change sequence is obtained by subtracting the uniform weight of two adjacent records after reading the uniform weight field of each ingredient unfolding record in chronological order. The source switching sequence is obtained by marking whether the source status of two adjacent records has changed after reading the source identifier field of each ingredient unfolding record in chronological order and converting the source identifier into a status code. The batch switching sequence is obtained by marking whether the batch identifier of two adjacent records has changed after reading the batch identifier field of each ingredient unfolding record in chronological order.
[0052] A mutation identification method based on local change trend detection and continuous state confirmation is used to analyze weight change sequences, source switching sequences, and batch switching sequences to identify weight change trend mutation points, source mutation points, and batch mutation points. If the absolute value of the first-order difference of the uniform caliber weight corresponding to the current record is greater than the weight change mutation threshold, and the difference direction changes or the difference amplitude suddenly increases before and after the current record, then the time corresponding to the current record is identified as a weight change trend mutation point. If the source state code corresponding to the current record is different from the previous record, and the changed source state remains unchanged in three consecutive records, then the time corresponding to the current record is identified as a source mutation point. If the batch identifier corresponding to the current record is different from the previous record, and the changed batch identifier remains unchanged in a subsequent preset number of records, then the time corresponding to the current record is identified as a batch mutation point. The identified mutation points are merged by time, and the earliest mutation point corresponding to the time is taken as the candidate calculation starting point.
[0053] Extract the expanded food records from a continuous fixed record window starting from the candidate accounting starting point. The window length is 10 expanded food records by default, arranged in chronological order. Calculate the consistency ratio of weight semantic categories, the continuity ratio of source identifiers, and the batch association stability ratio based on the dominant category statistics within the window. Specifically, the consistency ratio of weight semantic categories is the proportion of records in the window that share the same dominant weight semantic category as the total number of valid records in the window; the dominant weight semantic category is the weight semantic category that appears most frequently within the window. The continuity ratio of source identifiers is the proportion of the number of times the source identifier remains unchanged between adjacent records within the window out of the total number of comparisons between adjacent records within the window. The batch association stability ratio is the proportion of records in the window that share the same source identifier as the dominant batch identifier. The proportion of records with the same identifier to the total number of valid records in the window, where the dominant batch identifier is the batch identifier that appears most frequently in the window; if the consistency ratio of weight semantic category, the continuity ratio of source identifier, and the stability ratio of batch association are all greater than or equal to the corresponding starting point judgment threshold in the current continuous fixed record window, then the current candidate point is confirmed as a valid accounting starting point, and the food expansion records after the starting point are extracted as candidate accounting segments; if any of the three indicators is lower than the corresponding starting point judgment threshold, then the candidate accounting starting point is slid one record backward, and a new continuous fixed record window is extracted again, and the above ratio calculation and threshold judgment process is repeated until the first valid accounting starting point that meets the three starting point judgment conditions is identified.
[0054] Starting from the effective accounting start point, a sliding window analysis is performed on the ingredients in the candidate accounting segment. The default length of the sliding window is 10 records, consistent with the fixed record window length. The sliding step is 1 record. The accounting end position is determined based on the degree of weight change, source switching frequency, and batch switching frequency within the window. The absolute value of the uniform weight difference between adjacent records in the current sliding record window is calculated, and the average value is obtained to obtain the weight change index. The number of times the source identifier changes between adjacent records in the current sliding record window is calculated to obtain the source switching index. The number of times the batch identifier changes between adjacent records in the current sliding record window is calculated to obtain the batch switching index.
[0055] When the weight change index, source switching index, and batch switching index are all below their corresponding lower thresholds, the current sliding record window is determined to have entered the convergence zone. If N consecutive sliding record windows enter the convergence zone (N defaults to 3), where N represents the number of consecutive sliding record windows that meet the convergence conditions are required to determine whether the calculation has entered a stable convergence zone, the system confirms that the calculation has stabilized only when N consecutive windows meet the requirement that the weight change index, source switching index, and batch switching index are below their corresponding lower thresholds. The start time of the first stable window is then determined as the calculation end point. If the current sliding record window has not entered the convergence zone, the analysis window continues to slide forward and the stability determination is repeated until the calculation end point is identified.
[0056] In this implementation plan, by performing grouping and sorting, sequence construction, mutation identification, candidate starting point screening, valid starting point confirmation, and accounting end point determination on the food ingredient unfolding dataset, the effective data range that truly participates in the accounting can be automatically located from the continuous food ingredient unfolding records. This avoids directly including records from the source switching, batch switching, weight mutation, or local perturbation stages into the accounting process. The accounting end point is determined by using a method of joint confirmation of multiple consecutive sliding record windows, which can reduce the interference of occasional fluctuations in a single window on the end determination. This enhances the effectiveness, continuity, and reliability of food ingredient unfolding data in nutritional contribution calculation, dish-level accounting, and execution link traceability.
[0057] Specifically, the process of generating nutritional contribution vectors for ingredients and constructing a dish accounting dataset is as follows:
[0058] The food ingredient expansion records from the effective calculation start point to the calculation end point are extracted as the target calculation segment. For each food ingredient expansion record within the target calculation segment, the unified standard weight, food ingredient identifier, weight semantic category, source identifier, and batch association identifier are extracted. The food nutrient element record corresponding to the food ingredient identifier is then retrieved to obtain the nutrient element baseline vector per unit weight. Using a nutrient standard projection method driven by weight semantic category, the corresponding standard conversion path is selected based on the weight semantic category of the current food ingredient expansion record, mapping the unified standard weight to the target nutrient standard consistent with the food nutrient element record. Then, using a homogeneous merging method based on food ingredient identifier, source identifier, and batch association identifier, food ingredient expansion records with duplicate sources, duplicate batches, or overlapping times within the target calculation segment are merged and filtered. For records with identical food ingredient identifiers, source identifiers, and batch association identifiers, if multiple records exist, the latest record is selected as the valid record based on the collection time identifier. For records with the same food ingredient identifier but different source identifiers or batch association identifiers, and whose recording time intervals overlap, the arithmetic mean of the unified standard weight is taken as the merged weight, and any one of them is retained. The remaining fields of a record retain the valid ingredient records participating in the current calculation segment. For the merged valid ingredient records, a vector mapping operation is performed between the uniform weight under the target nutritional caliber and the corresponding nutrient element reference vector. Let the uniform weight be w, a dimensionless scale value, and the nutrient element reference vector be b = b1, b2, ..., bk, where each component represents the nutrient element content per unit weight, which has been standardized to a uniform reference unit by the system, such as the number of grams or milligrams corresponding to each scale weight. Then, the ingredient nutritional contribution vector is w × b = (wb1, wb2, ..., bk). Since both w and b have been normalized within this system, no additional unit conversion is needed. A nutritional contribution vector for each ingredient is generated. For all nutritional contribution vectors within the same dish, they are merged dimension-wise according to the dish identifier to construct a dish-level nutritional contribution vector, forming dish-level accounting data. For all dish-level accounting data within the same meal category, they are aggregated according to the recipe date and meal category identifier to construct a meal-level accounting vector, forming meal-level accounting data. For multiple consecutive meal-level accounting data, they are spliced together and accumulated dimension-wise according to a preset statistical period to form periodic-level accounting data.
[0059] Extract the unified weight, weight semantic category, source identifier, batch association identifier, nutritional element baseline vector, ingredient nutritional contribution vector, dish identifier, meal type identifier, and recipe date corresponding to each valid ingredient record within the target accounting segment. Construct a dish accounting dataset using a structured construction method based on field concatenation, hierarchical mapping, and index binding. The dish accounting dataset is used to represent the weight source relationship, semantic category relationship, batch association relationship, and nutritional contribution relationship of a single ingredient within the current accounting segment. Using the dish identifier, meal type identifier, and recipe date as the main index, and the ingredient identifier, source identifier, and batch association identifier as sub-indexes, multi-level aggregation is performed on all dish accounting datasets to form a dish accounting index dataset. This enables dish-level accounting data to be back-located to the corresponding ingredient expansion record, weight semantic category, source record, and batch record.
[0060] like Figure 4 The heatmap showing the nutritional contributions of different ingredients displays their distribution across various nutritional dimensions, including protein, fat, carbohydrates, energy, and sodium. The horizontal axis represents the type of nutrient, and the vertical axis represents the ingredient's identifier. The color intensity and corresponding numerical values in the graph together indicate the magnitude of each ingredient's contribution to its respective nutrient. As can be seen from the graph, different ingredients exhibit significant differences in their distribution across various nutritional dimensions: for example, FD001 shows high contributions in fat and energy, indicating its prominent contribution in these areas; FD006 shows high values in protein, carbohydrates, and energy, indicating its strong overall contribution across multiple nutritional dimensions; FD002's contribution in sodium is significantly higher than other nutritional items, indicating a strong contribution to sodium intake; while ingredients such as FD003, FD004, FD005, and FD007 show a relatively dispersed but distinct contribution pattern across different nutritional dimensions. This diagram can intuitively reflect the distribution characteristics of the nutritional contribution vectors of each ingredient, providing visual support for constructing the nutritional contribution vectors of dishes, performing dish-level nutritional accounting, and analyzing the dominant role of different ingredients in nutritional composition.
[0061] In this implementation plan, by expanding the records of ingredients within the effective accounting segment and performing nutrient caliber projection, homogeneous merging, vector mapping, and multi-level aggregation processing, it is possible to uniformly convert ingredient records scattered across different sources, batches, and time intervals into effective ingredient records that can be directly used in the accounting process, thus avoiding interference from duplicate, overlapping, and heterogeneous records on the nutrient accounting results.
[0062] Specifically, based on the dish accounting dataset, the process for evaluating the consistency recursion check between the current accounting link and the execution link is as follows:
[0063] Based on the dish accounting dataset, the number of successfully connected link fields is obtained by matching and statistically analyzing the associated fields in the recipe records, dish formula records, ingredient expansion records, acceptance and warehousing records, inventory records, and outbound records at the current processing time. Associated fields may include one or more of the following: dish identifier, ingredient identifier, meal type identifier, recipe date, batch identifier, source identifier, and time identifier. When a field can be effectively mapped between link levels, it is recorded as a successfully connected field. The number of broken link fields is obtained by performing missing detection, misalignment detection, and mapping failure detection on the associated fields in each link level at the current processing time. The theoretical expansion result value is obtained by performing a unified decomposition and theoretical calculation on the ingredient expansion dataset corresponding to the current processing time. The acceptance and warehousing records, inventory change records, and outbound execution records corresponding to the current processing time are read and extracted according to the same field structure as the theoretical expansion result value to obtain the execution record result value.
[0064] Without this recursive method, relying solely on the number of successfully connected fields and the number of broken fields at the current moment for static judgment results in an anomaly identification accuracy of approximately 72%, with a false alarm rate as high as 25% due to single-point fluctuations. After adopting this recursive method, historical consistency information is integrated through inheritance terms, the link quality signal is amplified by enhancement terms, and the deviation terms suppress abnormal deviations between the execution records and theoretical calculations. Then, the recursive value is mapped to the (-1,1) interval through tanh hyperbolic tangent transformation to achieve dimensionless output. At the same time, it effectively suppresses the impact of abnormal jump values on the verification results, making the link consistency recursive verification value smooth and robust.
[0065] Multiply the link consistency recursive check value from the previous processing time by the consistency inheritance coefficient to obtain the inheritance term; then divide the number of successfully connected link fields at the current processing time by the sum of the constant term 1 and the number of broken link fields, add 1, and take the natural logarithm to obtain the enhancement term; calculate the absolute value of the difference between the theoretical expansion result value and the execution record result value at the current processing time, and multiply the absolute value of the difference by the execution deviation suppression coefficient to obtain the deviation term; add the inheritance term and the enhancement term, and then subtract the deviation term to obtain the recursive value; perform a hyperbolic tangent transform on the recursive value to obtain the link consistency recursive check value.
[0066] The specific formula for calculating the link consistency recursive check value is as follows:
[0067] ;
[0068] In the formula, Indicates the first The link consistency recursive verification value at each processing moment is used to characterize the link connectivity between recipe records, formula records, acceptance and warehousing records, inventory records and outbound records at the current processing moment, as well as the overall consistency between theoretical calculation results and execution record results. Indicates the first The link consistency recursive check value at each processing moment is used to characterize the link consistency status at the previous processing moment and serve as a historical reference for the link consistency status at the current processing moment, so that the check result at the current processing moment has continuity and recursion. The consistency inheritance coefficient is determined by combining the average of the link field continuity ratio, the average of the field breakage ratio, and the average of the execution deviation within a consecutive preset number of processing times. The value range is 0-1, and it is used to adjust the inheritance strength of the link consistency status of the previous processing time to the current processing time. Indicates the first The number of link fields successfully connected at each processing moment is used to characterize the actual connectivity of the data link at the current processing moment; Indicates the first The number of link break fields detected at each processing moment is used to characterize the number of fields in the data link that failed to be effectively connected at the current processing moment; Indicates the first The theoretical expansion result value at each processing moment is used to characterize the theoretical side result derived according to the recipe structure, weight semantic transformation rules and accounting logic. Indicates the first The execution record result value at each processing moment is used to characterize the actual result reflected by the real record on the execution side; The execution deviation suppression coefficient is obtained through an adaptive setting method based on the reliability of the execution-side record and the sensitivity of the theoretical-side result. Its value range is a real number greater than 0. It is used to adjust the suppression strength of the difference between the theoretical expansion result value and the execution record result value on the link consistency recursive verification value. This represents the hyperbolic tangent function, obtained by performing a nonlinear compression transformation on the recursive combination result within the brackets. It is used to compress the result of the combined effect of historical consistency inheritance, link continuity, and execution deviation suppression into a bounded interval.
[0069] Experimental results show that the anomaly detection accuracy of the recursive method is improved to 94%, the false alarm rate is reduced to 7%, and the stability is reduced by 62% compared to the non-recursive method. Specifically, the tanh transform ensures a limited output range, avoiding system overflow or threshold failure due to extreme recursive values, and its saturation region characteristic naturally suppresses noise exceeding a reasonable range. All fields involved in the calculation, vector differences, and coefficients are dimensionless values, ensuring comparability across different scenarios.
[0070] As shown in Table 1, the field link connectivity recursive verification table quantifies the consistency of field connectivity status and results at seven processing times: Processing time 1: 8 successfully connected fields, 2 broken fields, theoretical expansion result value 12.6, execution record result value 12.18, link consistency recursive verification value 0.7363; Processing time 2: 9 successfully connected fields, 1 broken field, theoretical expansion result value 12.95, execution record result value 12.71, link consistency recursive verification value 0.9661; Processing time 3: 10 successfully connected fields, 1 broken field, theoretical expansion result value 13.1, execution record result value 13.02, link consistency recursive verification value 0.9843; Processing time 4: [The table continues with further details about field connectivity and results]. 7. Number of broken fields: 3; theoretical expansion result: 12.48; execution record result: 11.74; link consistency recursive verification value: 0.7973. At processing time 5, the number of successfully connected fields was 11; the number of broken fields was 1; theoretical expansion result: 13.32; execution record result: 13.08; link consistency recursive verification value: 0.9777. At processing time 6, the number of successfully connected fields was 10; the number of broken fields was 0; theoretical expansion result: 12.88; execution record result: 12.79; link consistency recursive verification value: 0.9953. At processing time 7, the number of successfully connected fields was 9; the number of broken fields was 1; theoretical expansion result: 12.67; execution record result: 12.61; link consistency recursive verification value: 0.9827. Overall data shows that the more fields successfully connected and the fewer fields broken, the smaller the difference between the theoretical expansion result and the execution record result, and the higher the link consistency recursive verification value. Among them, processing time 6 has no broken fields and the highest verification value, indicating the best link stability and consistency. Processing times 1 and 4 have more broken fields, resulting in relatively lower verification values and weaker link consistency.
[0071] Table 1 Field Link Connectivity Recursive Verification Table
[0072]
[0073] like Figure 5The graph showing the changes in the link consistency recursive verification value at each processing time illustrates the changes in the link consistency recursive verification value. The horizontal axis represents the processing time, and the vertical axis represents the link consistency recursive verification value. The solid line represents the trajectory of the link consistency recursive verification value at each processing time, and the dashed line represents the reference threshold. As can be seen from the graph, the link consistency recursive verification value remains at a high level overall, with most processing times exceeding the reference threshold. This indicates that the field connectivity between recipe records, formula records, acceptance and warehousing records, inventory records, and outbound records is good, and the overall deviation between the theoretical expansion result and the execution record result is small. Among them, the link consistency recursive verification value corresponding to the first processing time is the lowest, which is marked as the lowest point in the graph, indicating that the link connectivity is relatively weak or the execution deviation is relatively large in the initial processing stage. Subsequently, the link consistency recursive verification value at each processing time increases significantly and remains in a high range, indicating that as the link fields are gradually connected, the number of broken fields decreases, and the deviation between the theoretical result and the execution result decreases, the overall link consistency of the system is enhanced. This figure can intuitively reflect the evolution trend of the link consistency state in the continuous processing of the present invention, and provides a visual basis for identifying abnormal processing moments, evaluating the credibility of accounting results, and performing link verification.
[0074] In this implementation plan, by performing a step-by-step statistical analysis of the related fields between recipe records, dish recipe records, ingredient expansion records, acceptance and warehousing records, inventory records, and outbound records, and by combining the theoretical expansion result value with the execution record result value to construct a link consistency recursive verification value, it can simultaneously reflect the data link integrity at the current processing moment and the consistency between the theoretical calculation result and the execution side record, thus avoiding the one-sidedness of judgment caused by relying solely on static field matching at a single moment.
[0075] Specifically, the process of identifying abnormal link states and generating accounting behavior labels is as follows:
[0076] The link consistency recursive verification value is compared with the link consistency threshold: when the link consistency recursive verification value is greater than or equal to the link consistency threshold, it is determined that the current accounting link is consistent with the execution link, and the current accounting result is a valid accounting result; when the link consistency recursive verification value is less than the link consistency threshold, the local anomaly analysis stage is entered, and feature threshold judgments are performed on the link continuity item, link break item, and execution deviation item respectively: if the number of link break fields is higher than the field break threshold, and the break fields are concentrated in the acceptance and delivery records, it is identified as an execution link break state; if the difference between the theoretical expansion result value and the execution record result value is higher than the execution deviation value, it is identified as an execution link break state. If the weight deviation threshold is exceeded and deviations exist in consecutive processing times, it is identified as a weight execution deviation state. If the weight semantic category in the recipe record is inconsistent with the weight semantic category in the execution record, and the inconsistency persists within the consecutive record window, it is identified as a weight semantic misalignment state. If the number of consecutive changes in the source field exceeds the source disturbance threshold, and the number of batch switching times increases synchronously, it is identified as a record source disturbance state. The identified link status is structurally bound with the current dish identifier, meal identifier, recipe date, and processing time information to generate accounting behavior labels. At the same time, a review flag is set for dishes or meals identified as abnormal, and the corresponding abnormal status is marked.
[0077] In this implementation scheme, by comparing the link consistency recursive verification value with the link consistency threshold, and further analyzing the number of link break fields, the deviation between the theoretical expansion result value and the execution record result value, the consistency of weight semantic category, and the continuous changes of source field and batch field when the verification value is lower than the threshold, it is possible to refine the identification of abnormal states between the current accounting link and the execution link, and avoid the problem of only giving a single abnormal judgment result without being able to distinguish the source of the abnormality.
[0078] Specifically, the second aspect of this invention provides a campus-based bulk recipe breakdown and accounting system, applied to a campus-based bulk recipe breakdown and accounting method, comprising: a data acquisition and calibration module, used to acquire and receive bulk recipe execution data from a recipe publishing system, an acceptance terminal, an inventory management module, an outbound record module, and a batch management module, and to perform time axis relocation, field unification, weight semantic labeling, and normalization processing on the bulk recipe execution data; and a weight semantic conversion module, used to extract dish identifiers, ingredient identifiers, and weight semantic fields based on the bulk recipe execution data, and to call structured recipe records to establish a dish-level ingredient composition sequence, constructing... The system establishes a penetration relationship between dish recipes, evaluates the convergence of weight semantic mapping, and generates an ingredient unfolded dataset. It then decomposes the accounting module, which, based on the ingredient unfolded dataset, identifies the accounting start and end points through mutation point detection and sliding window stability determination, generates ingredient nutritional contribution vectors, and constructs a dish accounting dataset. Finally, it executes a verification module, which, based on the dish accounting dataset, counts the number of continuous and broken fields in the link at each time step. Combining the deviation between the theoretical accounting vector and the execution record vector, it evaluates the consistency recursion verification between the current accounting link and the execution link, identifies abnormal link states, and generates accounting behavior labels.
[0079] This implementation plan establishes a complete system processing link by setting up a data acquisition and calibration module, a weight semantic conversion module, a disassembly and accounting module, and an execution verification module. This link covers data acquisition for recipe execution, weight semantic unification, ingredient expansion and nutritional contribution calculation, and link consistency assessment and abnormal status identification. It can effectively solve the problems of inconsistent standards, difficulty in connecting records, difficulty in locating accounting intervals, and difficulty in identifying abnormal statuses among recipe data, acceptance data, inventory data, and outbound data in the existing system.
[0080] It should be noted that, in this document, the terms "comprising," "including," and any other variations 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 a process, method, article, or apparatus. Specific examples have been used in this document to illustrate the principles and implementation methods of the present invention. These examples are merely for the purpose of helping to understand the method and core ideas of the present invention. The above descriptions are only preferred embodiments of the present invention. It should be pointed out that, due to the limitations of written expression and the objective existence of infinite specific structures, those skilled in the art can make several improvements, modifications, or variations without departing from the principles of the present invention, and can also combine the above technical features in an appropriate manner. These improvements, modifications, variations, or combinations, or the direct application of the concept and technical solution of the present invention to other situations without modification, should all be considered within the scope of protection of the present invention.
Claims
1. A method for breaking down and calculating campus-wide menus, characterized in that, Includes the following steps: S1, obtain the execution data of the recipe with volume, and perform time axis relocation, field unification, weight semantic labeling and normalization on the execution data of the recipe with volume; S2, based on the execution data of the recipe with quantity, construct the penetration relationship of the recipe, evaluate the convergence of the weight semantic mapping, and generate the ingredient expansion dataset; S3, based on the ingredient dataset, identifies the starting and ending points of the calculation, generates the nutritional contribution vector of the ingredients, and constructs the dish calculation dataset; S4, based on the dish accounting dataset, evaluates the consistency recursion check between the current accounting link and the execution link, identifies abnormal link states, and generates accounting behavior labels.
2. The method for breaking down and calculating campus-based menus according to claim 1, characterized in that: The specific process of acquiring the quantity-based recipe execution data and performing timeline relocation, field unification, weight semantic labeling, and normalization on the quantity-based recipe execution data is as follows: The entire process of implementing the campus-wide menu was collected to obtain menu implementation data, which includes menu date, meal type identifier, dish identifier, ingredient identifier, ingredient quantity, acceptance weight, warehouse weight, inventory weight, outbound weight, batch identifier, collection time identifier, and collection source identifier. A constraint optimization strategy based on minimum error matching is adopted. By using sliding window matching and dynamic programming to solve for optimal alignment, the time axis of the recipe execution data is repositioned. A unified mapping method based on field integrity constraints is used to unify the dish field, ingredient field, weight field, batch field, and time field in records from different sources. A sliding smoothing method based on weight change rate constraints is used to dynamically denoise the product acceptance weighing value, inventory fluctuation value, and outbound deduction value. A semantic recognition method based on the collection link and field source is used to perform weight semantic labeling on each weight field, which is marked as raw material quantity, net material quantity, edible quantity, or cooked equivalent quantity, respectively. A hierarchical normalization processing method based on field category is used to perform normalization processing on the weight field, quantity field, and related statistical fields after semantic labeling.
3. The method for breaking down and calculating campus-based menus according to claim 1, characterized in that: The specific process of constructing the recipe penetration relationship based on the quantity-based recipe execution data is as follows: Based on the execution data of the recipe with volume, the dish identifier, meal type identifier, and ingredient volume fields are extracted from the recipe records. The structured recipe records of the corresponding dishes are then called to generate a dish-level ingredient composition sequence. At the same time, the corresponding weight records of the same ingredient in the acceptance record, warehousing record, inventory record, and outbound record are extracted, and a set of candidate weights at the ingredient level is established according to the time association and batch association. By reading the weight semantic field of the ingredient in the structured recipe record of the dish, the numbering is mapped according to the weight semantic enumeration coding rule. The enumeration values 1, 2, 3, and 4 correspond to the raw material quantity, net material quantity, edible quantity, and cooked equivalent quantity, respectively, to obtain the weight semantic category number of the ingredient in the recipe record. By reading the collection link identifier, field source identifier, and weight field type in the corresponding collection record of the ingredient, and determining its current weight semantic type based on the weight semantic recognition rule, the weight semantic enumeration coding rule is then used to encode and map the ingredient according to the same weight semantic enumeration coding rule as the recipe record to obtain the weight semantic category number of the ingredient in the collection record. For each ingredient in the sequence of ingredients at the dish level, the corresponding records of raw material quantity, net material quantity, edible quantity and cooked equivalent quantity are read respectively. Then, semantic mapping is performed based on the unified caliber conversion rule so that each ingredient is converted to the current accounting target caliber. After completing the semantic mapping, structured binding is performed to generate an ingredient unfolded dataset.
4. The method for breaking down and calculating campus-based menus according to claim 1, characterized in that: The specific process for evaluating the convergence of the weight semantic mapping is as follows: Divide the raw material quantity by the sum of the net material quantity and the zero-prevention constant, add a constant term of 1, and take the natural logarithm to obtain the weight conversion characterization value of the food in the pre-processing stage. Then, take the absolute value of the difference between the edible quantity and the cooked equivalent quantity, divide it by the sum of the cooked equivalent quantity and the zero-prevention constant to obtain the relative deviation value in the post-processing stage. Then, take the negative of the relative deviation value and perform an exponential transformation to obtain the weight processing characterization value of the food in the post-processing stage. According to the weight semantic category number in the formula record and the weight semantic category number in the collection record, obtain the semantic distance value. The distance between the same semantic category is 0, and the distance between different semantic categories is uniformly set to 1. Add 1 to the semantic distance value to obtain the semantic difference suppression term. Multiply the weight conversion characterization value and the weight processing characterization value, and then divide by the semantic difference suppression term to obtain the weight semantic mapping convergence value.
5. The method for breaking down and calculating campus-based menus according to claim 1, characterized in that: The specific process for generating the food ingredient unfolded dataset is as follows: The system compares the convergence value of the weight semantic mapping with the weight semantic mapping threshold in real time. When the convergence value is less than the threshold, it is determined that the current ingredient still has the risk of semantic misuse. The current ingredient is then suspended from entering the unified accounting process, and the candidate weight records of the same batch are called back to re-execute the semantic mapping evaluation. At the same time, the number of backtracking is recorded. If the number of backtracking has not reached the maximum backtracking threshold, the candidate weight records are called back. If the maximum backtracking threshold has been reached and convergence is still not achieved, the backtracking is terminated, the current ingredient is marked as semantic mapping abnormal, and the default weight in the current candidate weight record is used to enter the unified accounting process. When the convergence value of the weight semantic mapping is greater than or equal to the weight semantic mapping threshold, it is determined that the semantic mapping of the current ingredient has been completed, the current uniform weight is recorded, and the ingredient unfolding dataset is constructed starting from the current ingredient.
6. The method for breaking down and calculating campus-based menus according to claim 1, characterized in that: The specific process of identifying the starting and ending points of the calculation based on the food ingredient dataset is as follows: Based on the ingredient unfolding dataset, all ingredient unfolding records for the same dish under the same meal category are extracted. The ingredient unfolding records are grouped and sorted according to the recipe date, meal category identifier, dish identifier, and correction time identifier, and weight change sequence, source switching sequence, and batch switching sequence are constructed. Through a mutation identification method based on local change trend detection and continuous state confirmation, the weight change sequence, source switching sequence, and batch switching sequence are analyzed to identify weight change trend mutation points, source mutation points, and batch mutation points. The identified mutation points are merged by time, and the time corresponding to the earliest mutation point is taken as the candidate calculation starting point. Extract the food ingredient records within a continuous fixed record window starting from the candidate accounting starting point, and calculate the consistency ratio of weight semantic category, the continuity ratio of source identifier, and the batch association stability ratio by using a method based on the window dominant category statistics. If the consistency ratio of weight semantic category, the continuity ratio of source identifier, and the stability ratio of batch association are all greater than or equal to the corresponding starting point judgment threshold within the current continuous fixed record window, then the current candidate point is confirmed as a valid accounting starting point, and the food expansion records after the starting point are extracted as candidate accounting segments. Starting from the effective accounting start point, a sliding window analysis is performed on the food ingredients in the candidate accounting segment. Based on the degree of weight change, source switching frequency, and batch switching frequency within the window, the accounting end position is determined. The absolute value of the uniform weight difference between adjacent records within the current sliding record window is calculated, and the average value is obtained to obtain the weight change index. The number of times the source identifier changes between adjacent records within the current sliding record window is calculated to obtain the source switching index. The number of times the batch identifier changes between adjacent records within the current sliding record window is calculated to obtain the batch switching index. When the weight change index, source switching index, and batch switching index are all below the corresponding lower limit threshold, the current sliding record window is determined to have entered the convergence zone. If N consecutive sliding record windows enter the convergence region, the recording time corresponding to the starting position of the first stable window is determined as the end point of the calculation; if the current sliding record window does not enter the convergence region, the analysis window continues to slide backward and the stability judgment is repeated until the end point of the calculation is identified.
7. The method for breaking down and calculating campus-based menus according to claim 1, characterized in that: The specific process of generating the nutritional contribution vector of ingredients and constructing the dish accounting dataset is as follows: The food ingredient expansion records from the effective accounting start point to the accounting end point are extracted as the target accounting segment. For each food ingredient expansion record within the target accounting segment, the unified weight, food ingredient identifier, weight semantic category, source identifier, and batch association identifier are extracted. The corresponding food ingredient nutrient element record is then retrieved to obtain the nutrient element baseline vector per unit weight. Using a homogeneous merging method based on food ingredient identifier, source identifier, and batch association identifier, food ingredient expansion records with duplicate sources, duplicate batches, or overlapping times within the target accounting segment are merged and filtered. If multiple records are identical in all three categories, the latest record based on the collection time identifier is selected as the valid record. For records with the same ingredient identifier but different source identifiers or batch association identifiers, and whose recording time intervals overlap, the arithmetic mean of the uniform weight is taken as the merged weight, and the remaining field information of any one of the records is retained. The valid ingredient records participating in the current accounting segment are retained. For the merged valid ingredient records, the uniform weight under the target nutritional caliber is mapped to the corresponding nutritional element benchmark vector to generate the ingredient nutritional contribution vector, and the dish accounting dataset is constructed.
8. The method for breaking down and calculating campus-based menus according to claim 1, characterized in that: The specific process for evaluating the consistency recursive verification between the current accounting link and the execution link based on the dish accounting dataset is as follows: Based on the dish accounting dataset, the number of successfully connected link fields is obtained by matching and statistically analyzing the associated fields in the recipe records, dish formula records, ingredient expansion records, acceptance and warehousing records, inventory records, and outbound records at the current processing time. Associated fields may include one or more of the following: dish identifier, ingredient identifier, meal type identifier, recipe date, batch identifier, source identifier, and time identifier. When a field can be effectively mapped between link levels, it is counted as a successfully connected field. The number of broken link fields is obtained by performing missing detection, misalignment detection, and mapping failure detection on the associated fields in each link level at the current processing time. The theoretical expansion result value is obtained by performing a unified decomposition and theoretical calculation on the ingredient expansion dataset corresponding to the current processing time. The execution record result value is obtained by reading the acceptance and warehousing records, inventory change records, and outbound execution records corresponding to the current processing time and extracting them according to the same field structure as the theoretical expansion result value. Multiply the link consistency recursive check value from the previous processing time by the consistency inheritance coefficient to obtain the inheritance term; then divide the number of successfully connected link fields at the current processing time by the sum of the constant term 1 and the number of broken link fields, add 1, and take the natural logarithm to obtain the enhancement term; calculate the absolute value of the difference between the theoretical expansion result value and the execution record result value at the current processing time, and multiply the absolute value of the difference by the execution deviation suppression coefficient to obtain the deviation term; add the inheritance term and the enhancement term, and then subtract the deviation term to obtain the recursive value; Perform a hyperbolic tangent transform on the recursive value to obtain the link consistency recursive check value.
9. The method for breaking down and calculating campus-based menus according to claim 1, characterized in that: The specific process for identifying abnormal link states and generating accounting behavior tags is as follows: The link consistency recursive verification value is compared with the link consistency threshold: when the link consistency recursive verification value is greater than or equal to the link consistency threshold, it is determined that the current accounting link is consistent with the execution link, and the current accounting result is a valid accounting result; when the link consistency recursive verification value is less than the link consistency threshold, the local anomaly analysis stage is entered, and feature threshold judgments are performed on the link continuity item, link break item, and execution deviation item respectively: the identified link status is structurally bound with the current dish identifier, meal identifier, recipe date, and processing time information to generate accounting behavior labels; at the same time, a review flag is set for dishes or meals identified as abnormal, and the corresponding abnormal status is marked.
10. A campus-based menu breakdown and accounting system, employing the campus-based menu breakdown and accounting method as described in any one of claims 1-9, characterized in that, include: The data acquisition and calibration module is used to acquire the execution data of the recipe with volume, and to perform time axis repositioning, field unification, weight semantic calibration and normalization on the execution data of the recipe with volume. The weight semantic transformation module is used to construct the recipe penetration relationship based on the recipe execution data with quantity, evaluate the convergence of weight semantic mapping, and generate an ingredient unfolding dataset. The accounting module is decomposed and used to expand the dataset based on ingredients, identify the starting point and ending point of the accounting, generate the nutritional contribution vector of ingredients, and construct the dish accounting dataset. The execution verification module is used to evaluate the consistency recursion verification between the current accounting link and the execution link based on the dish accounting dataset, identify abnormal link states, and generate accounting behavior labels.