Method and system for realizing data same period comparison based on visual api interface

By using a visual API interface and a binary tree structure to process data, the problems of data tampering and chaotic management in year-on-year and month-on-month data analysis are solved, data security and accuracy are achieved, and data management efficiency is improved.

CN117216133BActive Publication Date: 2026-04-10CHENGDU DIGITAL INTELLIGENCE INNOVATION LEAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHENGDU DIGITAL INTELLIGENCE INNOVATION LEAN TECH CO LTD
Filing Date
2023-09-19
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies pose risks of data tampering and chaotic data management in year-on-year and month-on-month data analysis, especially when the data source is exposed, which affects the accuracy and security of year-on-year and month-on-month data processing.

Method used

Data is obtained through a visual API interface, and month-on-month and year-on-year data stacks are established at the parent and child nodes of a binary tree, respectively. The direction of data push and pop is restricted, and the API interface is rate-limited using a leaky bucket or token bucket algorithm to ensure the security and order of data.

Benefits of technology

This reduces the risk of data tampering, ensures data security and accuracy, and improves the efficiency of data management and the accuracy of the order in which year-on-year and month-on-month data are obtained.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117216133B_ABST
    Figure CN117216133B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on visual api interface and realizes the method and system of data same ring ratio, relating to same ring ratio data processing technical field, which comprises: obtaining first result data by api interface;Create binary tree, store first result data in the parent node of binary tree, establish ring ratio and same ratio data stack in the first child node and the second child node of binary tree respectively;According to first preset frequency, obtain several second result data by api interface;Based on first preset frequency, all second result data is stored to ring ratio or same ratio data stack;Traverse parent node and first child node, obtain first result data and ring ratio data and put into component rendering, realize data ring ratio visualization;Or traverse parent node and second child node, obtain first result data and same ratio data and put into component rendering, realize data same ratio visualization.The application improves the security and accuracy of data when same ring ratio data is processed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of same period data processing, in particular to a method and system for realizing data same period based on a visual API interface. BACKGROUND

[0002] In data analysis and its visualization products, the most commonly used analysis idea is comparative analysis, and there is a practical quantifiable standard only with comparison. For quantitative comparison, the most commonly used is same period analysis. The existing same period analysis for data is usually realized by obtaining data from a data set, and the specific scheme is to first establish a data connection, then obtain the data set corresponding to the data connection, and then realize the same period by visualizing the data obtained from the data set. Since the data connection is directly established with the data source, when the data source is exposed, there may be a risk of data tampering. At the same time, when the collection period is long and the amount of data to be collected is large, the data management is relatively chaotic, which may cause errors in the final same period data processing, and ultimately affect the accuracy and security of the same period data. SUMMARY

[0003] In order to improve the accuracy and security of data in same period data processing, the present application provides a method for realizing data same period based on a visual API interface, which comprises:

[0004] Step 1: Obtain a data request for same period, and obtain first result data through a preset API interface based on the data request;

[0005] Step 2: Create a binary tree, store the first result data in the parent node of the binary tree, establish a same period data stack in the first child node of the binary tree, and establish a same period data stack in the second child node of the binary tree;

[0006] Step 3: Obtain a plurality of second result data through the API interface according to a first preset frequency based on the data request;

[0007] Step 4: Store all second result data in the same period data stack or the same period data stack based on the first preset frequency;

[0008] Step 5: traversing the parent node and the first child node to obtain a same-period result data, obtaining same-period data corresponding to the same-period result data based on the second result data, putting the same-period result data and the same-period data into a preset visualization component for rendering to realize same-period visualization of the first result data; traversing the parent node and the second child node to obtain a same-period result data, obtaining same-period data corresponding to the same-period result data based on the second result data, putting the same-period result data and the same-period data into the preset visualization component for rendering to realize same-period visualization of the first result data.

