A method and apparatus for updating aggregated data based on a mapping dictionary table
By generating a mapping dictionary table and using it to query and update data, the problems of excessive server resource consumption and long update time in existing technologies are solved, achieving efficient and stable data updates.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-20
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies require grouping and aggregating all data when updating data, which leads to excessive server resource consumption, long update time, low data update efficiency, and instability.
By generating a first mapping dictionary table and a second mapping dictionary table, and based on the mapping relationship between detailed data and aggregation results, only the data in the relevant groups is updated, avoiding the need to regroup and aggregate all data. Data updates are achieved by querying the mapping dictionary table.
It reduces server resource consumption, shortens update time, avoids data loss, and improves the efficiency and stability of data updates.
Smart Images

Figure CN115470241B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer data processing technology, and more specifically, to a method and apparatus for updating aggregated data based on a mapping dictionary table. Background Technology
[0002] Due to the large volume of raw data, to quickly present aggregated results to users, it's generally necessary to perform calculations first and then cache the results. However, incremental data may be newly added or modified from historical data. New data will be aggregated into the new results, while modifications to historical data will affect both the old and new aggregated results. For example, if a data point originally belonged to department A and is later modified to belong to department C, during data update processing, this data point should be removed from the old department A aggregated results, and the updated data should be added to the department C aggregated results.
[0003] Current technology involves grouping and aggregating all data daily, or grouping and aggregating data from the past three years, to update the data. However, due to the large volume of data, this not only leads to excessive server resource consumption but also results in long update times. Furthermore, grouping and aggregating data from the past three years can cause some data to be missed, resulting in low data update efficiency and instability. Summary of the Invention
[0004] The purpose of this application is to provide an aggregated data update method and apparatus based on a mapping dictionary table, so as to solve the problem that the existing technology performs grouped aggregation processing on all data, resulting in excessive server resource consumption and long update time.
[0005] This application provides an embodiment of an aggregated data update method based on a mapping dictionary table, comprising:
[0006] Grouping n detailed data points using aggregation conditions yields m grouped data points; where n and m are both positive integers greater than 0.
[0007] Aggregate each group of data separately to obtain m aggregation results;
[0008] Based on the mapping relationship between n detailed data and m aggregation results, generate the first mapping dictionary table;
[0009] Based on the mapping relationship between m groupings and m aggregation results, generate a second mapping dictionary table;
[0010] When data is updated, aggregated updates of the group data corresponding to the relevant groups of the updated data are achieved based on queries to the first and second mapping dictionary tables.
[0011] In the above technical solution, when grouping and aggregating all detailed data, a first mapping dictionary table is generated based on the mapping relationship between detailed data and aggregation results, and a second mapping dictionary table is generated based on the mapping relationship between grouping and aggregation results. Subsequently, if the detailed data is updated, including newly added detailed data or modifications to historical detailed data, the relevant groups whose aggregation results have changed due to the updated data can be found by querying the first and second mapping dictionary tables. Then, the group data corresponding to that group is re-aggregated to obtain a new aggregation result. Therefore, applying the update method provided in this application avoids regrouping and aggregating all data, reduces server resource consumption, shortens the time required to update data, and further avoids data omissions because the first and second mapping dictionary tables, which include all data, are queried during the update.
[0012] In some optional implementations, the detailed data includes: a detailed identifier ID and the values of k preset attributes;
[0013] The aggregation condition is i attributes out of k attributes, where k and i are both positive integers greater than 0, and k ≥ i > 0;
[0014] In any two groups of m groups, at least one attribute value is different;
[0015] Each aggregation result corresponds to an aggregation result ID;
[0016] The first mapping dictionary table includes the mapping relationship between n detail identifier IDs and m aggregation result IDs;
[0017] The second mapping dictionary table includes the mapping relationship between m groups and m aggregation result IDs.
[0018] In the above technical solution, each detailed data has a unique detailed identifier (ID) and the values of k preset attributes. The aggregation condition for grouping and aggregating all detailed data is the i attributes out of the k attributes. Each aggregation result corresponds to an aggregation result ID. The first mapping dictionary table represents the mapping relationship between all detailed identifier IDs and all aggregation result IDs, and the second mapping dictionary table represents the one-to-one mapping relationship between groups and aggregation result IDs. If the value of any attribute of any detailed data changes, the corresponding aggregation result ID can be obtained by looking up the first mapping dictionary table based on the detailed identifier ID of that detailed data, thereby updating the aggregation result corresponding to that aggregation result ID. If any detailed data is updated and then grouped into another group, the corresponding aggregation result ID can be obtained by looking up the second mapping dictionary table based on the reassigned group, thereby updating the aggregation result corresponding to that aggregation result ID.
[0019] In some optional implementations, the k attributes include: timestamp and business time; wherein, the timestamp data is the time when the detailed data was last updated, and the business time data is the time when the detailed data was created;
[0020] The method also includes:
[0021] Retrieve the detailed data to be updated;
[0022] Determine if the timestamp data of the detail data to be updated is consistent with the business time data:
[0023] If so, then confirm that the detail data to be updated is newly added detail data;
[0024] If not, then the data to be updated is determined to be data to be modified.
[0025] In the above technical solution, the k attributes of the detailed data include at least two attributes: timestamp and business time. The timestamp data is the time when the detailed data was last updated, and the business time data is the time when the detailed data was created. When a piece of detailed data is updated, if the timestamp data and the business time data are inconsistent (i.e., the timestamp data is displayed after the business time data), the detailed data is considered modified and identified as modified detailed data. If the timestamp data and the business time data are consistent, the detailed data is considered newly added and identified as newly added detailed data. Distinguishing between newly added and modified detailed data allows for data aggregation and updating in both cases through different subsequent processing flows.
[0026] In some optional implementations, after determining that the detail data to be updated is modified detail data, the method further includes:
[0027] Based on the detail identifier ID of the modified detail data, query the first mapping dictionary table to obtain the corresponding first aggregation result ID;
[0028] Regroup the modified detail data using aggregation conditions, and determine whether the modified detail data has been assigned to one of the m groups:
[0029] If the modified detail data is assigned to one of the m groups, then based on the reassigned group of the modified detail data, query the second mapping dictionary table to obtain the corresponding second aggregation result ID;
[0030] Re-aggregate the grouped data corresponding to the first aggregation result ID and the second aggregation result ID respectively, and update the corresponding aggregation results.
[0031] In the above technical solution, when the obtained detailed data to be updated is modified detailed data, the first mapping dictionary table is queried based on the detail identifier ID of the modified detailed data to obtain the first aggregation result ID before the update corresponding to the modified detailed data. The principle is that since the modified detailed data was deleted from the group data corresponding to the first aggregation result ID, the group data corresponding to the first aggregation result ID needs to be re-aggregated, and the aggregation result updated. Then, the modified detailed data is regrouped. If the modified detailed data is assigned to one of the original m groups, the second mapping dictionary table is queried based on that group to obtain the second aggregation result ID corresponding to the modified detailed data after the update. The principle is that the modified detailed data was added to the group data corresponding to the second aggregation result ID, causing the group data corresponding to the second aggregation result ID to need to be re-aggregated, and the aggregation result updated.
[0032] In some optional implementations, after re-aggregating the grouped data corresponding to the first aggregation result ID and the second aggregation result ID, and updating the corresponding aggregation results, the method further includes:
[0033] Determine if the ID of the first aggregation result is different from the ID of the second aggregation result:
[0034] If the first aggregation result ID is different from the second aggregation result ID, then the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table is modified to the second aggregation result ID.
[0035] In the above technical solution, after the aggregation results corresponding to the first aggregation result ID and the second aggregation result ID are updated, the first mapping dictionary table and the second mapping dictionary table also need to be updated synchronously. The updated first mapping dictionary table and the second mapping dictionary table can be used for the next data update. In this embodiment, if the first aggregation result ID and the second aggregation result ID are the same, that is, the modified detail data is in the same group after the update as the group before the update, then neither the first mapping dictionary table nor the second mapping dictionary table needs to be modified; if the first aggregation result ID and the second aggregation result ID are different, that is, the modified detail data is assigned to another group among the m groups after regrouping, then it is only necessary to modify the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table to the second aggregation result ID.
[0036] In some optional implementations, after determining whether the modified detail data has been assigned to one of the m groups, the method further includes:
[0037] If the modified detailed data is not assigned to any of the m groups, then a mapping relationship between the first newly added group and the first newly added aggregation result ID is added to the second mapping dictionary table.
[0038] Re-aggregate the grouped data corresponding to the ID of the first aggregation result, and update the corresponding aggregation result;
[0039] Aggregate the group data corresponding to the first newly added group and add the corresponding aggregation result;
[0040] Modify the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table to the first newly added aggregation result ID.
[0041] In the above technical solution, when modified detailed data is regrouped and assigned to a new group outside of the m groups, on the one hand, the first mapping dictionary table is queried based on the detailed identifier ID of the modified detailed data to obtain the first aggregation result ID before the update corresponding to the modified detailed data. The principle is that since the modified detailed data was deleted from the group data corresponding to the first aggregation result ID, the group data corresponding to the first aggregation result ID needs to be re-aggregated, and the aggregation result needs to be updated. On the other hand, a first new group and its corresponding first new aggregation result ID need to be added, and the group data corresponding to the first new group is aggregated to add the corresponding aggregation result, thus completing the update of the aggregation result.
[0042] This embodiment also requires synchronously updating the first mapping dictionary table and the second mapping dictionary table. The updated first and second mapping dictionary tables can be used for the next data update. In this embodiment, synchronously updating the first and second mapping dictionary tables includes: adding a mapping relationship between the first newly added group and the first newly added aggregation result ID in the second mapping dictionary table; and modifying the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table to the first newly added aggregation result ID.
[0043] In some optional implementations, after determining that the detail data to be updated is newly added detail data, the method further includes:
[0044] Group the newly added detailed data using aggregation conditions, and determine whether the newly added detailed data is assigned to a specific group among the m groups:
[0045] If the newly added detailed data is assigned to a group among the m groups, then according to the group to which the newly added detailed data is assigned, the second mapping dictionary table is queried to obtain the corresponding third aggregation result ID;
[0046] Re-aggregate the grouped data corresponding to the third aggregation result ID and update the corresponding aggregation result; add the mapping relationship between the newly added detailed data and the third aggregation result ID to the first mapping dictionary table.
[0047] In the above technical solution, when the obtained detailed data to be updated is newly added detailed data, the newly added detailed data is first regrouped. If the newly added detailed data is assigned to one of the original m groups, the second mapping dictionary table is queried according to the group to obtain the third aggregation result ID corresponding to the newly added detailed data after the update. The principle is that the newly added detailed data has been added to the group data corresponding to the third aggregation result ID, which causes the group data corresponding to the third aggregation result ID to need to be re-aggregated and the aggregation result updated. Thus, the update of the aggregation result is completed.
[0048] This embodiment also requires synchronously updating the first mapping dictionary table and the second mapping dictionary table. The updated first and second mapping dictionary tables can be used for the next data update. In this embodiment, synchronously updating the first and second mapping dictionary tables includes: adding the mapping relationship between the newly added detailed data and the third aggregation result ID to the first mapping dictionary table.
[0049] In some optional implementations, after determining whether the newly added detailed data has been assigned to a specific group among the m groups, the method further includes:
[0050] If the newly added detailed data is not assigned to any of the m groups, then a mapping relationship between the second newly added group and the second newly added aggregation result ID is added to the second mapping dictionary table;
[0051] Aggregate the group data corresponding to the second newly added group and add the corresponding aggregation result;
[0052] Add a mapping relationship between the newly added detailed data and the newly added aggregation result ID in the first mapping dictionary table.
[0053] In the above technical solution, when newly added detailed data is regrouped and assigned to a new group outside of the m groups, it is necessary to add a second new group and its corresponding second new aggregation result ID, and then aggregate the group data corresponding to the second new group to add the corresponding aggregation result. This completes the update of the aggregation result.
[0054] This embodiment also requires synchronously updating the first mapping dictionary table and the second mapping dictionary table. The updated first and second mapping dictionary tables can be used for the next data update. In this embodiment, synchronously updating the first and second mapping dictionary tables includes: adding a mapping relationship between the second newly added group and the second newly added aggregation result ID in the second mapping dictionary table, and adding a mapping relationship between the newly added detailed data and the second newly added aggregation result ID in the first mapping dictionary table.
[0055] In some alternative implementations, the aggregation condition is based on encryption using an encryption algorithm, string concatenation according to preset conditions, or at least one judgment statement.
[0056] In the above technical solutions, the aggregation conditions include, but are not limited to, the following three implementation forms:
[0057] The first method involves combining strings in a fixed order, concatenating i attributes, and then creating a column from these concatenated strings.
[0058] The second method involves combining strings in a fixed order, concatenating i attributes, and then encrypting them using an encryption algorithm, treating the encrypted i attributes as a single column.
[0059] The third approach is to treat each of the i attributes as a separate column and combine them with i conditional statements to determine whether the detailed data meets the i conditions. Only when the detailed data simultaneously meets the i grouping conditions is the detailed data assigned to that group, thus achieving the grouping of the detailed data.
[0060] This application provides an aggregated data update device based on a mapped dictionary table, comprising:
[0061] The grouping module is used to group n detailed data points using aggregation conditions to obtain m grouped data points; where n and m are both positive integers greater than 0.
[0062] The aggregation module is used to aggregate each group of data separately to obtain m aggregation results;
[0063] The dictionary generation module is used to generate a first mapping dictionary table based on the mapping relationship between n detailed data and m aggregation results; and to generate a second mapping dictionary table based on the mapping relationship between m groups and m aggregation results.
[0064] The update module is used to perform aggregated updates of the group data corresponding to the updated data based on queries to the first and second mapping dictionary tables when data is updated.
[0065] The detailed data includes: the detailed identifier ID and the values of k preset attributes;
[0066] The aggregation condition is i attributes out of the k attributes, where k and i are both positive integers greater than 0, and k ≥ i > 0;
[0067] At least one attribute value differs between any two of the m groups;
[0068] Each aggregation result corresponds to an aggregation result ID;
[0069] The first mapping dictionary table includes the mapping relationship between n detail identifier IDs and m aggregation result IDs;
[0070] The second mapping dictionary table includes the mapping relationship between m groups and m aggregation result IDs.
[0071] The k attributes include: timestamp and business time; where the timestamp data is the time when the detailed data was last updated, and the business time data is the time when the detailed data was created.
[0072] In some alternative implementations, the update module includes:
[0073] The acquisition module is used to acquire the detailed data to be updated;
[0074] The judgment module is used to determine whether the timestamp data of the detail data to be updated is consistent with the business time data: if yes, the detail data to be updated is determined to be newly added detail data; if no, the detail data to be updated is determined to be modified detail data.
[0075] In some alternative implementations, the update module further includes:
[0076] The modification processing module is used to: query the first mapping dictionary table based on the detail identifier ID of the modified detail data to obtain the corresponding first aggregation result ID;
[0077] The modified detail data is regrouped using the aggregation conditions, and it is determined whether the modified detail data has been assigned to one of the m groups:
[0078] If the modified detail data is assigned to one of the m groups, then according to the group reassigned by the modified detail data, the second mapping dictionary table is queried to obtain the corresponding second aggregation result ID;
[0079] Re-aggregate the grouped data corresponding to the first aggregation result ID and the second aggregation result ID respectively, and update the corresponding aggregation results.
[0080] In some optional implementations, the modification processing module is further configured to:
[0081] Determine whether the ID of the first aggregation result is different from the ID of the second aggregation result:
[0082] If the first aggregation result ID is different from the second aggregation result ID, then the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table is modified to the second aggregation result ID.
[0083] In some optional implementations, the modification processing module is further configured to:
[0084] If the modified detail data is not assigned to any of the m groups, then a mapping relationship between the first newly added group and the first newly added aggregation result ID is added to the second mapping dictionary table;
[0085] Re-aggregate the grouped data corresponding to the ID of the first aggregation result, and update the corresponding aggregation result;
[0086] Aggregate the group data corresponding to the first newly added group and add the corresponding aggregation result;
[0087] Modify the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table to the first newly added aggregation result ID.
[0088] In some alternative implementations, the update module further includes:
[0089] A new processing module has been added for:
[0090] The newly added detailed data is grouped using the aggregation conditions, and it is determined whether the newly added detailed data is assigned to one of the m groups:
[0091] If the newly added detailed data is assigned to one of the m groups, then according to the group to which the newly added detailed data is assigned, the second mapping dictionary table is queried to obtain the corresponding third aggregation result ID;
[0092] Re-aggregate the grouped data corresponding to the third aggregation result ID and update the corresponding aggregation result; add the mapping relationship between the newly added detailed data and the third aggregation result ID to the first mapping dictionary table.
[0093] In some optional implementations, the additional processing module is also used for:
[0094] If the newly added detailed data is not assigned to any of the m groups, then a mapping relationship between the second newly added group and the second newly added aggregation result ID is added to the second mapping dictionary table;
[0095] Aggregate the group data corresponding to the second newly added group and add the corresponding aggregation result;
[0096] Add a mapping relationship between the newly added detailed data and the second newly added aggregation result ID to the first mapping dictionary table. Attached Figure Description
[0097] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0098] Figure 1 A flowchart illustrating the steps of an aggregated data update method based on a mapping dictionary table, provided in this application embodiment;
[0099] Figure 2 The original representation intent provided for the embodiments of this application;
[0100] Figure 3 This application provides an embodiment of the first mapping dictionary representation generated from the detailed data in the original table.
[0101] Figure 4 This application provides an embodiment of the second mapping dictionary representation generated from the detailed data in the original table.
[0102] Figure 5 A schematic diagram of the original table after adding or modifying detailed data, provided in the embodiments of this application;
[0103] Figure 6 The updated first mapping dictionary provided for embodiments of this application is intended to represent the intended meaning.
[0104] Figure 7 The updated second mapping dictionary representation provided for embodiments of this application;
[0105] Figure 8 A schematic diagram illustrating the implementation of aggregation conditions provided in the embodiments of this application;
[0106] Figure 9 A functional block diagram of an aggregated data update device based on a mapping dictionary table is provided for embodiments of this application;
[0107] Figure 10 A functional block diagram of an update module provided in an embodiment of this application.
[0108] Icons: 1-Grouping module, 2-Aggregation module, 3-Dictionary generation module, 4-Update module, 41-Get module, 42-Judgment module, 43-Modification module, 44-Add module. Detailed Implementation
[0109] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0110] Please refer to Figure 1 , Figure 1 A flowchart illustrating the steps of an aggregation data update method based on a mapping dictionary table, provided in this application embodiment, includes:
[0111] Step 100: Group the n detailed data using aggregation conditions to obtain m grouped data; where n and m are both positive integers greater than 0;
[0112] Step 200: Aggregate each group of data separately to obtain m aggregation results;
[0113] Step 300: Generate the first mapping dictionary table based on the mapping relationship between n detailed data and m aggregation results;
[0114] Step 400: Generate a second mapping dictionary table based on the mapping relationship between m groups and m aggregation results;
[0115] Step 500: When data is updated, aggregated update of the group data corresponding to the relevant group of the updated data is achieved based on the query of the first mapping dictionary table and the second mapping dictionary table.
[0116] In this embodiment, when grouping and aggregating all detailed data, a first mapping dictionary table is generated based on the mapping relationship between detailed data and aggregation results, and a second mapping dictionary table is generated based on the mapping relationship between grouping and aggregation results. Subsequently, if the detailed data is updated, including newly added detailed data or modifications to historical detailed data, the relevant groups whose aggregation results have changed due to the updated data can be found by querying the first and second mapping dictionary tables. The data in these groups can then be re-aggregated to obtain new aggregation results. Therefore, applying the update method provided in this application avoids regrouping and aggregating all data, reduces server resource consumption, shortens the time required to update data, and further avoids data omissions because the first and second mapping dictionary tables, which include all data, are queried during the update.
[0117] In some optional implementations, the detailed data includes: a detailed identifier ID and the values of k preset attributes. The aggregation condition is i attributes out of the k attributes, where k and i are both positive integers greater than 0, and k ≥ i > 0; at least one attribute value differs between any two groups of m groups. Each aggregation result corresponds to an aggregation result ID. The first mapping dictionary table includes the mapping relationship between n detailed identifier IDs and m aggregation result IDs. The second mapping dictionary table includes the mapping relationship between m groups and m aggregation result IDs.
[0118] Each group corresponds to an aggregation condition and an aggregation result. The m groups in the second mapping dictionary table can include the smallest granularity group obtained by combining all the data values contained in the i attributes; it can also include the largest granularity group obtained by combining the smallest granularity group with the data values contained in the j attributes of the i attributes, where j is a positive integer greater than 0 and i>j>0; it can also include other groups set according to user needs, which are not limited here.
[0119] In this embodiment, each detailed data has a unique detailed identifier (ID) and the values of k preset attributes. The aggregation condition for grouping and aggregating all detailed data is i of the k attributes. Each aggregation result corresponds to an aggregation result ID. The first mapping dictionary table represents the mapping relationship between all detailed identifier IDs and all aggregation result IDs, and the second mapping dictionary table represents the one-to-one mapping relationship between groups and aggregation result IDs. If the value of any attribute of any detailed data changes, the corresponding aggregation result ID can be obtained by looking up the first mapping dictionary table based on the detailed identifier ID of that detailed data, thereby updating the aggregation result corresponding to that aggregation result ID. If any detailed data is updated and then grouped into another group, the corresponding aggregation result ID can be obtained by looking up the second mapping dictionary table based on the reassigned group, thereby updating the aggregation result corresponding to that aggregation result ID. Each aggregation result ID and aggregation result is one-to-one; the number of aggregation results equals the number of aggregation result IDs.
[0120] In a specific embodiment, such as Figure 2 The original representation shown depicts each detail data point with a unique detail identifier (ID) and eight attributes: timestamp, patient ID, hospital number, business time, department, drug, dosage, and cost. The first mapping dictionary representation is as follows: Figure 3 As shown, each detail ID corresponds to one aggregation result ID. Since a group can contain multiple detail data, there may be multiple detail IDs corresponding to one aggregation result ID. For example, detail IDs "1234567894" and "1234567895" in the table both correspond to aggregation result ID "0987654328". The second mapping dictionary representation is as follows: Figure 4 As shown, the aggregation condition is the aggregation of cost data grouped according to three attributes: department, drug, and business time. For example, the aggregation result ID corresponding to "Department A 2021 Drug AA Cost Aggregation" in the table is "0987654321". Each group and each aggregation result ID are one-to-one, and there are as many aggregation result IDs as there are groups.
[0121] In some optional implementations, the k attributes include: timestamp and business time; wherein, the timestamp data is the time when the detailed data was last updated, and the business time data is the time when the detailed data was created;
[0122] The method also includes:
[0123] Step 600: Obtain the detailed data to be updated;
[0124] Step 700: Determine if the timestamp data and business time data of the detail data to be updated are consistent:
[0125] If so, then confirm that the detail data to be updated is newly added detail data;
[0126] If not, then the data to be updated is determined to be data to be modified.
[0127] In this embodiment, the k attributes of the detailed data include at least two attributes: timestamp and business time. The timestamp data is the time when the detailed data was last updated, and the business time data is the time when the detailed data was created. When a piece of detailed data is updated, if the timestamp data and the business time data are inconsistent (i.e., the timestamp data is displayed after the business time data), the detailed data is considered modified and identified as modified detailed data. If the timestamp data and the business time data are consistent, the detailed data is considered newly added and identified as newly added detailed data. Distinguishing between newly added and modified detailed data allows for data aggregation and updating in both cases through different subsequent processing flows.
[0128] In the first scenario, the data to be updated is modified data. The subsequent processing steps for modified data include:
[0129] Step 810: Based on the detail identifier ID of the modified detail data, query the first mapping dictionary table to obtain the corresponding first aggregation result ID;
[0130] Step 820: Regroup the modified detail data using aggregation conditions, and determine whether the modified detail data has been assigned to one of the m groups:
[0131] Step 831: If the modified detail data is assigned to one of the m groups, then according to the group reassigned by the modified detail data, query the second mapping dictionary table to obtain the corresponding second aggregation result ID; re-aggregate the group data corresponding to the first aggregation result ID and the second aggregation result ID respectively, and update the corresponding aggregation result.
[0132] In this embodiment, when the obtained detail data to be updated is modified detail data, the first mapping dictionary table is first queried based on the detail identifier ID of the modified detail data to obtain the first aggregation result ID before the update corresponding to the modified detail data. The principle is that since the modified detail data was deleted from the group data corresponding to the first aggregation result ID, the group data corresponding to the first aggregation result ID needs to be re-aggregated, and the aggregation result updated. Then, the modified detail data is regrouped. If the modified detail data is assigned to one of the original m groups, the second mapping dictionary table is queried based on that group to obtain the second aggregation result ID corresponding to the modified detail data after the update. The principle is that the modified detail data was added to the group data corresponding to the second aggregation result ID, causing the group data corresponding to the second aggregation result ID to need to be re-aggregated, and the aggregation result updated.
[0133] For example Figure 5 The original table was modified, including altering the "Department" attribute of the detail data with the detail identifier ID "1234567891" and updating the timestamp data. A query based on the detail identifier ID "1234567891" is as follows: Figure 3 In the first mapping dictionary table, find the first aggregation result ID "0987654322". After regrouping the detailed data with the detail identifier ID "1234567891", assign it to the group "Department B 2021 Drug BB Expense Aggregation". Then, query according to this group "Department B 2021 Drug BB Expense Aggregation" as follows: Figure 4 Find the second aggregation result ID "0987654326" in the second mapping dictionary table. Then, re-aggregate the grouped data corresponding to the first aggregation result ID "0987654322" and the second aggregation result ID "0987654326" respectively, and update the aggregation results.
[0134] In some optional implementations, after re-aggregating the grouped data corresponding to the first aggregation result ID and the second aggregation result ID, and updating the corresponding aggregation results, the method further includes:
[0135] Determine if the ID of the first aggregation result is different from the ID of the second aggregation result:
[0136] If the first aggregation result ID is different from the second aggregation result ID, then the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table is modified to the second aggregation result ID.
[0137] In this embodiment, after the aggregation results corresponding to the first aggregation result ID and the second aggregation result ID are updated, the first mapping dictionary table and the second mapping dictionary table also need to be updated synchronously. The updated first mapping dictionary table and the second mapping dictionary table can be used for the next data update. In this embodiment, if the first aggregation result ID and the second aggregation result ID are the same, that is, the modified detail data is in the same group after the update as the group before the update, then neither the first mapping dictionary table nor the second mapping dictionary table needs to be modified; if the first aggregation result ID and the second aggregation result ID are different, that is, the modified detail data is assigned to another group among the m groups after regrouping, then it is only necessary to modify the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table to the second aggregation result ID.
[0138] like Figure 6 As shown, since the first aggregation result ID "0987654322" and the second aggregation result ID "0987654326" are inconsistent, the detailed data with the detail identifier ID "1234567891" corresponds to the first aggregation result ID "0987654322" before the update. After regrouping and aggregation, in the first mapping dictionary table, the detailed data with the detail identifier ID "1234567891" is updated to the second aggregation result ID "0987654326".
[0139] In some optional implementations, after determining in step 820 whether the modified detail data has been assigned to a specific group among the m groups, the method further includes:
[0140] Step 832: If the modified detail data is not assigned to any of the m groups, then add a mapping relationship between the first newly added group and the first newly added aggregation result ID in the second mapping dictionary table; re-aggregate the group data corresponding to the first aggregation result ID and update the corresponding aggregation result; aggregate the group data corresponding to the first newly added group and add the corresponding aggregation result; change the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table to the first newly added aggregation result ID.
[0141] In this embodiment, when modified detailed data is regrouped and assigned to a new group outside of the existing m groups, on one hand, the first mapping dictionary table is queried based on the detailed identifier ID of the modified detailed data to obtain the first aggregation result ID before the update corresponding to the modified detailed data. The principle is that since the modified detailed data was deleted from the group data corresponding to the first aggregation result ID, the group data corresponding to the first aggregation result ID needs to be re-aggregated, and the aggregation result updated. On the other hand, a new first group and its corresponding first new aggregation result ID need to be added, and the group data corresponding to the new first group is aggregated to create the corresponding aggregation result, thus completing the update of the aggregation result.
[0142] This embodiment also requires synchronously updating the first mapping dictionary table and the second mapping dictionary table. The updated first and second mapping dictionary tables can be used for the next data update. In this embodiment, synchronously updating the first and second mapping dictionary tables includes: adding a mapping relationship between the first newly added group and the first newly added aggregation result ID in the second mapping dictionary table; and modifying the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table to the first newly added aggregation result ID.
[0143] For example Figure 5 The original table was modified, including altering the "Department" and "Drug" attributes for the detail data with the detail identifier ID "1234567894," and updating the timestamp data. A query based on the detail identifier ID "1234567894" is as follows: Figure 3 In the first mapping dictionary table, the first aggregation result ID "0987654328" is found. After regrouping the detailed data with detail identifier ID "1234567894", no group matching the modified detail identifier ID "1234567894" is found in the second mapping dictionary table before the update. Therefore, it is necessary to add a new group "Department C2022 Drug AA Expense Aggregation" and its corresponding first new aggregation result ID "0987654329". After excluding the detailed data with detail identifier ID "1234567894", the group data corresponding to the first aggregation result ID "0987654328" is re-aggregated, and the aggregation result is updated. At the same time, the group data corresponding to the first new aggregation result ID "0987654329" is aggregated, and the corresponding aggregation result is added. The update of the aggregation result is completed.
[0144] Simultaneously, update the first and second mapping dictionary tables. For example... Figure 7As shown, in the second mapping dictionary table, the mapping relationship of the first newly added group "Department C 2022 Drug AA Expense Aggregation" and the corresponding first newly added aggregation result ID "0987654329" is added. And as shown in... Figure 6 In the first mapping dictionary table shown, the aggregation result ID corresponding to the detail identifier ID "1234567894" is modified to the first newly added aggregation result ID "0987654329". This completes the synchronization update of the first and second mapping dictionary tables.
[0145] In the second scenario, the detailed data to be updated is newly added detailed data. The subsequent processing procedures for newly added detailed data include:
[0146] Step 910: Group the newly added detailed data using aggregation conditions, and determine whether the newly added detailed data is assigned to one of the m groups:
[0147] Step 921: If the newly added detailed data is assigned to a group among the m groups, then according to the group to which the newly added detailed data is assigned, query the second mapping dictionary table to obtain the corresponding third aggregation result ID; re-aggregate the group data corresponding to the third aggregation result ID and update the corresponding aggregation result; add the mapping relationship between the newly added detailed data and the third aggregation result ID to the first mapping dictionary table.
[0148] In this embodiment of the application, when the obtained detailed data to be updated is newly added detailed data, the newly added detailed data is first grouped using aggregation conditions. If the newly added detailed data is assigned to one of the original m groups, the second mapping dictionary table is queried according to the group to obtain the third aggregation result ID corresponding to the newly added detailed data after grouping. The principle is that the newly added detailed data has been added to the group data corresponding to the third aggregation result ID, which causes the group data corresponding to the third aggregation result ID to need to be re-aggregated and the aggregation result updated. Thus, the update of the aggregation result is completed.
[0149] This embodiment also requires synchronously updating the first mapping dictionary table. The updated first mapping dictionary table can be used for the next data update. In this embodiment, synchronously updating the first mapping dictionary table includes adding the mapping relationship between the newly added detailed data and the third aggregation result ID to the first mapping dictionary table.
[0150] For example Figure 5A new detail data entry with the ID "1234567896" has been added. This new detail data is grouped using aggregation conditions and assigned to the group "Department A 2022 Drug BB Expense Aggregation". In the second mapping dictionary table, the corresponding third aggregation result ID "0987654324" is queried based on the group "Department A 2022 Drug BB Expense Aggregation". The group data corresponding to the third aggregation result ID "0987654324" is then re-aggregated, and the corresponding aggregation result is updated. The first mapping dictionary table is also updated synchronously. Figure 6 As shown, the mapping relationship between the detail identifier ID "1234567896" and the third aggregation result ID "0987654324" of the newly added detail data is added to the first mapping dictionary table.
[0151] In some optional implementations, after determining whether the newly added detailed data has been assigned to a specific group among the m groups in step 910, the method further includes:
[0152] Step 922: If the newly added detailed data is not assigned to any of the m groups, then add a mapping relationship between the second newly added group and the second newly added aggregation result ID in the second mapping dictionary table; aggregate the group data corresponding to the second newly added group and add the corresponding aggregation result; add a mapping relationship between the newly added detailed data and the second newly added aggregation result ID in the first mapping dictionary table.
[0153] In this embodiment, when newly added detailed data is grouped using aggregation conditions and assigned to a new group outside of the existing m groups, a second new group and its corresponding second new aggregation result ID need to be added. The group data corresponding to the second new group are then aggregated, and a corresponding aggregation result is added. This completes the update of the aggregation results.
[0154] This embodiment also requires synchronously updating the first mapping dictionary table and the second mapping dictionary table. The updated first and second mapping dictionary tables can be used for the next data update. In this embodiment, synchronously updating the first and second mapping dictionary tables includes: adding a mapping relationship between the second newly added group and the second newly added aggregation result ID in the second mapping dictionary table, and adding a mapping relationship between the newly added detailed data and the second newly added aggregation result ID in the first mapping dictionary table.
[0155] In some alternative implementations, the aggregation condition is based on encryption using an encryption algorithm, string concatenation according to preset conditions, or at least one judgment statement.
[0156] In the above technical solutions, the aggregation conditions include, but are not limited to, the following three implementation forms:
[0157] The first type, such as Figure 3 and Figure 7 As shown, strings are combined and i attributes are concatenated in a fixed order to form a column;
[0158] The second method involves combining strings in a fixed order, concatenating i attributes, and then encrypting them using an encryption algorithm, treating the encrypted i attributes as a single column.
[0159] The third type, such as Figure 8 As shown, each of the i attributes is treated as a separate column and combined with i conditional statements to determine whether the detailed data meets the i conditions. Only when the detailed data meets all i grouping conditions is the detailed data assigned to that group, thus achieving the grouping of detailed data.
[0160] Please refer to Figure 9 , Figure 9 This application provides a functional block diagram of an aggregation data update device based on a mapping dictionary table, comprising a grouping module 1, an aggregation module 2, a dictionary table generation module 3, and an update module 4. The grouping module 1 is used to group n detailed data points using aggregation conditions to obtain m grouped data points; where n and m are both positive integers greater than 0. The aggregation module 2 is used to aggregate each grouped data point to obtain m aggregation results. The dictionary table generation module 3 is used to generate a first mapping dictionary table based on the mapping relationship between the n detailed data points and the m aggregation results, and to generate a second mapping dictionary table based on the mapping relationship between the m groups and the m aggregation results. The update module 4 is used to perform aggregation updates of the grouped data points corresponding to the updated data based on queries to the first and second mapping dictionary tables when data is updated.
[0161] The detailed data includes: a detailed identifier ID and the values of k preset attributes. The aggregation condition is i attributes out of the k attributes, where k and i are both positive integers greater than 0, and k ≥ i > 0. At least one attribute value differs between any two groups of the m groups. Each aggregation result corresponds to an aggregation result ID. The first mapping dictionary table includes the mapping relationship between n detailed identifier IDs and m aggregation result IDs. The second mapping dictionary table includes the mapping relationship between m groups and m aggregation result IDs. The k attributes include: a timestamp and a business time; where the timestamp data is the time the detailed data was last updated, and the business time data is the time the detailed data was created.
[0162] Please refer to Figure 10 , Figure 10This is a functional block diagram of an update module 4 provided in an embodiment of this application. The update module 4 includes an acquisition module 41 and a judgment module 42. The acquisition module 41 is used to acquire the detailed data to be updated. The judgment module 42 is used to determine whether the timestamp data and the business time data of the detailed data to be updated are consistent: if yes, the detailed data to be updated is determined to be newly added detailed data; if no, the detailed data to be updated is determined to be modified detailed data.
[0163] In some optional implementations, the update module 4 further includes a modification processing module 43. The modification processing module 43 is configured to: query the first mapping dictionary table based on the detail identifier ID of the modified detail data to obtain the corresponding first aggregation result ID; regroup the modified detail data using the aggregation conditions, and determine whether the modified detail data is assigned to one of the m groups; if the modified detail data is assigned to one of the m groups, query the second mapping dictionary table based on the reassigned group of the modified detail data to obtain the corresponding second aggregation result ID; re-aggregate the group data corresponding to the first aggregation result ID and the second aggregation result ID respectively, and update the corresponding aggregation result.
[0164] In some optional implementations, the modification processing module 43 is further configured to: determine whether the first aggregation result ID is different from the second aggregation result ID; if the first aggregation result ID is different from the second aggregation result ID, then modify the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table to the second aggregation result ID.
[0165] In some optional implementations, the modification processing module 43 is further configured to: if the modified detail data is not assigned to any of the m groups, add a mapping relationship between the first newly added group and the first newly added aggregation result ID in the second mapping dictionary table; re-aggregate the group data corresponding to the first aggregation result ID and update the corresponding aggregation result; aggregate the group data corresponding to the first newly added group and add the corresponding aggregation result; and modify the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table to the first newly added aggregation result ID.
[0166] In some optional implementations, the update module 4 further includes a new processing module 44. The new processing module 44 is configured to: group the new detailed data using the aggregation conditions; determine whether the new detailed data is assigned to one of the m groups; if the new detailed data is assigned to one of the m groups, query the second mapping dictionary table according to the group to which the new detailed data is assigned to obtain the corresponding third aggregation result ID; re-aggregate the group data corresponding to the third aggregation result ID, and update the corresponding aggregation result; and add a mapping relationship between the new detailed data and the third aggregation result ID to the first mapping dictionary table.
[0167] In some optional implementations, the new processing module 44 is further configured to: if the new detailed data is not assigned to a group among the m groups, add a mapping relationship between the second new group and the second new aggregation result ID in the second mapping dictionary table; aggregate the group data corresponding to the second new group and add the corresponding aggregation result; and add a mapping relationship between the new detailed data and the second new aggregation result ID in the first mapping dictionary table.
[0168] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0169] Furthermore, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0170] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0171] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.
[0172] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for updating aggregated data based on a mapping dictionary table, characterized in that, include: Grouping n detailed data points using aggregation conditions yields m grouped data points; where n and m are both positive integers greater than 0. Aggregate each group of data separately to obtain m aggregated results; Based on the mapping relationship between the n detailed data and the m aggregation results, a first mapping dictionary table is generated; Based on the mapping relationship between the m groups and the m aggregation results, a second mapping dictionary table is generated; When data is updated, aggregated updates of the group data corresponding to the relevant groups of the updated data are achieved based on queries to the first and second mapping dictionary tables. The detailed data includes: a detailed identifier ID and the values of k preset attributes; The aggregation condition is i attributes out of the k attributes, where k and i are both positive integers greater than 0, and k ≥ i > 0; At least one attribute value differs between any two of the m groups; Each aggregation result corresponds to an aggregation result ID; The first mapping dictionary table includes the mapping relationship between n detail identifier IDs and m aggregation result IDs; The second mapping dictionary table includes the mapping relationship between m groups and m aggregation result IDs; The k attributes include: timestamp and business time; where the timestamp data is the time when the detailed data was last updated, and the business time data is the time when the detailed data was created. The method further includes: Retrieve the detailed data to be updated; Determine whether the timestamp data and the business time data of the detail data to be updated are consistent: If so, then the detailed data to be updated is determined to be newly added detailed data; If not, then the detailed data to be updated is determined to be the detailed data to be modified; After determining that the detail data to be updated is modified detail data, the method further includes: Based on the detail identifier ID of the modified detail data, query the first mapping dictionary table to obtain the corresponding first aggregation result ID; The modified detail data is regrouped using the aggregation conditions, and it is determined whether the modified detail data has been assigned to one of the m groups: If the modified detail data is assigned to one of the m groups, then according to the group reassigned by the modified detail data, the second mapping dictionary table is queried to obtain the corresponding second aggregation result ID; Re-aggregate the grouped data corresponding to the first aggregation result ID and the second aggregation result ID respectively, and update the corresponding aggregation results; After re-aggregating the grouped data corresponding to the first aggregation result ID and the second aggregation result ID respectively, and updating the corresponding aggregation results, the method further includes: Determine whether the ID of the first aggregation result is different from the ID of the second aggregation result: If the first aggregation result ID is different from the second aggregation result ID, then the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table is modified to the second aggregation result ID; After determining whether the modified detail data has been assigned to a specific group among the m groups, the method further includes: If the modified detail data is not assigned to any of the m groups, then a mapping relationship between the first newly added group and the first newly added aggregation result ID is added to the second mapping dictionary table; Re-aggregate the grouped data corresponding to the ID of the first aggregation result, and update the corresponding aggregation result; Aggregate the group data corresponding to the first newly added group and add the corresponding aggregation result; Modify the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table to the first newly added aggregation result ID; After determining that the detail data to be updated is newly added detail data, the process further includes: The newly added detailed data is grouped using the aggregation conditions, and it is determined whether the newly added detailed data is assigned to one of the m groups: If the newly added detailed data is assigned to one of the m groups, then according to the group to which the newly added detailed data is assigned, the second mapping dictionary table is queried to obtain the corresponding third aggregation result ID; Re-aggregate the grouped data corresponding to the third aggregation result ID and update the corresponding aggregation result; add the mapping relationship between the newly added detailed data and the third aggregation result ID to the first mapping dictionary table; After determining whether the newly added detailed data has been assigned to one of the m groups, the method further includes: If the newly added detailed data is not assigned to any of the m groups, then a mapping relationship between the second newly added group and the second newly added aggregation result ID is added to the second mapping dictionary table; Aggregate the group data corresponding to the second newly added group and add the corresponding aggregation result; Add a mapping relationship between the newly added detailed data and the second newly added aggregation result ID to the first mapping dictionary table.
2. The method as described in claim 1, characterized in that, in, The aggregation conditions are implemented based on encryption operations using encryption algorithms, string concatenation according to preset conditions, or at least one judgment statement.
3. An aggregated data update device based on a mapping dictionary table, characterized in that, include: The grouping module is used to group n detailed data points using aggregation conditions to obtain m grouped data points; where n and m are both positive integers greater than 0. The aggregation module is used to aggregate each group of data separately to obtain m aggregation results; The dictionary generation module is used to generate a first mapping dictionary table based on the mapping relationship between the n detailed data and the m aggregation results; and to generate a second mapping dictionary table based on the mapping relationship between the m groups and the m aggregation results. The update module is used to perform aggregated updates of the group data corresponding to the updated data based on queries of the first mapping dictionary table and the second mapping dictionary table when the data is updated. The detailed data includes: a detailed identifier ID and the values of k preset attributes; The aggregation condition is i attributes out of the k attributes, where k and i are both positive integers greater than 0, and k ≥ i > 0; At least one attribute value differs between any two of the m groups; Each aggregation result corresponds to an aggregation result ID; The first mapping dictionary table includes the mapping relationship between n detail identifier IDs and m aggregation result IDs; The second mapping dictionary table includes the mapping relationship between m groups and m aggregation result IDs; The k attributes include: timestamp and business time; where the timestamp data is the time when the detailed data was last updated, and the business time data is the time when the detailed data was created. The method further includes: Retrieve the detailed data to be updated; Determine whether the timestamp data and the business time data of the detail data to be updated are consistent: If so, then the detailed data to be updated is determined to be newly added detailed data; If not, then the detailed data to be updated is determined to be the detailed data to be modified; After determining that the detail data to be updated is modified detail data, the method further includes: Based on the detail identifier ID of the modified detail data, query the first mapping dictionary table to obtain the corresponding first aggregation result ID; The modified detail data is regrouped using the aggregation conditions, and it is determined whether the modified detail data has been assigned to one of the m groups: If the modified detail data is assigned to one of the m groups, then according to the group reassigned by the modified detail data, the second mapping dictionary table is queried to obtain the corresponding second aggregation result ID; Re-aggregate the grouped data corresponding to the first aggregation result ID and the second aggregation result ID respectively, and update the corresponding aggregation results; After re-aggregating the grouped data corresponding to the first aggregation result ID and the second aggregation result ID respectively, and updating the corresponding aggregation results, the method further includes: Determine whether the ID of the first aggregation result is different from the ID of the second aggregation result: If the first aggregation result ID is different from the second aggregation result ID, then the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table is modified to the second aggregation result ID; After determining whether the modified detail data has been assigned to a specific group among the m groups, the method further includes: If the modified detail data is not assigned to any of the m groups, then a mapping relationship between the first newly added group and the first newly added aggregation result ID is added to the second mapping dictionary table; Re-aggregate the grouped data corresponding to the ID of the first aggregation result, and update the corresponding aggregation result; Aggregate the group data corresponding to the first newly added group and add the corresponding aggregation result; Modify the first aggregation result ID corresponding to the detail identifier ID of the modified detail data in the first mapping dictionary table to the first newly added aggregation result ID; After determining that the detail data to be updated is newly added detail data, the process further includes: The newly added detailed data is grouped using the aggregation conditions, and it is determined whether the newly added detailed data is assigned to one of the m groups: If the newly added detailed data is assigned to one of the m groups, then according to the group to which the newly added detailed data is assigned, the second mapping dictionary table is queried to obtain the corresponding third aggregation result ID; Re-aggregate the grouped data corresponding to the third aggregation result ID and update the corresponding aggregation result; add the mapping relationship between the newly added detailed data and the third aggregation result ID to the first mapping dictionary table; After determining whether the newly added detailed data has been assigned to one of the m groups, the method further includes: If the newly added detailed data is not assigned to any of the m groups, then a mapping relationship between the second newly added group and the second newly added aggregation result ID is added to the second mapping dictionary table; Aggregate the group data corresponding to the second newly added group and add the corresponding aggregation result; Add a mapping relationship between the newly added detailed data and the second newly added aggregation result ID to the first mapping dictionary table.
Citation Information
Patent Citations
Method for memory on-line analytical processing (OLAP) query optimization based on field programmable gate array (FPGA)
CN105868388A
Report processing method and device
CN109543169A