Agricultural product sales platform data analysis method and system
By arithmetic encoding and compression of the data in the data table in the database of the agricultural product sales platform, the problem of difficulty in expanding the database system performance is solved, and the accuracy and efficiency of data analysis results are improved.
Patent Information
- Application Number
- CN202510163362.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-03-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art has not compressed the data stored in the database of the agricultural product sales platform, which makes it difficult to expand the performance of the database system, affecting the accuracy and efficiency of the data analysis results.
By forming a sequence to be encoded by all data under each field of the data table in the database, the target spacing is determined based on the distribution of the same data in the sequence to be compressed, the sequence to be encoded is compressed by arithmetic encoding, and a shorter decimal in binary is obtained as the compression result and stored in the database.
It improves the compression effect of the sequence to be encoded in the database, reduces storage space, enhances database performance, and improves the accuracy and efficiency of data analysis results.
Smart Images

Figure CN119628653A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data analysis and processing, and more specifically, to a data analysis method and system for an agricultural product sales platform. Background Art
[0002] The database of the agricultural product sales platform centrally stores and manages sales data of agricultural products, including product information, suppliers, customers, orders, etc. By analyzing the sales data, various reports and statistics can be generated to help decision makers understand market trends, consumer preferences, etc., so as to formulate more effective sales strategies.
[0003] In the related technology, for example, the Chinese patent application document with application publication number CN108876261A discloses an agricultural product circulation management system, including: an agricultural product circulation management platform and database, an agricultural product sampling and testing platform and database, a mobile terminal APP for agricultural product wholesalers and retailers, and a third-party platform interface program for consumer mobile terminals. The mobile terminal APP and the consumer's third-party platform interface program are respectively connected to the agricultural product circulation management platform database and the agricultural product sampling and testing platform database. The wholesaler mobile terminal APP is used for sales goods certificate management, the retailer mobile terminal APP is used for sales goods certificate request management, and the consumer mobile terminal's third-party platform interface program is used to obtain the source origin information and inspection and quarantine information of the purchased goods.
[0004] The related technology does not compress the data stored in the database. As the data grows, the uncompressed data table will make it difficult to expand the system performance of the database, affecting its scalability when the business grows, and at the same time affecting the management efficiency of the database, thereby affecting the accuracy and efficiency of the data analysis results. Summary of the invention
[0005] In order to solve the above-mentioned technical problem that the data stored in the database is not compressed, thereby affecting the accuracy and efficiency of the data analysis results, the present invention provides solutions in the following aspects.
[0006] In a first aspect, the present invention provides a data analysis method for an agricultural product sales platform, comprising: for a data table in a database of the agricultural product sales platform, all data under each field name are grouped into a sequence to be encoded; according to the distribution of the same data in the sequence to be compressed, a target spacing is determined; according to the target spacing, the sequence to be encoded is arithmetically encoded, and the interval corresponding to each data is obtained in turn, and the shortest binary value in the interval corresponding to the last data in the sequence to be compressed is obtained, and the binary value of the value is used as the compression result of the sequence to be compressed, and stored in the database; the method for obtaining the interval corresponding to the data is: taking any data as the data to be encoded, and determining the target reference character of the data to be encoded according to the target spacing; the initial frequency of each target reference character is set. The sum of the initial frequencies of all target reference characters Ratio , as the correction frequency of each target reference character; according to the correction frequency of all target reference characters, the interval corresponding to the previous data of the data to be encoded is divided to obtain the sub-interval corresponding to each target reference character; the sub-interval corresponding to the target reference character that is the same as the data to be encoded is used as the interval corresponding to the data to be encoded; according to the compression results stored in the database, the data analysis results of the agricultural product sales platform are obtained.
[0007] The present invention obtains a target spacing through the distribution of identical data in a sequence to be compressed, so as to screen out all characters that may be identical to the characters to which the data to be encoded belongs from all characters through the target spacing, and then corrects the initial frequency of each target reference character through the sum of the initial frequencies of all target reference characters, so that the corrected frequency of each target reference character is not less than its initial frequency, so that when the interval of the previous data of the data to be encoded is divided according to the corrected frequencies of all target reference characters corresponding to the data to be encoded, the range of each sub-interval obtained is larger, and finally a shorter binary decimal can be found in the interval corresponding to the last data in the sequence to be compressed as the final compression result, thereby improving the compression effect of the sequence to be encoded in the database.
[0008] Furthermore, the present invention improves the compression effect of the sequence to be encoded in the database, reduces the required storage space, enhances the system performance of the database, improves the management efficiency of the database, and thus improves the accuracy and efficiency of the data analysis results.
[0009] Preferably, the method for obtaining the target spacing includes: obtaining the spacing between every two identical data in the sequence to be compressed, wherein the spacing refers to the difference between the sequence numbers of the two data; and taking the minimum spacing among all the spacings as the target spacing.
[0010] The present invention uses the minimum spacing as the target spacing, thereby ensuring that the obtained target spacing is suitable for obtaining the target reference character of each data in the sequence to be encoded.
[0011] Preferably, the method for obtaining the target spacing includes: obtaining the spacing between every two identical data in the sequence to be compressed, wherein the spacing refers to the difference between the sequence numbers of the two data; and taking the maximum spacing among all the spacings as the target spacing.
[0012] The present invention uses the maximum spacing as the target spacing, thereby ensuring that the obtained target spacing is suitable for obtaining the target reference character of each data in the sequence to be encoded.
[0013] Preferably, the method for obtaining the target spacing includes: obtaining the spacing between each two identical data in the sequence to be compressed, wherein the spacing refers to the difference between the sequence numbers of the two data; calculating the preference of taking the minimum spacing as the target spacing; , calculate the preference of taking the maximum spacing as the target spacing , , are the minimum spacing and the maximum spacing respectively; in response to , the minimum spacing is taken as the target spacing; otherwise, the maximum spacing is taken as the target spacing.
[0014] The present invention uses the spacing with the highest preference between the minimum spacing and the maximum spacing as the target spacing, while ensuring that the obtained target spacing is suitable for obtaining the target reference character of each data in the sequence to be encoded, and at the same time maximizing the degree of improvement of the compression effect.
[0015] Preferably, the calculation takes the minimum spacing as the preferred degree of the target spacing , including: taking any data in the sequence to be compressed as the target data, and The characters to which the data belongs are used as non-reference characters of the target data; all characters except the non-reference characters are used as the first reference characters of the target data; the minimum spacing is used as the priority of the target spacing. Satisfies the expression: ; In the formula, For the The initial frequency of the character to which the data belongs, For the The data The initial frequency of the first reference symbol, Indicates The number of all first reference characters of data, is the number of all data in the sequence to be compressed, is a multiplication function.
[0016] Preferably, the calculation takes the maximum spacing as the preferred degree of the target spacing , including: taking any data in the sequence to be compressed as the target data, and The character to which the data belongs is used as the second reference character of the target data; the maximum spacing is used as the preferred degree of the target spacing. Satisfies the expression: ; In the formula, For the The initial frequency of the character to which the data belongs, For the The data The initial frequency of the second reference symbol, Indicates The number of all second reference characters of the data, is the number of all data in the sequence to be compressed, is a multiplication function.
[0017] Preferably, the method of determining the target reference character of the data to be encoded according to the target spacing includes: in response to taking the minimum spacing as the target spacing, taking the first reference character of the data to be encoded as the target reference character of the data to be encoded; in response to taking the maximum spacing as the target spacing, taking the second reference character of the data to be encoded as the target reference character of the data to be encoded.
[0018] Preferably, the method further comprises: storing each character and the initial frequency of each character, the target spacing of the sequence to be compressed, and whether the target spacing belongs to the minimum spacing or the maximum spacing in a database.
[0019] The database of the present invention also needs to store each character and its initial frequency, the target spacing of the sequence to be compressed, and whether the target spacing is the minimum spacing or the maximum spacing, so as to ensure the accuracy of subsequent decompression and the integrity of the decompressed data.
[0020] Preferably, the data analysis results of the agricultural product sales platform are obtained, including: decompressing the compressed results stored in the database to obtain a data table; analyzing the decompressed data table to obtain the data analysis results of the agricultural product sales platform; the analysis methods include statistical analysis, data visualization, time series analysis and cluster analysis; the data analysis results obtained include sales trend analysis results, customer analysis results and product analysis results.
[0021] In a second aspect, the present invention provides an agricultural product sales platform data analysis system, comprising a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned agricultural product sales platform data analysis method is implemented.
[0022] By adopting the above technical solution, the above-mentioned agricultural product sales platform data analysis method is generated into a computer program and stored in a memory to be loaded and executed by a processor, so that a terminal device is made according to the memory and the processor for easy use.
[0023] The beneficial effects of the present invention are: The present invention obtains a target spacing through the distribution of identical data in a sequence to be compressed, so as to screen out all characters that may be identical to the characters to which the data to be encoded belongs from all characters through the target spacing, and then corrects the initial frequency of each target reference character through the sum of the initial frequencies of all target reference characters, so that the corrected frequency of each target reference character is not less than its initial frequency, so that when the interval of the previous data of the data to be encoded is divided according to the corrected frequencies of all target reference characters corresponding to the data to be encoded, the range of each sub-interval obtained is larger, and finally a shorter binary decimal can be found in the interval corresponding to the last data in the sequence to be compressed as the final compression result, thereby improving the compression effect of the sequence to be encoded in the database.
[0024] Furthermore, the present invention improves the compression effect of the sequence to be encoded in the database, reduces the required storage space, enhances the system performance of the database, improves the management efficiency of the database, and thus improves the accuracy and efficiency of the data analysis results. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein: Figure 1 is a flow chart schematically illustrating a method for analyzing data of an agricultural product sales platform in the present invention; Figure 2 Schematically shows a user table in a database of an agricultural product sales platform; Figure 3 Schematically shows an agricultural product table in a database of an agricultural product sales platform; Figure 4 Schematically shows an order table in a database of an agricultural product sales platform; Figure 5 is a schematic diagram showing an order details table in a database of an agricultural product sales platform; Figure 6 is a schematic diagram showing a payment table in a database of an agricultural product sales platform; Figure 7 is a schematic diagram showing an evaluation table in a database of an agricultural product sales platform; Figure 8 is a schematic diagram showing a shopping cart table in a database of an agricultural product sales platform; Fig. 9 The figure schematically shows a shopping cart details table in a database of an agricultural product sales platform. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0027] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0028] The embodiment of the present invention discloses a data analysis method for an agricultural product sales platform, referring to Figure 1 , comprising steps S1 to S4: S1. Build a database for agricultural product sales platform.
[0029] It should be noted that the database can centrally store and manage sales data of agricultural products, including product information, suppliers, customers, orders, etc., which is convenient for query and maintenance; at the same time, structured data storage makes data retrieval and processing more efficient, and can quickly respond to user query needs and improve the user experience of the platform; through the analysis of sales data, various reports and statistics can be generated to help decision makers understand market trends, consumer preferences, etc., so as to formulate more effective sales strategies.
[0030] Specifically, the database management systems that can be selected include: MySQL, PostgreSQL, and MongoDB. You can choose the appropriate database system based on the specific needs and scale of the platform.
[0031] Furthermore, the database of the agricultural product sales platform contains multiple data tables, each data table includes multiple field names, and each field name includes multiple data; in order to ensure the accuracy and completeness of the data, the data in the data table is cleaned, including: removing duplicates, processing missing values, and correcting erroneous data.
[0032] Exemplarily, the following is a data table in the database of the agricultural product sales platform: (1) User table (users): used to store basic information of platform users, including buyers, sellers, etc. Figure 2 As shown; (2) Agricultural products table (products): used to store information about all agricultural products on the platform, such as Figure 3 As shown; (3) Orders table: used to store user order information, such as Figure 4 As shown; (4) Order details table (order_details): stores the specific product information contained in the order, such as Figure 5 As shown; (5) Payments table: used to store payment related information, such as Figure 6 As shown; (6) Reviews: used to store user reviews of products, such as Figure 7 As shown; (7) Shopping cart table (carts): used to store the user's shopping cart data, such as Figure 8 As shown; (8) Shopping cart details table (cart_items): used to store detailed information of each product in the shopping cart, such as Fig. 9 shown.
[0033] S2. Determine the target spacing according to the distribution of the same data in each sequence to be compressed in the database.
[0034] It should be noted that compressing data tables can reduce the required storage space, thereby reducing hardware costs and maintenance costs, while reducing the burden of database operations, thereby improving overall performance. This is especially important for large-scale data storage in the case of high concurrent access. It can also reduce the time required for database backup and recovery, improve the efficiency of database management, and make maintenance operations faster.
[0035] Specifically, for the data table in the database of the agricultural product sales platform, all the data under each field name are grouped into a sequence to be encoded for subsequent compression; wherein, all the characters can be obtained through the deduplication results of all the data in the sequence to be encoded.
[0036] Exemplarily, when the sequence to be compressed is {A, D, B, C, D, B, A, B, C, B, D, A, D, C}, there are four characters in total, namely A, B, C and D.
[0037] It should be noted that arithmetic coding is one of the commonly used lossless data compression algorithms and is a type of entropy coding. The essential idea of arithmetic coding is: while retaining the order of data in the sequence, a larger decimal interval is assigned to data that appears more frequently, that is, data with a higher probability, so that a shortest binary decimal can be found in the final interval as the final compression result. According to the above logic, the larger the range of the final interval, the shorter the binary decimal can be found in the final interval as the final compression result, and the better the compression effect.
[0038] It should be further explained that, for the binary number of a decimal, the higher the precision of the decimal, the longer the binary number of the decimal, and the lower the precision of the decimal, the shorter the binary number of the decimal; for example, for the low-precision decimal "0.125", its binary number is "(0).(001)", wherein the part "(0)" before the decimal point "." is the binary number of the integer part "0", and the part "(001)" after the decimal point "." is the binary number of the decimal part "125"; for the high-precision decimal "0.1107272", its binary number is "(0).(000111000101100010)", wherein the part "(0)" before the decimal point "." is the binary number of the integer part "0", and the part "(000111000101100010)" after the decimal point "." is the binary number of the decimal part "1107272".
[0039] It should be further explained that, for an interval, the larger the range of the interval, the lower the precision of the decimals that the interval can accommodate, and the shorter the shortest binary that can be found in the interval; the smaller the range of the interval, the lower the precision of the decimals that the interval can accommodate, and the longer the shortest binary that can be found in the interval; for example, for a large range of intervals [0.12, 0.13), the minimum precision of the decimals that the interval can accommodate is 3 decimal places, such as 0.121, 0.122, 0.123, ..., 0.125, ..., 0.129, the The binary number of the decimal "0.125" in the interval is "(0).(001)". For a small range interval [0.110727,0.110728), the minimum precision of the decimals that the interval can accommodate is 7 decimal places, for example, 0.1107271, 0.1107272, 0.1107273, …, 0.1107275, …, 0.1107279, and the binary number of the decimal "0.1107272" in the interval is "(0).(000111000101100010)".
[0040] In summary, if you want to improve the compression efficiency, you can do so by expanding the range of the interval finally obtained; the process of encoding a sequence through arithmetic coding is a process of multiple iterations. In each iteration, the interval corresponding to the previous data of the data to be encoded is divided according to the initial frequencies of all characters, and sub-intervals corresponding to all characters are obtained, and the sub-intervals corresponding to the characters to which the data to be encoded belongs are used as the interval of the data to be encoded. It can be seen that the range of the interval of the data to be encoded is determined by the size of the initial frequencies of the characters used when dividing the interval corresponding to the previous data of the data to be encoded. Conventional arithmetic coding uses the initial frequencies of all characters when dividing the interval corresponding to the previous data of the data to be encoded, resulting in a smaller range of the sub-intervals finally obtained; while the sub-intervals corresponding to the previous data of the data to be encoded are used for the sub-intervals corresponding to the characters to which the data to be encoded belongs. The purpose of dividing the interval corresponding to the data is to obtain the sub-interval corresponding to the character to which the data to be encoded belongs in all the obtained sub-intervals. Therefore, it is only necessary to correct the initial frequency of the character that may be the same as the character to which the data to be encoded belongs by summing up the initial frequencies of all the characters that may be the same as the character to which the data to be encoded belongs, and divide the interval corresponding to the previous data of the data to be encoded according to the corrected frequency. Then, the sub-interval corresponding to the character to which the data to be encoded belongs can be obtained from all the obtained sub-intervals. Compared with obtaining the sub-interval corresponding to all the characters when dividing the interval corresponding to the previous data of the data to be encoded according to the initial frequencies of all characters, the range of this sub-interval is larger, so a shorter binary decimal can be found in the finally obtained interval as the final compression result, and the compression effect is better.
[0041] In one embodiment, the method for obtaining the target spacing includes: obtaining the spacing between every two identical data in the sequence to be compressed, where the spacing refers to the difference between the sequence numbers of the two data; and taking the minimum spacing among all the spacings as the target spacing.
[0042] In another embodiment, the method for obtaining the target spacing includes: obtaining the spacing between every two identical data in the sequence to be compressed, where the spacing refers to the difference between the sequence numbers of the two data; and taking the maximum spacing among all the spacings as the target spacing.
[0043] It should be noted that only by taking the minimum spacing or the maximum spacing as the target spacing can it be ensured that the obtained target spacing is suitable for obtaining the target reference character of each data in the sequence to be encoded, that is, the character that is the same as the character to which the data belongs.
[0044] Exemplarily, the sequence to be compressed is {A, D, B, C, D, B, A, B, C, B, D, A, D, C}, where the 1st, 7th and 12th data are character "A", therefore, the spacing between every two identical data belonging to character "A" is 6 and 5 respectively; the 3rd, 8th and 10th data are character "B", therefore, the spacing between every two identical data belonging to character "B" is 5 and 2 respectively; the 4th, 9th and 14th data are character "C", therefore, the spacing between every two identical data belonging to character "C" is 5 and 5 respectively; the 2nd, 5th, 11th and 13th data are character "D", therefore, the spacing between every two identical data belonging to character "D" is 3, 6 and 2 respectively; therefore, the minimum spacing , maximum spacing ; For minimum spacing , each data before There is no character identical to the data in the characters to which the data belongs, that is, these characters are different from the characters to which the data belongs. Therefore, except for these different characters, the remaining characters are the same as the characters to which the data belongs. For the maximum spacing , each data before Among the characters to which the data belongs, there must be characters identical to the data, that is, these characters are identical to the characters to which the data belongs.
[0045] In other embodiments, the method for obtaining the target spacing includes: obtaining the spacing between each two identical data in the sequence to be compressed, wherein the spacing refers to the difference between the sequence numbers of the two data; calculating the preference of taking the minimum spacing as the target spacing; , calculate the preference of taking the maximum spacing as the target spacing , , are the minimum spacing and the maximum spacing respectively; in response to , the minimum spacing is taken as the target spacing; otherwise, the maximum spacing is taken as the target spacing.
[0046] It should be noted that the present invention takes the spacing with the highest preference between the minimum spacing and the maximum spacing as the target spacing, while ensuring that the obtained target spacing is suitable for obtaining the target reference character of each data in the sequence to be encoded, and at the same time maximizing the degree of improvement in the compression effect.
[0047] The calculation takes the minimum spacing as the preferred degree of the target spacing. , including: taking any data in the sequence to be compressed as the target data, and The character to which the data belongs is used as the non-reference character of the target data; all characters except the non-reference character are used as the first reference character of the target data; it should be specially noted that when the number of all data before the target data is less than When , the characters of all data before the target data are used as non-reference characters of the target data.
[0048] The minimum spacing is taken as the preferred degree of the target spacing. Satisfies the expression: ; In the formula, For the The initial frequency of the character to which the data belongs, For the The data The initial frequency of the first reference symbol, Indicates The number of all first reference characters of data, is the number of all data in the sequence to be compressed, is a multiplication function.
[0049] It should be noted that It is the result of normalizing the initial frequency of the character to which the data belongs by the initial frequencies of all characters that may be the same as the character to which the data belongs, that is, the corrected frequency; It represents the range of the interval corresponding to the last data in the sequence to be compressed at this time. The larger the range of the interval, the more likely it is to find a shorter binary decimal in the final interval as the final compression result, and the corresponding compression effect is better.
[0050] The calculation takes the maximum spacing as the preferred degree of the target spacing. , including: taking any data in the sequence to be compressed as the target data, and The character to which the data belongs is used as the second reference character of the target data; it should be noted that when the number of all data before the target data is less than When the target data is selected, the characters of all the data before the target data are used as the second reference characters of the target data.
[0051] The maximum spacing is taken as the preferred value of the target spacing. Satisfies the expression: ; In the formula, For the The initial frequency of the character to which the data belongs, For the The data The initial frequency of the second reference symbol, Indicates The number of all second reference characters of the data, is the number of all data in the sequence to be compressed, is a multiplication function.
[0052] It should be noted that It is the result of normalizing the initial frequency of the character to which the data belongs by the initial frequencies of all characters that may be the same as the character to which the data belongs, that is, the corrected frequency; It represents the range of the interval corresponding to the last data in the sequence to be compressed at this time. The larger the range of the interval, the more likely it is to find a shorter binary decimal in the final interval as the final compression result, and the corresponding compression effect is better.
[0053] S3. Perform arithmetic coding on the sequence to be encoded according to the target spacing, obtain the compression result of the sequence to be compressed, and store it in the database.
[0054] Specifically, the sequence to be encoded is arithmetically encoded according to the target spacing, the interval corresponding to each data is obtained in turn, the shortest binary value in the interval corresponding to the last data in the sequence to be compressed is obtained, the binary value of the value is used as the compression result of the sequence to be compressed, and stored in the database.
[0055] In addition, the database also needs to store each character and its initial frequency, the target spacing of the sequence to be compressed, and whether the target spacing is the minimum spacing or the maximum spacing, so as to ensure the accuracy of subsequent decompression and the integrity of the decompressed data.
[0056] The method for obtaining the interval corresponding to the data is as follows: 1. Taking any data as the data to be encoded, and determining the target reference character of the data to be encoded according to the target spacing, including: in response to taking the minimum spacing as the target spacing, taking the first reference character of the data to be encoded as the target reference character of the data to be encoded; in response to taking the maximum spacing as the target spacing, taking the second reference character of the data to be encoded as the target reference character of the data to be encoded.
[0057] 2. The initial frequency of each target reference character The sum of the initial frequencies of all target reference characters Ratio , as the correction frequency of each target reference character; according to the correction frequency of all target reference characters, the interval corresponding to the previous data of the data to be encoded is divided to obtain the sub-interval corresponding to each target reference character; the sub-interval corresponding to the target reference character that is the same as the data to be encoded is used as the interval corresponding to the data to be encoded.
[0058] It should be noted that the sum of the initial frequencies of all characters is equal to 1. After selecting some characters from all characters as target reference characters, the number of all target reference characters is not greater than the total number of all characters. Therefore, the sum of the initial frequencies of all target reference characters is Not greater than 1, passed The initial frequency of each target reference character Make corrections, that is, the initial frequency Divide by a number not greater than 1 , then the revised frequency of each target reference character is not less than its initial frequency , that is, compared to the initial frequency of each target reference character , the correction frequency of each target reference character becomes larger, so that when the interval of the previous data of the data to be encoded is divided according to the correction frequency of all target reference characters corresponding to the data to be encoded, the range of each sub-interval obtained is larger, and therefore, the final compression effect is better.
[0059] It should be noted that when obtaining the interval corresponding to the first data in the sequence to be compressed, the interval [0,1] is divided according to the initial frequencies of all characters to obtain sub-intervals corresponding to all characters.
[0060] It should be noted that the present invention obtains the target spacing through the distribution of the same data in the sequence to be compressed, so as to screen out all characters that may be the same as the characters to which the data to be encoded belongs from all characters through the target spacing, and then corrects the initial frequency of each target reference character through the sum of the initial frequencies of all target reference characters, so that the corrected frequency of each target reference character is not less than its initial frequency, so that when the interval of the previous data of the data to be encoded is divided according to the corrected frequencies of all target reference characters corresponding to the data to be encoded, the range of each sub-interval obtained is larger, and finally a shorter binary decimal can be found in the interval corresponding to the last data in the sequence to be compressed as the final compression result, thereby improving the compression effect of the sequence to be encoded in the database.
[0061] It should be further explained that the present invention improves the compression effect of the sequence to be encoded in the database, reduces the required storage space, enhances the system performance of the database, improves the management efficiency of the database, and thus improves the accuracy and efficiency of the data analysis results.
[0062] S4. Obtain data analysis results of the agricultural product sales platform based on the compression results stored in the database.
[0063] Specifically, the compressed results stored in the database are decompressed to obtain each data in turn, and then a data table composed of the data is obtained. The obtaining of each data includes: recording the next data that needs to be decompressed as the data to be decoded; determining the target reference character of the data to be decoded according to the target spacing; initial frequency of each target reference character The sum of the initial frequencies of all target reference characters Ratio , as the correction frequency of each target reference character; according to the correction frequency of all target reference characters, the interval corresponding to the previous data of the encoded data is divided to obtain the sub-interval corresponding to each target reference character; the target reference character corresponding to the sub-interval where the compression result is located is used as the data obtained by decompression.
[0064] It should be noted that, for the first data to be decoded, the interval [0,1] is divided according to the initial frequencies of all characters to obtain sub-intervals corresponding to all characters, and the character corresponding to the sub-interval where the compression result is located is used as the first data obtained by decompression.
[0065] Furthermore, the decompressed data table is analyzed to obtain data analysis results of the agricultural product sales platform, and the sales strategy, inventory management and marketing plan are adjusted according to the data analysis results.
[0066] Among them, the analysis methods include but are not limited to statistical analysis, data visualization, time series analysis and cluster analysis; the data analysis results obtained include but are not limited to sales trend analysis results, customer analysis results and product analysis results.
[0067] Among them, the statistical analysis refers to the calculation of various statistical indicators, such as total sales, sales volume, etc.; the data visualization refers to the use of charts (such as line charts, bar charts, pie charts, etc.) to display sales trends, product sales distribution, customer purchasing behavior, etc.; the time series analysis refers to identifying seasonal trends and cyclical fluctuations by analyzing the time series of data; the cluster analysis includes clustering customers or products.
[0068] Among them, the sales trend analysis results include the obtained charts of total sales and sales quantity, as well as seasonal trends. Through the obtained charts of total sales and sales quantity, it is possible to understand the sales trend changes in different time periods (such as months, quarters, and years), which in turn helps predict future sales. Through the obtained seasonal trends, it is possible to identify seasonal sales peaks and troughs, providing a basis for stocking and promotional activities; the customer analysis results include the obtained customer classification results. According to the obtained customer classification results, it is possible to achieve personalized marketing based on the purchase frequency, amount, preference and other characteristics of different customer categories, and optimize customer relationship management based on the total value brought to the enterprise by different customer categories during their life cycle; the product analysis results include the obtained product classification results. According to the best-selling products and slow-selling products in the product classification results, the product portfolio and inventory strategy are optimized, the impact of the pricing of different product categories on sales is analyzed, and reasonable pricing policies are formulated.
[0069] An embodiment of the present invention further discloses an agricultural product sales platform data analysis system, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, an agricultural product sales platform data analysis method according to the present invention is implemented.
[0070] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface, and their configuration and functions are known in the art, so they will not be described in detail here.
[0071] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0072] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A data analysis method for an agricultural product sales platform, characterized in that: include: For the data table in the database of the agricultural product sales platform, all the data under each field name are combined into a sequence to be encoded; Determine the target spacing according to the distribution of the same data in the sequence to be compressed; Perform arithmetic coding on the sequence to be encoded according to the target spacing, obtain the interval corresponding to each data in turn, obtain the shortest binary value in the interval corresponding to the last data in the sequence to be compressed, use the binary value of the value as the compression result of the sequence to be compressed, and store it in the database; The method for obtaining the interval corresponding to the data is: taking any data as the data to be encoded, and determining the target reference character of the data to be encoded according to the target spacing; The initial frequency of each target reference character The sum of the initial frequencies of all target reference characters Ratio , as the correction frequency of each target reference character; according to the correction frequencies of all target reference characters, the interval corresponding to the previous data of the data to be encoded is divided to obtain the sub-interval corresponding to each target reference character; The sub-interval corresponding to the target reference character identical to the data to be encoded is used as the interval corresponding to the data to be encoded; According to the compression results stored in the database, the data analysis results of the agricultural product sales platform are obtained.
2. The agricultural product sales platform data analysis method according to claim 1, characterized in that: The method for obtaining the target spacing includes: In the sequence to be compressed, the distance between every two identical data is obtained, where the distance refers to the difference in sequence numbers of the two data; and the minimum distance among all the distances is taken as the target distance.
3. The agricultural product sales platform data analysis method according to claim 1, characterized in that: The method for obtaining the target spacing includes: In the sequence to be compressed, the interval between every two identical data is obtained, where the interval refers to the difference in sequence numbers of the two data; and the maximum interval among all the intervals is taken as the target interval.
4. The agricultural product sales platform data analysis method according to claim 1, characterized in that: The method for obtaining the target spacing includes: In the sequence to be compressed, obtaining the interval between every two identical data, where the interval refers to the difference between the sequence numbers of the two data; Calculate the preference for using the minimum spacing as the target spacing , calculate the preference of taking the maximum spacing as the target spacing , , are the minimum spacing and the maximum spacing respectively; In response to , the minimum spacing is taken as the target spacing; otherwise, the maximum spacing is taken as the target spacing.
5. The agricultural product sales platform data analysis method according to claim 4, characterized in that: The calculation takes the minimum spacing as the preference of the target spacing. ,include: Take any data in the sequence to be compressed as the target data, and The character to which the data belongs is used as the non-reference character of the target data; all characters except the non-reference character are used as the first reference character of the target data; The preference of taking the minimum spacing as the target spacing Satisfies the expression: ; In the formula, For the The initial frequency of the character to which the data belongs, For the The data The initial frequency of the first reference symbol, Indicates The number of all first reference characters of data, is the number of all data in the sequence to be compressed, is a multiplication function.
6. The agricultural product sales platform data analysis method according to claim 4, characterized in that: The calculation takes the maximum spacing as the preferred degree of the target spacing ,include: Take any data in the sequence to be compressed as the target data, and The character to which the data belongs is used as the second reference character of the target data; The preference of taking the maximum spacing as the target spacing Satisfies the expression: ; In the formula, For the The initial frequency of the character to which the data belongs, For the The data The initial frequency of the second reference symbol, Indicates The number of all second reference characters of the data, is the number of all data in the sequence to be compressed, is a multiplication function.
7. The agricultural product sales platform data analysis method according to any one of claims 2 to 4, characterized in that: The step of determining a target reference character of the data to be encoded according to the target spacing comprises: In response to taking the minimum spacing as the target spacing, taking the first reference character of the data to be encoded as the target reference character of the data to be encoded; In response to taking the maximum distance as the target distance, taking the second reference character of the data to be encoded as the target reference character of the data to be encoded.
8. The agricultural product sales platform data analysis method according to claim 1, characterized in that: The method further comprises: Each character and the initial frequency of each character, the target spacing of the sequence to be compressed, and whether the target spacing belongs to the minimum spacing or the maximum spacing are stored in a database.
9. The agricultural product sales platform data analysis method according to claim 1, characterized in that: The data analysis results of the agricultural product sales platform are obtained, including: Decompress the compressed results stored in the database to obtain a data table; The decompressed data table is analyzed to obtain data analysis results of the agricultural product sales platform; the analysis method includes statistical analysis, data visualization, time series analysis and cluster analysis; the obtained data analysis results include sales trend analysis results, customer analysis results and product analysis results.
10. A data analysis system for agricultural product sales platform, characterized in that: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a method for analyzing agricultural product sales platform data according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Agricultural product circulation management system and management method
CN108876261A
Gas alarm system data storage method based on Internet of Things platform
CN116015312A
Router data processing method for cloud server connection
CN116055008A
Industrial computer platform data rapid transmission method and system
CN116506073A
Medical instrument product information tracing method and system
CN118487874A