[0009] The application obtains the first result data and the plurality of second result data through the API interface, reduces the problem of data tampering caused by data source exposure. Meanwhile, a binary tree is established, and a same-period data stack and a same-period data stack are established at two child nodes of the binary tree. The first result data is stored in the parent node of the binary tree, and the plurality of second result data is stored in the same-period data stack based on a first preset frequency. By traversing the parent node and the first child node of the binary tree, the first result data and corresponding same-period data are obtained and put into a visualization component for rendering to realize same-period visualization of the first result data. Similarly, by traversing the parent node and the second child node of the binary tree, same-period visualization of the second result data is realized. The application obtains data through the API interface, without directly accessing the data source code to call and obtain data, thereby reducing the risk of data tampering caused by data exposure, ensuring the security of the data, and setting the binary tree and the same-period data stack to process same-period visualization of the data. The first result data is stored in the parent node of the binary tree, and the plurality of second result data is stored in the same-period data stack, thereby ensuring the accuracy of the order between the same-period data and the efficiency of data acquisition, and solving the problem of chaotic data management.

[0010] Further, storing all the second result data into the same-period data stack or the same-period data stack comprises: obtaining the acquisition time of all the second result data, and storing all the second result data into the same-period data stack or the same-period data stack in order from the earliest to the latest according to the acquisition time.

[0011] In the prior art, due to the long same-period data acquisition period and the large number of acquisition types, the same-period data management is chaotic. Therefore, by obtaining the acquisition time of the same-period data, all the second result data is sequentially stored into the same-period data stack or the same-period data stack based on the acquisition time, thereby ensuring that the order between the data will not be chaotic during storage.

[0012] Further, storing all the second result data into the same-period data stack or the same-period data stack further comprises: the direction of all the second result data entering the same-period stack or the same-period data stack is from the bottom of the stack to the top of the stack.

[0013] Wherein, all the second result data is defined as the direction of entering the stack from the bottom to the top, so that the second result data obtained by the api interface first can appear at the top of the data stack, and when data is needed to be obtained, the data is directly obtained from the top of the data stack, which ensures that the order of obtaining data from the same or relative data stack is consistent with the order of obtaining data by the api interface, thereby reducing the risk of sequence error between the same and relative data.

[0014] Further, the corresponding relative data is obtained in the following manner: based on the first sub-node, the relative data stack is obtained, and the direction of sequentially obtaining the corresponding relative data from the relative data stack is from the top to the bottom.

[0015] Wherein, since the direction of entering the relative data stack is from the bottom to the top, when the relative data is obtained, the data is sequentially obtained from the top, which can ensure that the order of obtaining the relative data will not be chaotic.

[0016] Further, the corresponding same data is obtained in the following manner: based on the second sub-node, the same data stack is obtained, and the direction of sequentially obtaining the corresponding same data from the same data stack is from the top to the bottom.

[0017] Wherein, since the direction of entering the same data stack is from the bottom to the top, when the same data is obtained, the data is sequentially obtained from the top, which can ensure that the order of obtaining the same data will not be chaotic.

[0018] Further, in order to identify the electricity stealing behavior of the user through the electricity data, the step 1 is specifically: obtaining a data request for same and relative comparison, based on the data request, obtaining weather history data and electricity history data of a user in a preset time period, based on the weather history data and the electricity history data, establishing and training an influence model of weather data on electricity data corresponding to each user; obtaining first electricity data of all users in a preset month through a preset api interface;

[0019] The step 2 is specifically: creating a plurality of binary trees, storing all first electricity data to parent nodes of different binary trees, establishing a relative data stack at a first sub-node of the binary tree, and establishing a same data stack at a second sub-node of the binary tree;

[0020] The step 3 is specifically: based on the data request, obtaining a plurality of second electricity data through the api interface according to a first preset frequency;

[0021] The step 4 is specifically: based on the first preset frequency, storing all second electricity data to the relative data stack or the same data stack; obtaining first weather data of each month in a time period corresponding to the first electricity data and the second electricity data.

[0022] The step 5 is specifically: traversing the parent node and the first child node to obtain the ring ratio result electric quantity data corresponding to the first electric quantity data, and obtaining the ring ratio electric quantity data corresponding to the ring ratio result electric quantity data based on the second electric quantity data; traversing the parent node and the second child node to obtain the same ratio result electric quantity data corresponding to the first electric quantity data, and obtaining the same ratio electric quantity data corresponding to the same ratio result electric quantity data based on the second electric quantity data; based on the ring ratio electric quantity data, the same ratio electric quantity data, the first weather data and the influence model, judging whether the corresponding user exists electricity stealing behavior, if so, carrying out electricity stealing warning.

[0023] At present, some users change the normal wiring of the electric energy meter current measurement loop and other ways to steal electricity and steal electricity. If the existing needs to investigate such electricity stealing behavior, a large amount of electric quantity data of the user in the preset time period needs to be obtained from the power system, and the change of the electric quantity data is analyzed to determine whether the electricity is abnormal. First, the data volume is large and needs to be distinguished and sorted, and second, the weather and other external factors are not considered to affect the electricity consumption. The present scheme first analyzes the weather and electricity consumption history data to obtain the corresponding influence model, such as the electricity peak in summer and winter, and the electricity consumption in this part of the month needs special treatment. Then, through the above method, the electricity consumption of each household and its same ratio and ring ratio data are stored in the corresponding binary tree through the api interface. When it is necessary to call and investigate, the corresponding electric quantity data and same ratio and ring ratio data are obtained by traversing the corresponding binary tree, and the influence model is analyzed in detail to improve the investigation efficiency and accuracy.

[0024] Further, the step 1 and the step 3 both further include: monitoring and obtaining the acquisition rate of the api interface, and throttling the api interface when the acquisition rate exceeds a preset threshold.

[0025] The purpose of throttling the api interface is to increase reliability and availability while protecting the infrastructure.

[0026] Further, the api interface is throttled by using a leaky bucket algorithm or a token bucket algorithm.

[0027] Using a leaky bucket algorithm or a token bucket algorithm can better throttle the api interface.

[0028] Further, the step 1 and the step 3 both further include: based on the acquisition rate of the api interface, counting the data volume of the api interface data in a preset time period, and adjusting the preset threshold based on the data volume and the server CPU.

[0029] Wherein, since the CPU of the server will also process other threads at the same time, if the acquisition rate and the preset threshold are kept unchanged, the server performance may be affected, and the availability and reliability of the underlying framework are also affected, therefore, based on the statistical data amount and the CPU of the server, the preset threshold needs to be dynamically adjusted, so that the data can be acquired at the optimal rate by the API interface, and the availability and reliability of the underlying framework are not reduced.

[0030] To improve the accuracy and security of data when processing the same ring ratio data, the application also provides a system for realizing data same ring ratio based on a visual API interface, which comprises:

[0031] A first acquisition unit is configured to obtain a data request requiring same ring ratio, and based on the request, acquire first result data through a preset API interface;

[0032] A binary tree unit is configured to create a binary tree, store the first result data in a parent node of the binary tree, establish a ring ratio data stack in a first child node of the binary tree, and establish a same ratio data stack in a second child node of the binary tree;

[0033] A second acquisition unit is configured to obtain a plurality of second result data through the API interface at a first preset frequency based on the data request;

[0034] A storage unit is configured to store all the second result data to the ring ratio data stack or the same ratio data stack based on the first preset frequency;

[0035] A visualization unit is configured to traverse the parent node and the first child node to obtain ring ratio result data, obtain ring ratio data corresponding to the ring ratio result data based on the second result data, put the ring ratio result data and the ring ratio data into a preset visualization component for rendering to realize ring ratio visualization of the first result data, and traverse the parent node and the second child node to obtain same ratio result data, obtain same ratio data corresponding to the same ratio result data based on the second result data, put the same ratio result data and the same ratio data into the preset visualization component for rendering to realize same ratio visualization of the first result data.

[0036] The one or more technical solutions provided by the application have at least the following technical effects or advantages:

[0037] The application acquires data through an API interface and performs same ring ratio visualization processing, which reduces the problem of data tampering that may be caused by data exposure and guarantees the security of data.

[0038] The application solves the problem of data confusion of corresponding same and same period data of long collection period and large amount of collected data by setting a binary tree, setting corresponding same period data stack and same period data stack on two child nodes of the binary tree, and putting the obtained data into the data stack according to the acquisition order, and limiting the data in-stack and out-stack direction, and guarantees the order accuracy and data acquisition efficiency between same and same period data. BRIEF DESCRIPTION OF DRAWINGS

[0039] The accompanying drawings, which are included to provide a further understanding of the embodiments of the application and constitute a part of this application, illustrate embodiments of the application and do not limit the application.

[0040] Figure 1 is a method flow diagram for realizing data same and same period based on a visual api interface in the application;

[0041] Figure 2 is a system composition diagram for realizing data same and same period based on a visual api interface in the application;

[0042] Figures 3-5 is a data visualization comparison diagram using an index card. DETAILED DESCRIPTION

[0043] In order to more clearly understand the above-mentioned purposes, features and advantages of the application, the application will be further described in detail below in combination with the drawings and specific embodiments. It should be noted that the embodiments of the application and the features in the embodiments can be combined with each other without conflict.

[0044] In the following description, many specific details are set forth in order to provide a thorough understanding of the application, but the application can also be implemented in other ways different from the scope described herein, therefore, the scope of protection of the application is not limited by the specific embodiments disclosed below.

[0045] Embodiment one

[0046] Please refer to Figure 1 , Figure 1 is a method flow diagram for realizing data same and same period based on a visual api interface in the application, the method comprises:

[0047] Step 1: obtaining a data request for same and same period, based on the data request, obtaining first result data through a preset api interface;

[0048] Step 2: creating a binary tree, storing the first result data in the parent node of the binary tree, establishing a same period data stack in the first child node of the binary tree, and establishing a same period data stack in the second child node of the binary tree;

[0049] Step 3: based on the data request, obtaining a plurality of second result data at a first preset frequency through the api interface;

[0050] Step 4: based on the first preset frequency, storing all second result data to the same period data stack or the same period data stack;

[0051] Step 5: traversing the parent node and the first child node, obtaining the same period result data, obtaining the same period data corresponding to the same period result data based on the second result data, putting the same period result data and the same period data into a preset visualization component for rendering to realize the same period visualization of the first result data; traversing the parent node and the second child node, obtaining the same period result data, obtaining the same period data corresponding to the same period result data based on the second result data, putting the same period result data and the same period data into the preset visualization component for rendering to realize the same period visualization of the first result data.

[0052] Among them, when obtaining data from the api interface, since the api interface returns the json field, the returned json field needs to be analyzed and processed to obtain the corresponding data.

[0053] In the embodiment of the present application, if data A, B and C need to be realized for the same period and the same period visualization, firstly, the data request of data A, B and C needs to be obtained, and based on the data request, the corresponding data A, B and C are obtained through the preset api interface. Three binary trees are created, and data A, B and C are respectively stored in the parent nodes of the three binary trees, and then data A1, A2, A3, B1, B2, B3, C1, C2 and C3 are obtained through the api interface according to the acquisition frequency of one month, and data A4, A5, B4, B5, C4 and C5 are obtained through the api interface according to the acquisition frequency of one year, and data A1, A2 and A3 are stored in the same period data stack of the binary tree corresponding to data A, and data A4 and A5 are stored in the same period data stack of the binary tree corresponding to data A, and the same reason is that the same period or same period data of data B and C is stored in the corresponding data stack. When data A needs to be data same period visualization, the parent node and the first child node of the binary tree corresponding to data A are traversed, data A and same period data A1, A2 and A3 are obtained, and the obtained data is put into the visualization component for rendering, and finally the data A same period visualization is completed; when data A needs to be data same period visualization, the parent node and the second child node of the binary tree corresponding to data A are traversed, data A and same period data A4 and A5 are obtained, and the obtained data is put into the visualization component for rendering, and finally the data A same period visualization is completed. In this embodiment, the data is obtained through the api interface and visualized, which reduces the problem of data tampering due to data exposure and protects the security of the data. At the same time, by setting the binary tree and setting the same period and same period data stack in the two child nodes of the binary tree, the problem of data management confusion is solved for the data with long collection period and large data amount. The processing of data B and C is similar to that of data A, which will not be described in detail in this embodiment. The data involved in this embodiment is only used for explanation and illustration, and the actual data same period and same period visualization can be adjusted according to the needs, and the present application is not limited in this regard.

[0054] Among them, the data is obtained through the api interface, so that the user can call or obtain the data without accessing the source code or understanding the details of the internal working mechanism, and the problem of data tampering due to data exposure can be reduced.

[0055] Among them, storing all second result data into the same period data stack or the same period data stack includes: obtaining the acquisition time of all second result data, and storing all second result data into the same period data stack or the same period data stack in order from early to late according to the acquisition time.

[0056] The acquisition time of the second result data is obtained based on the api interface, and the second result data is stored in the same period or same period data stack in order according to the acquisition time, so that the order between the data will not be chaotic when the data is stored.

[0057] Wherein, the storing all the second result data into the same period data stack or the same period data stack further comprises: the direction of all the second result data into the same period data stack or the same period data stack is from the bottom of the stack to the top of the stack.

[0058] The direction of the acquired result data into the stack is from the bottom of the stack to the top of the stack, which ensures that the data acquired first can appear on the top of the data stack. Thus, when data is acquired through the data stack, the data will not change, and the data can be acquired in the order of the api interface to perform the same period comparison, thereby ensuring that the data will not be confused when the data is acquired to perform the same period comparison.

[0059] Wherein, the way of obtaining the corresponding same period data is: based on the second sub-node, obtaining the same period data stack, and the direction of sequentially obtaining the corresponding same period data from the same period data stack is from the top of the stack to the bottom of the stack.

[0060] When the corresponding same period data is needed, the data is sequentially obtained from the top of the same period data stack. Since the direction of the data into the stack is from the bottom of the stack to the top of the stack, the order of the data obtained through the data stack is consistent with the order of the same period data obtained through the api interface, and the order of the data will not be confused.

[0061] Wherein, the way of obtaining the corresponding same period data is: based on the second sub-node, obtaining the same period data stack, and the direction of sequentially obtaining the corresponding same period data from the same period data stack is from the top of the stack to the bottom of the stack.

[0062] When the corresponding same period data is needed, the data is sequentially obtained from the top of the same period data stack. Since the direction of the data into the stack is from the bottom of the stack to the top of the stack, the order of the data obtained through the data stack is consistent with the order of the same period data obtained through the api interface, and the order of the data will not be confused.

[0063] In order to identify the electricity stealing behavior of the user through the power data, the step 1 is specifically: obtaining a data request for same period comparison, based on the data request, obtaining weather history data and power history data of a plurality of users in a preset time period, based on the weather history data and the power history data, establishing and training an influence model of weather data on power data corresponding to each user; obtaining first power data of all users in a preset month through a preset api interface;

[0064] The step 2 is specifically: creating a plurality of binary trees, storing all the first power data into the parent nodes of different binary trees, establishing a same period data stack at the first sub-node of the binary tree, and establishing a same period data stack at the second sub-node of the binary tree;

[0065] The step 3 is specifically: based on the data request, obtaining a plurality of second electric quantity data through the API interface according to a first preset frequency;

[0066] The step 4 is specifically: based on the first preset frequency, storing all second electric quantity data to the same period data stack or the same period data stack; obtaining first weather data of each month in a corresponding time period of the first electric quantity data and the second electric quantity data.

[0067] The step 5 is specifically: traversing the parent node and the first child node to obtain the same period result electric quantity data corresponding to the first electric quantity data, and obtaining the same period electric quantity data corresponding to the same period result electric quantity data based on the second electric quantity data; traversing the parent node and the second child node to obtain the same period result electric quantity data corresponding to the first electric quantity data, and obtaining the same period electric quantity data corresponding to the same period result electric quantity data based on the second electric quantity data; based on the same period electric quantity data, the same period electric quantity data, the first weather data and the influence model, judging whether the corresponding user has electricity stealing behavior, if so, performing electricity stealing warning.

[0068] Among them, a plurality of weather history data of a user in a preset time period can be obtained from a weather database (such as meteorological library historical data) or through a crawler software from a weather query website to query weather data in a preset time period, wherein each power user has identity information, such as its power address, first obtain the local historical weather data through the address query after obtaining the power address, and obtain the weather data in the preset time period from the historical weather data, and the user's electric quantity historical data is obtained from the electric quantity client or the electric quantity management department's database through the user's electric quantity ID or identity information or code.

[0069] For example, if 10 users need to be investigated for electricity stealing, if the previous investigation method is used, the electricity consumption of the 10 users in each month of the past year needs to be counted, and then the electricity consumption data of each household in each month is analyzed and compared, and the user's electricity consumption in the abnormal month is more than the preset number to determine whether the user has electricity stealing behavior. The problem with this method is that the data volume is large, the data storage and data extraction are relatively cumbersome, and the accuracy is low due to the weather. Using the present solution, the steps are as follows: first, obtain the electricity consumption data and weather data of the 10 users in the past year, obtain the influence model based on the electricity consumption data and the weather data, and the processing method of the influence model on the electricity consumption can be, for example, multiplying the electricity consumption of the month with an average temperature below 0° by a coefficient of 0.5, and multiplying the electricity consumption of the month with an average temperature above 35° by a coefficient of 0.7. Since electricity consumption is higher in winter and summer, multiplying by a preset coefficient can more easily detect whether there is electricity stealing behavior. For example, a user who steals electricity usually consumes 10° per month, but in winter and summer, the electricity consumption may be 50°. If no special processing is performed, it is difficult to detect abnormal electricity consumption. The actual influence model for processing electricity consumption can be selected according to requirements, and the present application does not make specific limitations. Then, through the api interface, the electricity consumption of the 10 users in January is obtained, 10 binary trees are established, the electricity consumption of the 10 users in January is placed in the tree nodes of the 10 binary trees, and the electricity consumption of the 10 users in months 2-9 is obtained through the api interface in turn, and the electricity consumption of the 10 users in months 2-9 is placed in the data stack in the order from the bottom of the ring ratio data stack, and the average temperature data of months 2-9 is obtained at the same time. When it is necessary to investigate whether the 10 users have electricity stealing behavior, only the binary tree corresponding to each user needs to be found, the binary tree is traversed to obtain the electricity consumption data in January and the corresponding electricity consumption data in months 2-9, and the influence model is combined with the average temperature data to process the electricity consumption data in months 2-9, and based on the processed electricity consumption data, whether the user has electricity stealing behavior is investigated. Compared with the prior art, the efficiency and accuracy of the investigation are greatly improved.

[0070] Among them, the step 1 and the step 3 both further include: monitoring and obtaining the acquisition rate of the api interface, when the acquisition rate exceeds a preset threshold, the api interface is limited.

[0071] Rate limiting is a process of limiting the number of requests that an API can handle, for example, an API receives 100 requests per second from a single user, and after rate limiting, it receives 50 requests per second from a single user. The reason for rate limiting the api interface is that ignoring rate limiting may cause problems such as execution operation and DDos attack, cascading failure and resource scarcity. Therefore, when it is monitored that the acquisition rate of the api interface exceeds the preset threshold, the api interface needs to be limited.

[0072] The api interface is limited by using a leaky bucket algorithm or a token bucket algorithm.

[0073] The principle of the leaky bucket algorithm is that the request first enters the leaky bucket, the leaky bucket discharges water at a fixed rate, that is, processes the request, and when the water is added too fast, it will overflow, that is, reject the request. It can be seen that the leaky bucket algorithm can forcibly limit the data transmission rate, and the algorithm can well solve the problem of not smooth enough time boundary processing, because the "leaky water" operation will be performed before each request enters the bucket, and there is no boundary problem. The principle of the token bucket algorithm is that the system will put tokens into the bucket at a constant rate, and if the request needs to be processed, it needs to get a token from the bucket first, and when there is no token available in the bucket, it will refuse service. The token bucket algorithm is the most commonly used algorithm in network traffic shaping and rate limiting. A fixed-size token bucket can continuously generate tokens at a constant rate. If the tokens are not consumed or consumed at a slower rate than generated, the tokens will continue to increase until the bucket is full, and the last generated token will overflow from the bucket. The maximum number of tokens that can be saved in the bucket will never exceed the size of the bucket. For api interface rate limiting, the leaky bucket algorithm or the token bucket algorithm can be selected, and the present application does not make specific limitations.

[0074] The step 1 and the step 3 both further include: based on the acquisition rate of the api interface, counting the data amount of the api interface acquisition data in a preset time period, and based on the data amount and the CPU of the server, adjusting the preset threshold.

[0075] Because the CPU of the server also processes other threads, if the acquisition rate and the preset threshold are always kept unchanged, the server performance may be affected, and the availability of the underlying framework is also affected. Therefore, based on the counted data amount and the CPU of the server, the preset threshold needs to be dynamically adjusted, so that the api interface can acquire data at the best rate while not reducing the availability and reliability of the underlying framework.

[0076] The visualization component can be an indicator card, a line chart, or a column chart, etc. The present application embodiment takes the indicator card as an example to introduce the visualization component. The indicator card is the most common component of data, which generally provides core indicators. The indicator card usually needs to have a comparison dimension, such as time comparison, including same period comparison, and also like stock comparison, or comparison of sub-indicators of the indicator itself. The application of the indicator card can refer to Figures 3-5 Figure 3 In the category id is the category number, id is the number, price is the price, stock is the stock, create time is the creation time, Figures 3-4 is the corresponding selection and input interface in the indicator card, Figure 5 ​For the display output interface of the index card, Figure 5 The ring ratio case is exemplified, and the same ratio case can be processed in the same way.

[0077] Embodiment two

[0078] Please refer to Figure 2 , Figure 2 It is a system composition schematic diagram for realizing data ring ratio based on a visual api interface in the application, and the system comprises:

[0079] A first acquisition unit is configured to obtain a data request requiring ring ratio, and based on the request, acquire first result data through a preset api interface;

[0080] A binary tree unit is configured to create a binary tree, store the first result data in a parent node of the binary tree, establish a ring ratio data stack in a first child node of the binary tree, and establish a same ratio data stack in a second child node of the binary tree;

[0081] A second acquisition unit is configured to acquire a plurality of second result data through the api interface according to a first preset frequency based on the data request;

[0082] A storage unit is configured to store all the second result data to the ring ratio data stack or the same ratio data stack based on the first preset frequency;

[0083] A visualization unit is configured to traverse the parent node and the first child node, acquire ring ratio result data, acquire ring ratio data corresponding to the ring ratio result data based on the second result data, put the ring ratio result data and the ring ratio data into a preset visualization component for rendering, realize ring ratio visualization of the first result data, traverse the parent node and the second child node, acquire same ratio result data, acquire same ratio data corresponding to the same ratio result data based on the second result data, put the same ratio result data and the same ratio data into the preset visualization component for rendering, and realize same ratio visualization of the first result data.

[0084] Although the preferred embodiments of the present application have been described, those skilled in the art can make further changes and modifications to the embodiments once they know the basic inventive concept. Therefore, the appended claims are intended to be interpreted as including all the preferred embodiments and all the changes and modifications falling within the scope of the present application.

[0085] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and equivalent technologies thereof, the present application is also intended to include these modifications and variations.

Claims

1. A method for implementing data year-on-year comparison based on a visualization API interface, characterized in that, The method comprises: Step 1: obtaining a data request requiring same-period comparison, and obtaining first result data based on the data request through a preset api interface; Step 2: creating a binary tree, storing the first result data in a parent node of the binary tree, establishing a same-period comparison data stack in a first child node of the binary tree, and establishing a same-period comparison data stack in a second child node of the binary tree; Step 3: obtaining a plurality of second result data based on the data request through the api interface according to a first preset frequency; Step 4: storing all second result data into the same-period comparison data stack or the same-period comparison data stack based on the first preset frequency, and the direction of all second result data entering the same-period comparison data stack or the same-period comparison data stack is from the bottom of the stack to the top of the stack; Step 5: traversing the parent node and the first child node to obtain same-period comparison result data, obtaining same-period comparison data corresponding to the same-period comparison result data based on the second result data, putting the same-period comparison result data and the same-period comparison data into a preset visualization component for rendering to realize same-period comparison visualization of the first result data; and traversing the parent node and the second child node to obtain same-period comparison result data, obtaining same-period comparison data corresponding to the same-period comparison result data based on the second result data, and putting the same-period comparison result data and the same-period comparison data into the preset visualization component for rendering to realize same-period comparison visualization of the first result data; Wherein, the way to obtain corresponding same-period comparison data is: based on the first child node, obtaining the same-period comparison data stack, and the direction of sequentially obtaining corresponding same-period comparison data from the same-period comparison data stack is from the top of the stack to the bottom of the stack; The way to obtain corresponding same-period comparison data is: based on the second child node, obtaining the same-period comparison data stack, and the direction of sequentially obtaining corresponding same-period comparison data from the same-period comparison data stack is from the top of the stack to the bottom of the stack.

2. The method for realizing data same period comparison based on a visualization API interface according to claim 1, characterized in that, Storing all second result data into the same-period comparison data stack or the same-period comparison data stack comprises: obtaining the acquisition time of all second result data, and sequentially storing all second result data into the same-period comparison data stack or the same-period comparison data stack in the order from the earliest to the latest according to the acquisition time.

3. The method for realizing data same period comparison based on a visualization API interface according to claim 1, characterized in that, The step 1 specifically comprises: obtaining a data request requiring same-period comparison, obtaining weather history data and power history data of a plurality of users in a preset time period based on the data request, establishing and training an influence model of weather data on power data corresponding to each user based on the weather history data and the power history data, and obtaining first power data of all users in a preset month through a preset api interface; The step 2 specifically comprises: creating a plurality of binary trees, storing all first power data into parent nodes of different binary trees, establishing a same-period comparison data stack in a first child node of the binary tree, and establishing a same-period comparison data stack in a second child node of the binary tree; The step 3 specifically comprises: obtaining a plurality of second power data based on the data request through the api interface according to a first preset frequency; The step 4 is specifically: based on the first preset frequency, storing all second electric quantity data to the same period data stack or the same period data stack; obtaining first weather data of each month in a corresponding time period of the first electric quantity data and the second electric quantity data; The step 5 is specifically: traversing the parent node and the first child node to obtain the same period result electric quantity data corresponding to the first electric quantity data, and obtaining the same period electric quantity data corresponding to the same period result electric quantity data based on the second electric quantity data; traversing the parent node and the second child node to obtain the same period result electric quantity data corresponding to the first electric quantity data, and obtaining the same period electric quantity data corresponding to the same period result electric quantity data based on the second electric quantity data; Based on the same period electric quantity data, the same period electric quantity data, the first weather data and the influence model, it is judged whether the corresponding user has electricity stealing behavior, if yes, electricity stealing warning is carried out.

4. The method for realizing data same period comparison based on a visualization API interface according to claim 1, characterized in that, The step 1 and the step 3 both further include: monitoring and obtaining the acquisition rate of the api interface, and when the acquisition rate exceeds a preset threshold, the api interface is limited.

5. The method for realizing data same period comparison based on a visualization API interface according to claim 4, characterized in that, The api interface is limited by using leak bucket algorithm or token bucket algorithm.

6. The method for realizing data same period comparison based on a visualization API interface according to claim 4, characterized in that, The step 1 and the step 3 both further include: based on the acquisition rate of the api interface, the data amount of api interface acquisition data in a preset time period is counted, and based on the data amount and server CPU, the preset threshold is adjusted.

7. A system for implementing data year-over-year based on a visualization API interface, the system comprising: a data source; a data processing module; a data visualization module; and a data storage module. The system comprises: A first acquisition unit is configured to obtain a data request requiring same period comparison, and obtain first result data through a preset api interface based on the request; A binary tree unit is configured to create a binary tree, store the first result data in a parent node of the binary tree, establish a same period data stack in a first child node of the binary tree, and establish a same period data stack in a second child node of the binary tree; A second acquisition unit is configured to obtain a plurality of second result data through the api interface according to a first preset frequency based on the data request; A storage unit is configured to store all second result data to the same period data stack or the same period data stack based on the first preset frequency, and the direction of all second result data entering the same period data stack or the same period data stack is from the bottom of the stack to the top of the stack; A visualization unit is configured to traverse the parent node and the first child node to obtain same period result data, obtain same period data corresponding to the same period result data based on the second result data, put the same period result data and the same period data into a preset visualization component for rendering to realize same period visualization of the first result data; and traverse the parent node and the second child node to obtain same period result data, obtain same period data corresponding to the same period result data based on the second result data, put the same period result data and the same period data into the preset visualization component for rendering to realize same period visualization of the first result data. The method comprises the steps that: based on the first child node, the same period data stack is obtained, and the direction of sequentially obtaining corresponding same period data from the same period data stack is from the top of the stack to the bottom of the stack. The corresponding same period data is obtained in the following manner: based on the second sub-node, the same period data stack is obtained, and the direction in which the corresponding same period data is sequentially obtained from the same period data stack is from the top of the stack to the bottom of the stack.

Citation Information

Patent Citations

  • Year-to-year rate and month-to-month rate calculation method based on time dimension

    CN104991964A

  • Method and device for obtaining visual configuration for data query

    CN114185929A