Data storage method, data query method, computer device and medium

By constructing a data table and using the data difference within a unit of time to determine the existence of target data, the problem of low query efficiency in security equipment is solved, and fast and accurate data query is achieved.

CN117076446BActive Publication Date: 2026-05-08ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG DAHUA TECH CO LTD
Filing Date
2023-07-31
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing security equipment cannot quickly determine whether target data exists within a target time period, resulting in low query efficiency.

Method used

By acquiring the data to be processed, a data table is constructed based on type and time parameters. The existence of the target data is determined by the data difference within a unit of time. The data table is then updated to ensure that the difference is not zero, thus enabling fast querying.

Benefits of technology

It enables quick and efficient determination of whether target data exists within a target time period without querying the original data, thus improving query efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117076446B_ABST
    Figure CN117076446B_ABST
Patent Text Reader

Abstract

The application relates to a data storage method, a data query method, a computer device and a medium, and the method comprises the following steps: obtaining first to-be-processed data; wherein the first to-be-processed data comprises a first type parameter, a first time parameter and first target data; based on the first type parameter, a first data table corresponding to the first target data is determined; wherein the difference between each adjacent data is used to determine whether the first target data exists in the first unit time; the first unit time is a preset minimum statistical time; based on the first to-be-processed data, a second time is determined; and the first data table is updated so that the difference between the first data and the adjacent second data in the first data table is not zero. Through the application, the technical problem that the target data in the target time cannot be quickly determined is solved, and the technical effect that the target data in the target time is quickly and efficiently determined is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information processing technology, and in particular to a data storage method, a data query method, a computer device, and a medium. Background Technology

[0002] The main equipment in the security field consists of front-end bullet cameras and PTZ cameras, as well as back-end devices such as DVRs, NVRs, and HDVRs. Due to the diverse needs for detection scenarios and data statistics, there are many types of intelligent front-end cameras, including but not limited to those with intelligent functions such as people counting, area people counting, queue counting, heatmaps, and video structuring. These cameras can count the number of people appearing in the frame or within a designated area, or provide video structuring information. Due to cost or size limitations, camera storage capacity is limited, making it difficult to store large amounts of data. Generally, the front-end is connected to back-end devices such as NVRs or platforms, and the front-end sends statistical data to the back-end devices or platforms for long-term data storage and management.

[0003] Taking an NVR device as an example, the device has multiple GUI query pages for displaying statistical data. On these pages, users set query conditions and perform queries. The device then retrieves data from its local database and displays the results graphically. Query conditions typically require specifying a start and end time range, and the UI displays the results sequentially along a timeline. Users usually have to wait for the query results to appear before they know if there is data based on the specified conditions. If the query results are empty, the query based on the selected conditions is invalid, wasting the user's time. Furthermore, if there are long periods without data within the query time range, the effective data area on the query result graph is small, which is also not conducive to data observation.

[0004] There is currently no effective solution to the technical problem that the relevant technologies cannot quickly determine whether target data exists within a target time period. Summary of the Invention

[0005] Therefore, it is necessary to provide a data storage method, data query method, computer equipment, and medium that can quickly and efficiently determine whether target data exists within a target time period, addressing the aforementioned technical problems.

[0006] This application provides a data storage method, the method comprising:

[0007] Obtain first data to be processed; wherein the first data to be processed includes a first type parameter, a first time parameter, and first target data; based on the first type parameter, determine a first data table corresponding to the first target data; wherein the data in the first data table is stored in order according to a first unit time, and the difference between each adjacent data is used to determine whether the first target data exists within the first unit time; the first unit time is a preset minimum statistical time; based on the first time parameter, determine a first target time; wherein the first target time is the minimum statistical time within the time period corresponding to the first time parameter during which the first target data was received; update the first data table so that the difference between the first data and the second data in the first data table is not zero; wherein the first data is the data corresponding to the first target time; the second data is the data adjacent to the first data.

[0008] In some embodiments, before determining the first data table corresponding to the first target data based on the first type parameter, the method further includes: determining whether the first data table exists based on the first type parameter; if the first data table exists, determining the first target time based on the first data to be processed; if the first data table does not exist, constructing the first data table corresponding to the first type parameter according to the first unit time.

[0009] In some of these embodiments, the first type of parameter includes: online channel number, region ID, and processing rule.

[0010] In some embodiments, the step of constructing the first data table corresponding to the first type parameter according to the first unit time if the first data table does not exist includes: creating the first data table corresponding to the first type parameter according to the first unit time; and initializing the first data table.

[0011] In some embodiments, the first data to be processed includes historical data to be processed; obtaining the first data to be processed includes obtaining the historical data to be processed; after determining the first target time based on the first data to be processed, the method further includes determining whether the historical data to be processed has been completely received; wherein the historical data to be processed is data before the front end goes online; if the historical data to be processed has been completely received, the first data table is updated so that the difference between the first data and the second data in the first data table is not zero.

[0012] In some embodiments, the step of updating the first data table if all historical data to be processed in the first data table has been received, so that the difference between the first data and the second data in the first data table is not zero, includes: updating the first data table in reverse chronological order if all historical data to be processed in the first data table has been received, so that the difference between the first data and the second data in the first data table is not zero.

[0013] In some embodiments, the method further includes: if historical data in the first data table has not been completely received, updating the first data table based on the first target data, wherein the first data is a first identifier; wherein the first identifier is used to indicate that the first target data exists within a first unit time period corresponding to the data.

[0014] In some embodiments, the first data to be processed includes real-time data to be processed; the second data is the data preceding the first data; obtaining the first data to be processed includes: obtaining the real-time data to be processed; the time period corresponding to the first time parameter also includes a third time, the third time being any moment within the minimum statistical time during which the first target data has not been received; before updating the first data table, before the difference between the first data and the second data is not zero, the method further includes: updating the difference between the third data corresponding to the third time and its preceding data in the first data table to zero.

[0015] This application also provides a data query method, characterized in that the method includes: a query condition acquisition step: acquiring a first query condition; wherein the first query condition includes a second type parameter and a second time parameter; the first query condition is used to determine second target data; a data table determination step: determining a first data table based on the second type parameter; wherein the data in the first data table is stored in a first unit time order, and the difference between each adjacent data is used to determine whether the second target data exists within the first unit time; the first unit time is a preset minimum statistical time; a statistical data determination step: determining a first statistical data in the first data table, within the time period corresponding to the second time parameter, whether the second target data exists within each second unit time; wherein the second unit time is the statistical unit time in the first statistical data.

[0016] In some embodiments, determining whether the second target data exists in the first data table within each second unit time period corresponding to the second time parameter includes: obtaining third and fourth data within each second unit time period in the first data table, and determining whether the difference between the third data and the fourth data is zero; wherein the third data is the data corresponding to the first first unit time period within the second unit time period; the fourth data is the data corresponding to the last first unit time period within the second unit time period; if the difference between the third data and the fourth data is not zero, then the second target data exists within the second unit time period; if the difference between the third data and the fourth data is zero, then the second target data does not exist within the second unit time period.

[0017] In some embodiments, the method further includes: a modification step, modifying the first query condition to a second query condition based on the first statistical data; wherein the second query condition includes a second type parameter and a third time parameter; the time period corresponding to the third time parameter is included within the time period corresponding to the second time parameter; repeating the query condition acquisition step, the data table determination step, and the statistical data determination step to determine the second statistical data.

[0018] In some embodiments, the method further includes: querying a first database to obtain the second target data based on the second query condition; wherein the first database stores the second target data.

[0019] This application also provides a computer device, including a memory and a processor, characterized in that the memory stores a computer program, and the processor is configured to run the computer program to perform the method described in any of the above-described embodiments.

[0020] This application also provides a computer-readable storage medium having a computer program stored thereon, characterized in that the computer program, when executed by a processor, implements the steps of the method described in any of the above claims.

[0021] Compared with related technologies, the data storage method provided in this embodiment solves the technical problem of not being able to quickly determine whether there is target data within a target time, by acquiring first data to be processed, wherein the first data to be processed includes a first type parameter, a first time parameter, and first target data; determining a first data table corresponding to the first target data based on the first type parameter; wherein the data in the first data table is stored in a first unit time order, and the difference between each adjacent data is used to determine whether the first target data exists within the first unit time; the first unit time is a preset minimum statistical time; determining a first target time based on the first data to be processed; wherein the first target time is the minimum statistical time within the time period corresponding to the first time parameter during which the first target data was received; updating the first data table so that the difference between the first data and the second data in the first data table is not zero; wherein the first data is the data corresponding to the first target time; and the second data is the data adjacent to the first data. This method solves the technical problem of not being able to quickly determine whether there is target data within a target time, and achieves the technical effect of quickly and efficiently determining whether there is target data within a target time.

[0022] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description

[0023] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0024] Figure 1 This is a hardware structure block diagram of a terminal for a data storage method.

[0025] Figure 2 A flowchart illustrating a data storage method;

[0026] Figure 3 A flowchart illustrating another data storage method;

[0027] Figure 4 A flowchart illustrating the initialization of a first data table is shown.

[0028] Figure 5 This is a flowchart illustrating a first type of data table update process;

[0029] Figure 6 This is a structural block diagram of a data storage device.

[0030] Figure 7 A computer device is shown.

[0031] Figure 8 This is a flowchart illustrating a data query method;

[0032] Figure 9 This is a schematic diagram of a client-side search interface.

[0033] Figure 10 This is a schematic diagram of another client-side search interface.

[0034] Figure 11 A flowchart illustrating another data query method;

[0035] Figure 12 This is a schematic diagram of another client-side search interface.

[0036] Figure 13 This is another data query method shown;

[0037] Figure 14 This is a structural block diagram of a data query processing device. Detailed Implementation

[0038] To better understand the purpose, technical solution, and advantages of this application, the application is described and illustrated below in conjunction with the accompanying drawings and embodiments.

[0039] Unless otherwise defined, the technical or scientific terms used in this application shall have the general meaning as understood by one of ordinary skill in the art to which this application pertains. Words such as “a,” “an,” “an,” “the,” “the,” and “these,” used in this application, do not indicate quantitative limitation and may be singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or modules (units) is not limited to the listed steps or modules (units) but may include steps or modules (units) not listed, or may include other steps or modules (units) inherent to such processes, methods, products, or devices. The terms “connected,” “linked,” and “coupled,” used in this application, are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. The term “multiple” used in this application refers to two or more. The "and / or" operator describes the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: A alone, A and B simultaneously, and B alone. Typically, the character " / " indicates that the objects before and after it are in an "or" relationship. The terms "first," "second," and "third," etc., used in this application are merely for distinguishing similar objects and do not represent a specific ordering of the objects.

[0040] The method embodiments provided in this example can be executed on a terminal, computer, or similar computing device. For example, it can run on a terminal. Figure 1 This is a hardware structure block diagram of a terminal for a data processing method according to this embodiment. For example... Figure 1 As shown, a terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 and a memory 104 for storing data are also included. The processor 102 may be, but is not limited to, a microprocessor (MCU) or a programmable logic device (FPGA). The terminal may also include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that… Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the terminal described above. For example, the terminal may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown are illustrated.

[0041] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to a data storage method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the aforementioned method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0042] The transmission device 106 is used to receive or send data via a network. This network includes a wireless network provided by the terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 can be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0043] In practical applications, the aforementioned terminal can be a network video recorder (NVR). A network video recorder is an important terminal device in a video surveillance system, possessing functions such as monitoring management, storage, and human-computer interaction.

[0044] In one embodiment shown, this embodiment provides a data storage method, the method comprising:

[0045] Obtain first data to be processed; wherein the first data to be processed includes a first type parameter, a first time parameter, and first target data; based on the first type parameter, determine a first data table corresponding to the first target data; wherein the data in the first data table is stored in order according to a first unit time, and the difference between each adjacent data is used to determine whether the first target data exists within the first unit time; the first unit time is a preset minimum statistical time; based on the first data to be processed, determine a first target time; wherein the first target time is the minimum statistical time within the time period corresponding to the first time parameter in the first data table where the first target data was received; update the first data table so that the difference between the first data and the second data in the first data table is not zero; wherein the first data is the data corresponding to the first target time; the second data is the data adjacent to the first data.

[0046] Using the above method, a first data table is maintained for each type parameter to count whether target data exists within the first unit of time. Based on the first data table, by calculating whether the difference between data corresponding to adjacent unit time is zero, it can be quickly determined whether target data exists within the first unit of time. This solves the problem in the prior art that it is necessary to access the original data stored in the database to determine whether target data exists within the target time period. Since the amount of original data is large, this avoids the technical problems of slow query speed and low query efficiency caused by querying the original data. It achieves the technical effect of quickly and efficiently determining whether target data exists within the target time period by accessing the first data table without querying the original data.

[0047] In another embodiment shown, this embodiment provides a data storage method, please refer to [link to relevant documentation]. Figure 2 , Figure 2 This is a flowchart illustrating a data processing method in this embodiment.

[0048] like Figure 2 As shown, the process includes the following steps:

[0049] S201, Obtain the first data to be processed.

[0050] The first data to be processed includes a first type parameter, a first time parameter, and a first target data.

[0051] The first type of parameter can determine the storage location of the first data to be processed. For example, the first type of parameter can determine the first data table used to store the data to be processed.

[0052] In practical applications, the first type of parameter can be the online channel number, the region ID, and the processing rule.

[0053] The online channel number refers to the wiring harness terminal number of the camera device connected to the NVR. Each device has a unique channel number. For example, the online channel number corresponding to camera A is A, and the online channel number corresponding to camera B is B. If you want to process the data recorded by camera A, you can select the data with channel number A.

[0054] In practical applications, it is necessary to perform statistical analysis on different regions within the same video recording data. Therefore, the region ID is used to select different statistical regions. For example, taking the recording data from camera A as an example, different regions such as region A, region B, and region C can be selected for target data analysis. The first type parameter corresponding to the data to be processed obtained from region A can be that the online channel number is A and the data type is region A; similarly, the first type parameter corresponding to the data to be processed obtained from region B can be that the online channel number is A and the data type is region B.

[0055] In practical applications, dividing the area into different regions to obtain the data to be processed is often to divide the observation area of ​​camera A into key areas for better and more detailed observation. The specific division criteria can be set by the user according to the actual situation. This application embodiment will not provide any further explanation in this regard.

[0056] The first time parameter can be the parameter corresponding to the time period in which the first data to be processed was generated. For example, continuing with camera A, when camera A records data to be processed from 09:00:00 on January 29, 2023 to 09:00:00 on January 30, 2023, the time parameter of the first data to be processed is from 09:00:00 on January 29, 2023 to 09:00:00 on January 30, 2023.

[0057] The first target data can be the data that needs to be stored in the first data to be processed. For example, continuing with the previous embodiment, the first data to be processed is the population statistics in region A during the time period from 09:00:00 on January 29, 2023 to 09:00:00 on January 30, 2023. During the above time period, there are cases where the population in region A is 0 and cases where the population is not 0. When the population in region A is not 0, it can be understood that the first target data exists during that time period. In other words, when there is statistical data in a certain time period, it can be understood that the first target data exists during that time period.

[0058] In practical applications, the first data to be processed can be the data recorded by camera A during the period from 09:00:00 on January 29, 2023 to 09:00:00 on January 30, 2023. When camera A sends the first data to be processed to the NVR for storage, the NVR can obtain the first data to be processed.

[0059] S202, based on the first type parameter, determine the first data table corresponding to the first target data.

[0060] The data in the first data table is stored in the order of the first unit time, and the difference between each adjacent data is used to determine whether the first target data exists within the first unit time; the first unit time is the preset minimum statistical time.

[0061] The first unit of time can be hourly, daily, monthly, quarterly, or yearly, and this application does not limit this. The specific settings can be configured according to the user's actual needs. In practical applications, in order to facilitate the adaptation to different statistical reports, the first unit of time is usually processed as hourly.

[0062] When the first unit of time is one hour, the first data table can be a statistical table that counts whether the first target data exists, with the hour as the statistical unit. Furthermore, the difference between each adjacent data can also be used to determine whether the first target data exists within the first unit of time.

[0063] In another embodiment, before determining the first data table corresponding to the first target data based on the first type parameter, the method further includes: determining whether the first data table exists based on the first type parameter; if the first data table exists, determining the first target time based on the first data to be processed; if the first data table does not exist, constructing the first data table corresponding to the first type parameter according to the first unit time.

[0064] Wherein, the first target time is the minimum statistical time within the time period corresponding to the first time parameter during which the first target data was received.

[0065] For example, see Figure 3 , Figure 3 This is a flowchart illustrating another data storage method in this embodiment. For example... Figure 3 As shown, the above method includes:

[0066] S301, Obtain the first data to be processed.

[0067] S302, based on the first type parameter, determine whether the first data table exists. If the first data table exists, proceed to S303; if the first data table does not exist, proceed to S304.

[0068] S303, based on the first data to be processed, determine the first target time.

[0069] S304, construct a first data table corresponding to the first type parameter according to the first unit time.

[0070] In practical applications, when creating a new data table based on the first type parameter, a new data table can be created that uniquely corresponds to the first type parameter according to the online channel number, region ID and processing rules in the first data to be processed.

[0071] For example, when the first type parameter in the first data to be processed is the online channel number is A, the region ID is 1, and the processing rule is the number of people, the newly created first data table is the first data table with the online channel number A, the region ID is 1, and the processing rule is the number of people.

[0072] When the first type parameter of the first data to be processed is at least one online channel number, and / or at least one region ID, and / or at least one processing rule, it is necessary to create a first data table corresponding to the first type parameter.

[0073] For example, when the online channel number is A or B, the region ID is 1 or 2, and the processing rules are people counting and people staying for more than 5 seconds, the following first data tables need to be created respectively:

[0074] The first data table with channel number A, region ID 1, and processing rule of personnel statistics;

[0075] The first data table is for statistics on the number of people who stayed for more than 5 seconds after going online, with channel number A, region ID 1, and processing rule A.

[0076] The online channel number is A, the region ID is 2, and the processing rule is the first data table of the number of people statistics;

[0077] The online channel number is A, the region ID is 2, and the processing rule is to count the number of people who stay for more than 5 seconds in the first data table.

[0078]

[0079] The online channel number is B, the region ID is 2, and the processing rule is the first data table of the number of people statistics.

[0080] The online channel number is B, the region ID is 2, and the processing rule is to count the number of people who stay for more than 5 seconds in the first data table.

[0081] Optionally, when creating the first data table, if there is only one type parameter for the first data to be processed, and all types of values ​​for the type parameter are known, the first data table corresponding to the first type parameter can be created simultaneously with other types of values ​​for the type parameter.

[0082] Optionally, before the online channel A connects to the NVR for the first time and performs data synchronization, i.e. before obtaining the first data to be processed, a corresponding first data table can be pre-created for each region ID in the connected online channel. This application does not impose any other restrictions on this.

[0083] In another embodiment shown, if the first data table does not exist, a first data table corresponding to the first type parameter is constructed according to a first unit time, including: creating a new first data table corresponding to the first type parameter according to a first unit time; and initializing the first data table.

[0084] In practical applications, the first data table can be initialized based on the online channel number, region ID, front-end online time, earliest time of data to be recorded, historical data length, minimum unit time, and array.

[0085] Among them, the online channel number is the local channel number where the online front-end is located;

[0086] The region ID is the type information represented in the first data table of the record, and can be set to an enumerated value in practical applications;

[0087] The historical data length is a preset time period for acquiring historical data, for example, 7 days, i.e., historical data length T. history =7 days;

[0088] The front-end launch time is the exact time on the hour. For example, if the front-end launch time is 15:26:29 on October 28, 2022, the front-end launch time is the exact time on the hour (T). on = 15:00:00 on October 28, 2022;

[0089] The minimum unit of time is the smallest granularity used in the first data table to count the presence or absence of target data; for example, when the minimum unit of time is 1 hour, that is, the first unit of time T... scale = 1 hour;

[0090] The earliest time to record data refers to the earliest time of historical data, i.e., the earliest time T to record data. start =T on -T history Continuing with the previous embodiment, T start = October 28, 2022, 15:00:00 - 7 days = October 21, 2022, 15:00:00;

[0091] The array is used to determine whether there is target data in a certain first unit of time. Specifically, it can be determined whether there is target data in the first unit of time by calculating whether the difference between adjacent data is zero. For example, it can be determined whether there is target data in the smallest unit of time corresponding to the nth data in the array by calculating whether data[n+1] – data[n] is 0.

[0092] For example, see Figure 4 , Figure 4 This is a flowchart illustrating the initialization of a first data table in this embodiment. Figure 4 As shown, the steps for initializing the first data table include:

[0093] S401, Obtain the first data to be processed.

[0094] The data to be processed can be historical data or real-time data; this embodiment does not impose any other restrictions on this.

[0095] S402 initializes the first data table based on the online channel number, region ID, front-end online time, earliest time of data to be recorded, historical data length, minimum unit time, and array.

[0096] In practical applications, when the first data to be processed is historical data, the length of the historical data can be determined based on the earliest time of the historical data; furthermore, the location information of the data group corresponding to the first unit time of the historical data in the first data table can be determined.

[0097] When the first data to be processed is real-time data, the starting position of the data group corresponding to the first unit of time in the first data table can be determined based on the real-time data. The starting position refers to the position in the first data table where real-time data updates are performed.

[0098] For example, taking Table 1 as an example of a first data table, please refer to Table 1, which is a first data table shown in this embodiment. As shown in Table 1, the first data table includes subscripts, arrays, and time information.

[0099] The subscript is used to indicate the order of the first unit of time. For example, subscript 0 indicates the 0th first unit of time; subscript 1 indicates the first first unit of time.

[0100] An array consisting of multiple data points based on their corresponding first unit of time (which can be represented by T). scale The data is arranged in order, and the presence of the first target data in the first unit of time can be determined by whether the difference between adjacent data is zero.

[0101] Time information is used to record the start time of historical data and the start time of real-time data. For example, the field T can be used. start This indicates the start time of historical data; the field T can be used. on Indicates the start time of real-time data.

[0102] In practical applications, since N = T history / T scale (where T) history (This refers to the length of historical data). The initial array length is typically set to 2N+1 because 2N differences are needed to represent whether data exists in 2N time periods; therefore, its length needs to be 2N+1 (generally, T...). history The time period is long enough to ensure that all historical data can be retrieved.

[0103] It's important to note that the specific values ​​of the data in the array have no inherent meaning. What matters are the differences between the data corresponding to different indices. For example, the difference between adjacent data points represents the difference between the previous T. scale Does the data exist within a time period? The difference between data corresponding to multiple subscripts represents multiple T. scale Is there any data inside?

[0104] Table 1

[0105] Subscript 0 1 2 … N-1 N N+1 … 2N array 0 0 0 0 0 0 0 0 0 time <![CDATA[T start ]]> <![CDATA[T on ]]>

[0106] Specifically, initializing the first data table includes:

[0107] Acquire historical data, determine the length of the historical data based on the historical data, and then apply N=T. history / T scale Calculate the length of the historical data in the first data table; where N represents the length of the historical data in the array.

[0108] Let the initial array length in the first data table be 2N+1, and set each data to 0 (where 0 indicates that there is no data in the corresponding unit of time).

[0109] It should be noted that the subscript [0, N-1] corresponds to historical data information, while the subscripts after N correspond to real-time data information.

[0110] Determine the front-end launch time at the top of the hour (i.e., T). onThe indexes for ) and the indexes for the start time of statistics (i.e., T) start ); where T start =T on -T history This completes the initialization of the first data table. Please refer to Table 2 for the initialized first data table.

[0111] Table 2

[0112] Subscript 0 1 2 … N-1 N N+1 … 2N array 0 0 0 0 0 0 0 0 0 time <![CDATA[T start ]]> <![CDATA[T on ]]>

[0113] S203, based on the first data to be processed, determine the first target time.

[0114] Wherein, the first target time is the minimum statistical time within the time period corresponding to the first time parameter when the first target data is received; the minimum statistical time can be the first unit time.

[0115] For example, please refer to Table 3. Table 3 shows a first type of data to be processed in this embodiment. As shown in Table 3, the first data to be processed records target data for 5 first unit time periods, and there is target data only in the 3rd first unit time period (denoted as 1), while there is no target data in the other 4 first unit time periods (denoted as 0).

[0116] Table 3

[0117] Unit time sequence 1 2 3 4 5 Is there target data? 0 0 1 0 0

[0118] According to Table 3, the target data is only present in the third first unit time in the first data to be processed. Therefore, the time corresponding to the third first unit time is the second time.

[0119] S204, Update the first data table so that the difference between the first data and the second data in the first data table is not zero.

[0120] In practical applications, when updating the corresponding array in the first data table based on the first data to be processed, it is necessary to first divide the first data to be processed according to the first unit time, determine the correspondence between each first unit time in the first data to be processed and the first data in the first data table, and then update the corresponding data in the first data table based on whether the first target data exists in the first unit time in the first data to be processed.

[0121] In practical applications, when the start time of a certain first unit of time arrives, let the index of the first unit of time in the array be index. We need to set data[index+1] to the value of data[index], indicating that no first data to be processed has been received at the start time represented by index.

[0122] It should be noted that the first unit time in the first data to be processed can correspond to the unit time of the data with index 1 in the first data table, or it can correspond to the unit time of the data with index 8 in the first data table. The specific situation should be determined according to the first data parameter corresponding to the first data to be processed. This embodiment will not provide any further explanation.

[0123] For example, please refer to Table 4, which is a first data table shown in this embodiment. As shown in Table 4, taking the first unit time corresponding to the array element with index 2 as the first time as an example, that is, there is first target data in the first unit time corresponding to index 2 in Table 3.

[0124] Table 4

[0125] Subscript 1 2 3 array

[0126] It is possible to update the difference between the data at index 1 and index 2 to be non-zero, or to update the difference between the data at index 2 and index 3 to be non-zero. In this embodiment, no other restrictions are placed on adjacent data. The specific choice should be made according to the actual needs.

[0127] It is important to note that when defining adjacency as either adjacent to the data to the left or adjacent to the data to the right, consistency should be maintained.

[0128] In another embodiment shown, the first data to be processed includes historical data to be processed; obtaining the first data to be processed includes: obtaining historical data to be processed; after determining a first target time based on the first data to be processed, the above method further includes:

[0129] Determine whether all historical pending data has been received; historical pending data refers to data from before the front-end went live.

[0130] If all historical data to be processed has been received, then update the first data table so that the difference between the first data and the second data in the first data table is not zero.

[0131] Upon receiving the data to be processed, based on the time T in the data to be processed... data Calculate T data The index in the array of the first data table:

[0132] n index =(T data -T start ) / T scale ;

[0133] For ease of explanation regarding the current first unit time in the first data table, it is referred to as "index" here; in the embodiments below, "index" also represents the current first unit time in the first data table, and will not be explained separately thereafter.

[0134] Based on the calculated index of the data to be processed, update the data corresponding to that index.

[0135] When historical data is retrieved, since the historical data is queried in chronological order, the earlier historical data is usually received first, that is, the data from 0 to N-1 is updated.

[0136] In practical applications, when the first data to be processed is historical data, after acquiring the historical data, it is necessary to determine whether all historical data has been received. If all historical data has been received, the data in the first data table that records whether or not the first target data exists can be updated based on the received historical data. Specifically, the difference between the first data and the second data in the first data table can be updated to ensure it is not zero.

[0137] In another embodiment shown, the method further includes: if historical data in the first data table has not been fully received, then updating the first data table based on the first target data, wherein the first data is a first identifier; wherein the first identifier is used to indicate that there is first target data within a first unit time period corresponding to the data.

[0138] In practical applications, the first identifier can be 1. Before all historical data is received, the update rule for the first data table can be: T data The data corresponding to the first unit of time is set to 1, that is, data[index] = 1 indicates that there is data; correspondingly, in the index range of [0, N-1], 0 indicates that there is no first target data in the corresponding time period.

[0139] It should be noted that the first identifier being 1 is merely an example in this embodiment. In actual applications, the first identifier can also be 0. In this case, data[index] = 0 indicates that there is data. This application does not impose any other limitations on this.

[0140] Based on the above rules, the data in the index range [0, N-1] is updated.

[0141] It should be noted that in the first data table, the range [0, N-1] can represent the time range corresponding to historical data; the range [N, 2N] can represent the time range corresponding to real-time data.

[0142] For example, please refer to Table 5, which is a first data table shown in this embodiment. As shown in Table 5, Table 5 is the first data table after initialization. At this time, N = 6, the range [0, 5] can represent the time range corresponding to historical data, and [6, 12] can represent the time range corresponding to real-time data.

[0143] Table 5

[0144] Subscript 0 1 2 3 4 5 6 7 8 9 10 11 12 array 0 0 0 0 0 0 0 0 0 0 0 0 0 time <![CDATA[T start ]]> <![CDATA[T on ]]>

[0145] When the first data to be processed is historical data, and it is determined that the first target data is in the historical time period 0, 1, 2, 3, 4, 5, the data is in the first target time period 1, 3, 4, 5.

[0146] Then, based on the fact that data[index] = 1 indicates the presence of data, the data in the range [0,5] is updated. Since there is first target data in historical time periods 1, 3, 4, and 5, the data corresponding to historical time periods 1, 3, 4, and 5 are updated to 1. Please refer to Table 6 for the updated first data table, which is another first data table shown in this embodiment.

[0147] Table 6

[0148] Subscript 0 1 2 3 4 5 6 7 8 9 10 11 12 array 0 1 0 1 1 1 0 0 0 0 0 0 0 time <![CDATA[T start ]]> <![CDATA[T on ]]>

[0149] In another embodiment shown, if all historical data to be processed in the first data table has been received, the first data table is updated so that the difference between the first data and the second data in the first data table is not zero. This includes updating the historical data in the first data table in reverse chronological order if all historical data to be processed in the first data table has been received, so that the difference between the first data and the second data in the first data table is not zero.

[0150] In this context, reverse time order refers to updating in the order from N-1 to 0.

[0151] In practical applications, when historical data transmission is complete, data within the range [0, N-1] can be updated. The update rules are as follows: set the initial value init = 0, and update from index N-1 backwards to index 0. If the index element value is 1, then set init = init-1 and assign it to the index element at that position; if the index element value is 0, then assign init to the index element at that position.

[0152] For example, continuing with the previous embodiment, after updating the data corresponding to indices 1, 3, 4, and 5 in the first data table, the historical data reception is complete, and the data in the range [0, 5] needs to be updated a second time in reverse chronological order.

[0153] Specifically, this could involve setting the initial value init = 0;

[0154] When the index is 5, since the data corresponding to index 5 is 1, init = init - 1 = 0 - 1 = -1. Therefore, init is assigned to the data corresponding to index 5.

[0155] When the index is 4, since the data corresponding to index 4 is 1, init = init-1 = -1-1 = -2. Therefore, init is assigned to the data corresponding to index 4.

[0156] When the index is 3, since the data corresponding to index 3 is 1, init = init - 1 = -2 - 1 = -3. Therefore, init is assigned to the data corresponding to index 3.

[0157] When the index is 2, since the data corresponding to index 2 is 0, init = -3. Therefore, init is assigned to the data corresponding to index 2.

[0158] When the index is 1, since the data corresponding to index 1 is 1, init = init - 1 = -3 - 1 = -4. Therefore, init is assigned to the data corresponding to index 1.

[0159] When the index is 0, since the data corresponding to index 0 is 0, init = -4. Therefore, init is assigned to the data corresponding to index 0.

[0160] At this point, all the historical data in the first data table has been updated. Please refer to Table 7 for the updated first data table, which is another first data table shown in this embodiment.

[0161] Table 7

[0162] Subscript 0 1 2 3 4 5 6 7 8 9 10 11 12 array -4 -4 -3 -3 -2 -1 0 0 0 0 0 0 0 time <![CDATA[T start ]]> <![CDATA[T on ]]>

[0163] In another embodiment shown, the first data to be processed includes real-time data to be processed; the second data is the data preceding the first data; obtaining the first data to be processed includes: obtaining real-time data to be processed; the time period corresponding to the first time parameter also includes a third time, the third time being the minimum statistical time during which the first target data has not been received; updating the first data table, before the difference between the first data and the second data is not zero, the method further includes: updating the difference between the third data corresponding to the third time and the data preceding it in the first data table to zero.

[0164] The third time is the minimum statistical time during which the first target data was not received, that is, the third time is the first unit time during which the first target data was not received.

[0165] It should be noted that since the data to be processed in real time is processed in real time, if the first target data is not received at the initial moment of a certain first unit of time, then the first unit of time can be considered as the third time. Furthermore, if the first target data is received at a certain moment of the first unit of time, then the first unit of time is no longer the third time, but the first unit of time corresponding to the first data.

[0166] In practical applications, when updating real-time data to be processed, in response to receiving real-time data to be processed that does not contain the target data, the data corresponding to the current first unit of time can be set to be equal to the value of the previous data. That is, let data[index+1] = data[index].

[0167] It is important to note that during the real-time update process based on the data to be processed, the data corresponding to the first unit of time at the current time is the data one index greater than that first unit of time. For example, if the first unit of time at the current time is the 7th unit of time, and the first target data is received within the 7th unit of time, then the data corresponding to index 8 needs to be updated; that is, the data corresponding to the 7th unit of time is the data corresponding to index 8.

[0168] The reason why the data corresponding to the 7th unit of time is the data corresponding to index 8 is that the index is used to indicate which first unit of time. Therefore, when the index is 0, it represents the 0th first unit of time, which has no practical meaning. In other words, the order of the first unit of time in the real-time data is one less than the corresponding index order in the first data table; for example, the data corresponding to the 7th first unit of time in the received real-time data in the first data table should be the data corresponding to index 8. Therefore, when determining whether there is data in the first unit of time corresponding to the index, it is done by checking whether data[index+1] – data[index] is zero.

[0169] For example, if the received real-time data to be processed corresponds to the 6th first unit time in the first data table, and the real-time data to be processed does not contain the first target data.

[0170] At this time, during the 6th first unit time, real-time data to be processed that does not contain the first target data is received, and in response to the real-time data to be processed, the data corresponding to the 6th first unit time is updated so that the data corresponding to the 6th first unit time is equal to the value of the previous data. Specifically, this can be achieved by setting data[7] = data[6] = 0.

[0171] In another embodiment shown, updating the first data table so that the difference between the first data and the second data is not zero includes: in response to receiving the first target data, updating the first data table so that the difference between the first data and the second data is not zero.

[0172] In practical applications, when updating real-time data to be processed, in response to receiving target data, the first data (i.e., the data corresponding to the current unit of time) can be made unequal to the second data (i.e., the data corresponding to the previous unit of time). Specifically, data[index+1] ≠ data[index].

[0173] For example, continuing with the previous embodiment, if the real-time data packet to be processed received in the 7th first unit time contains the first target data; in response to the real-time data to be processed, update the difference between the data corresponding to the 7th first unit time and the previous data to be non-zero. Specifically, it can be that data[7]≠data[6].

[0174] In another embodiment shown, when the first data to be processed includes real-time data to be processed; the second data is the data preceding the first data; updating the first data table, the difference between the first data and the second data being non-zero can be achieved by setting the first data = the second data + 1, that is, setting data[index+1] = data[index]+1.

[0175] This embodiment does not limit the specific method for identifying non-zero differences between two adjacent data points.

[0176] Please refer to Table 8 for the updated first data table, which is another first data table shown in this embodiment.

[0177] Table 8

[0178] Subscript 0 1 2 3 4 5 6 7 8 9 10 11 12 array -4 -4 -3 -3 -2 -1 0 0 1 0 0 0 0 time <![CDATA[T start ]]> <![CDATA[T on ]]>

[0179] In another embodiment shown, when the first data table is updated in real time based on the real-time data to be processed, an overwrite update can be performed.

[0180] For example, please refer to the previous embodiment. If the real-time data packet to be processed acquired at a certain moment in the 7th first unit time contains the first target data.

[0181] At this time, since real-time data to be processed that does not contain the first target data is obtained at the initial moment of the 7th first unit time, data[8] = data[7] = 0 is updated in response to the real-time data to be processed at the initial moment of the 7th unit time; at a certain moment of the 7th unit time, real-time data to be processed containing the first target data is obtained. At this time, in response to the real-time data to be processed containing the first target data, data[8] ≠ data[7] is updated to overwrite the data corresponding to the 7th first unit time.

[0182] It should be noted that during the 6th time unit, from the initial time of the 6th first unit to the end time of the 6th first unit, no real-time data containing the first target data arrived. Therefore, it is not necessary to overwrite or update the data corresponding to the 6th first unit.

[0183] In another embodiment shown, when the first data to be processed includes real-time data to be processed; the second data is the data preceding the first data; updating the first data table, the difference between the first data and the second data being non-zero can be achieved by setting the first data = the second data + 1, that is, setting data[index+1] = data[index]+1.

[0184] Based on the above update rules for real-time pending data, the first data table shown in Table 8 will be updated as follows:

[0185] During the 7th first unit time period, real-time data to be processed that does not contain the first target data is received, and in response to the real-time data to be processed, the data corresponding to the 7th first unit time period is updated so that the data corresponding to the 7th first unit time period is equal to the value of the previous data. Specifically, this can be done by setting data[8] = data[7] = 1.

[0186] ...

[0187] In the 10th first unit time period, real-time data to be processed that does not contain the first target data is received, and in response to the real-time data to be processed, the data corresponding to the 10th first unit time period is updated so that the data corresponding to the 10th first unit time period is equal to the value of the previous data. Specifically, this can be done by setting data

[11] = data

[10] = 1.

[0188] In the 11th first unit time period, real-time data to be processed containing the first target data is received; at this time, in response to the real-time data to be processed, the difference between the data corresponding to the 11th first unit time period and the previous data is updated to be non-zero. Specifically, it can be set data

[12] = data

[11] + 1 = 2.

[0189] Please refer to Table 9 for the updated first data table.

[0190] Table 9

[0191] Subscript 0 1 2 3 4 5 6 7 8 9 10 11 12 array -4 -4 -3 -3 -2 -1 0 0 1 1 1 1 2 time <![CDATA[T start ]]> <![CDATA[T on ]]>

[0192] In another embodiment shown, if the first unit time corresponding to the current time exceeds 2N, it means that the array length in the current first data table is insufficient to receive the time of the data to be processed. At this time, the array needs to be expanded, the array length is updated to 4N+1, and the original data is copied over, and data[2N+1] = data[2N].

[0193] In another embodiment shown, after initializing the first data table, before receiving real-time data to be processed, a timer for updating the real-time data in the first data table needs to be started.

[0194] The timer is used to update the first data table based on real-time data to be processed.

[0195] In practical applications, the timer starts working at the initial moment of each minimum unit of time and, in response to the data to be processed received in real time, overwrites and updates the data tuple corresponding to the minimum unit of time at the current working moment until the timer enters the next cycle.

[0196] At the same time, at the initial moment of each first unit of time, the timer calculates the index of that moment in the corresponding array of the first data table, which can further determine the correspondence between the current moment and the first unit of time in the first data table.

[0197] To better understand the update mechanism of the first data table, please refer to [link / reference]. Figure 5 , Figure 5 This embodiment illustrates a flowchart of a first data table update process, as follows: Figure 5 As shown, the above method includes:

[0198] S501, Obtain the first data to be processed.

[0199] S502, based on the first time parameter in the first information to be processed, according to the formula index=(T data -T start The index corresponding to this time in the first data table is calculated using ) / Tscale. Where T... data T represents the time corresponding to the data to be processed. start T represents the earliest time when data needs to be recorded. scale This is the first unit of time.

[0200] S503, determine whether the first data to be processed is historical data to be processed.

[0201] If index < N, the first data to be processed is historical data to be processed, and jump to S504; if index > N, the first data to be processed is real-time data to be processed, and jump to S505.

[0202] S504, determine whether the historical data has been received completely. If the historical data has been received completely, jump to S506; if the historical data has not been received completely, jump to S507.

[0203] S506, update the data corresponding to the subscripts in the range [0, N - 1] in the first data table in reverse order.

[0204] S507b, update the data corresponding to the subscripts in the range [0, N - 1] in the first data table in chronological order, and set data[index + 1] = 1.

[0205] S505, determine whether the real-time data to be processed contains the first target data.

[0206] If it contains the first target data, execute S508; otherwise, if it does not contain the first target data, execute S509.

[0207] S508, in response to the real-time data to be processed containing the first target data, update the difference between the data corresponding to the first unit time at the current time and its previous data to be non-zero.

[0208] S507b, in response to the real-time data to be processed not containing the first target data, update the data corresponding to the first unit time at the current time to be equal to its previous data.

[0209] In this embodiment, a data processing device is further provided. This device is used to implement the above embodiments and preferred implementation manners, and those that have been described will not be repeated here. The following terms such as "module", "unit", "sub-unit", etc. can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.

[0210] Figure 6 is a structural block diagram of a data processing device shown in this embodiment, as Figure 6 shown, the device includes: an acquisition module 601, which is used to acquire the first data to be processed; where the data to be processed includes a first type parameter, a first time parameter, and a first target data;

[0211] The first determining module 602 is used to determine a first data table corresponding to the first target data based on a first type parameter; wherein the data in the first data table is stored in the order of a first unit time, and the difference between each adjacent data is used to determine whether the first target data exists in the first unit time; the first unit time is a preset minimum statistical time.

[0212] The second determining module 603 is used to determine a second unit time based on the first data to be processed; wherein, the second unit time is the first unit time for receiving the first target data within the time period corresponding to the first time parameter;

[0213] The update module 604 is used to update the first data table, where the difference between the first data and the second data is not zero; wherein, the first data is the data corresponding to the second unit time; and the second data is the data adjacent to the first data.

[0214] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can reside in the same processor; or the above modules can be located in different processors in any combination.

[0215] In one embodiment, a computer device is provided, which may be a terminal; its internal structure diagram can be found in [reference needed]. Figure 7 , Figure 7 This embodiment illustrates a computer device. For example... Figure 7 As shown, the computer device includes a processor 701, a memory 702, a communication interface 703, a display screen 704, and an input device 705 connected via a system bus 700. The processor 701 provides computing and control capabilities. The memory 702 includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface 703 is used for communication with external terminals via a network connection. When the computer program is executed by the processor 701, it implements a network configuration method for a wireless terminal. The display screen 704 can be a liquid crystal display (LCD) or an e-ink display. The input device 705 can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0216] Those skilled in the art will understand that Figure 7The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0217] Furthermore, in conjunction with the data storage method provided in the above embodiments, this embodiment can also provide a storage medium for implementation. The storage medium stores a computer program; when executed by a processor, the computer program implements any of the data storage methods described in the above embodiments.

[0218] This embodiment also provides a data query method, please refer to [link / reference]. Figure 8 , Figure 8 This is a flowchart illustrating a data query method in this embodiment.

[0219] like Figure 8 As shown, the above method includes:

[0220] S801, Query condition acquisition steps: Acquire the first query condition.

[0221] The first query condition includes a second type parameter and a second time parameter; the first query condition is used to determine the second target data.

[0222] S802, Data table determination step: Determine the first data table based on the second type parameter.

[0223] The data in the first data table is stored in the order of the first unit time, and the difference between each adjacent data is used to determine whether there is second target data within the first unit time; the first unit time is a preset minimum statistical time.

[0224] S803, Statistical data determination step: Determine whether the second target data exists in the first data table within each second unit time period corresponding to the second time parameter.

[0225] The second unit of time is the statistical unit of time in the first statistical data;

[0226] The method for maintaining the first data table includes: acquiring first data to be processed; wherein the first data to be processed includes a first type parameter, a first time parameter, and first target data; determining a first data table corresponding to the first target data based on the first type parameter; wherein the data in the first data table is stored in order according to a first unit time, and the difference between each adjacent data is used to determine whether the first target data exists within the first unit time; the first unit time is a preset minimum statistical time; determining a first target time based on the first data to be processed; wherein the first target time is the minimum statistical time within the time period corresponding to the first time parameter during which the first target data was received; updating the first data table so that the difference between the first data and the second data in the first data table is not zero; wherein the first data is the data corresponding to the first target time; and the second data is the data adjacent to the first data.

[0227] The first query condition can be a query condition entered by the user on the client. For example, please see... Figure 9 , Figure 9 This is a schematic diagram of a client search interface shown in this embodiment, such as... Figure 9 As shown, the client search interface includes a search interface 910 for inputting the first search criteria and a display interface 920 for displaying the search results.

[0228] Please see Figure 10 , Figure 10 This is a schematic diagram of another client search interface shown in this embodiment, such as... Figure 10 As shown, the query interface 910 may include: a first user option 1011 for selecting type parameters, a second user option 1012 for selecting search rules, a third user option 1013 for selecting time parameters, a fourth user option 1014 for selecting report type, and a search option 1015 for initiating a search; the display interface includes a display window 1021 for displaying information and a fifth user option 1022 for selecting display mode.

[0229] The first user option 1011 may include a channel and a region; for example, the channel may be the channel identifier corresponding to camera A, and the region may be region A.

[0230] The second user option 1012 can include rules and types; for example, a rule could be to count the number of people in a region, and a type could be to count the number of people.

[0231] The third user option 1013 may include the start and end times for the query.

[0232] The fourth user option 1014 can include daily reports, monthly reports, and annual reports. Daily reports require that the search period cannot span multiple days, and search results are displayed by the hour, with the smallest unit of time being one hour. Monthly reports require that the search period cannot span 31 days, and search results are displayed by the day, with the smallest unit of time being one day. Annual reports require that the search period cannot span 366 days, and search results are displayed by the month, with the smallest unit of time being one month.

[0233] The fifth user option 1022 may include line chart user options, bar chart user options, and user options on whether to display numerical values ​​in the chart.

[0234] Optionally, the above user options can be an input box, a selection box with a drop-down key, or a user button that allows the user to make a selection. This application does not impose too many restrictions on this, as long as the user can input the first query condition.

[0235] Users can input the first query condition for statistical analysis of the second target data through the client search interface shown above; based on the second type parameter in the first query condition, they can query the first data table corresponding to the second type parameter; and then, based on the second time parameter in the first query condition, they can query the first statistical data in the first data table to see whether there is second target data within the time period corresponding to the second time parameter.

[0236] For example, in the query interface, the user selects channel D1, the rule is population statistics within the region, the report type is daily report, the start time is 2022-10-28 00:00:00, the end time is 2022-10-29 00:00:00, the type is population statistics report, the dwell time is 5 seconds, and the selected regions are Region 1, Region 2, Region 3, and Region 4.

[0237] Based on the rule of "personnel statistics within a region", "personnel statistics report", and "stay time 5 seconds", the second target data can be determined as the personnel statistics report within the region with a stay time of 5 seconds. Simultaneously, based on channel D1 and region 1, the unique corresponding first data table can be determined. Based on the start time of 2022-10-28 00:00:00 and the end time of 2022-10-29 00:00:00, the statistical results of whether the second target data exists in each time period corresponding to the time between 2022-10-28 00:00:00 and 2022-10-29 00:00:00 can be queried from the first data table.

[0238] Specifically, the difference between adjacent data in the first data table can be used to determine whether the target data exists in the first unit of time corresponding to that data.

[0239] In another embodiment shown, determining whether there is second target data in the first data table within each second unit time period corresponding to the second time parameter includes:

[0240] Retrieve the third and fourth data points from each second time unit in the first data table, and determine whether the difference between the third and fourth data points is zero; wherein, the third data point is the data corresponding to the first first time unit within the second time unit; and the fourth data point is the data corresponding to the last first time unit within the second time unit.

[0241] If the difference between the third and fourth data is not zero, then there is a second target data within the second unit time period;

[0242] If the difference between the third and fourth data is zero, then there is no second target data within the second unit time period.

[0243] The second unit of time differs from the first unit of time. For example, when the report type is a monthly report, the second unit of time is daily; when the report type is an annual report, the second unit of time is monthly.

[0244] It is easy to see from the above examples that the second time unit contains at least one first time unit. Therefore, the data corresponding to the first first time unit contained in the second time unit is the third data in the first data table; similarly, the data corresponding to the last first time unit contained in the second time unit is the fourth data in the first data table.

[0245] To better explain how to determine whether there is second target data in the second unit of time, please refer to 11. Figure 11 This is a flowchart illustrating another data query method shown in this embodiment, such as... Figure 11 As shown, the above method includes:

[0246] S1101, obtain the first query condition.

[0247] The first query condition includes a second type parameter and a second time parameter; the first query condition is used to determine the second target data.

[0248] S1102, determine the first data table based on the second parameter information in the first query condition, and calculate the subscript range [left, right] in the first data table corresponding to the second time parameter.

[0249] S1103, determine whether the second time parameter exceeds the time range represented by the array in the first cached data table. If it does not exceed the range, jump to S1104; if it exceeds the range, jump to S1105.

[0250] S1104, divide the [left, right) interval according to the second unit time to obtain the index range corresponding to each second unit time, and continue to execute S1106.

[0251] S1105, if the subscript range is adjusted so that the array in the first data table can represent the time period corresponding to the second time parameter, then continue to execute S1104.

[0252] S1106, for each second unit of time corresponding to the index [begin, end), by checking whether data[end]-data[begin] is 0, it can be determined whether there is data in that time unit.

[0253] It should be noted that in S1106, the data corresponding to the subscript begin in the first data table is the third data, and the data corresponding to the subscript end in the first data table is the fourth data.

[0254] In another embodiment shown, the method further includes a display step, which displays the first statistical data to the user.

[0255] In practical applications, the first statistical data can be displayed to users in the form of a statistical chart.

[0256] For example, the data can be displayed in the form of bar charts or line charts, and this application makes no other restrictions on this.

[0257] After the query, the corresponding display interface can show 24 hours of data within the horizontal axis of the chart. However, the interface will inevitably be more crowded than when querying only 12 hours or 8 hours (for example, when querying 8 hours of data, the horizontal axis only needs to be divided into 8 data segments, each time period is longer, and the data is displayed more clearly). In addition, users need to zoom in on the 24-hour image and move left and right to view the data for each hour.

[0258] For example, please see Figure 12 , Figure 12 This is a schematic diagram of another client search interface shown in this embodiment. For example... Figure 12 As shown in the figure, different labels correspond to target data in different areas. Rows 1-4 on the horizontal axis indicate whether there is data in each area.

[0259] For example, such as Figure 12 As shown:

[0260] Region 1 (first row, marked with a yellow dot): Data available for hours 8, 9, 10, 14, 15, and 16;

[0261] Region 2 (second row, marked with a green dot): Data available for hours 8, 10, 11, 12, and 13;

[0262] Area 3 (third row, marked with a blue dot): Data available for 8, 9, and 10 hours;

[0263] Area 4 (fourth row, marked with a purple dot): Data available for hours 16, 17, 18, and 19.

[0264] In practical applications, users can select whether they need to retrieve whether there are records of target data in different region IDs at different time periods by checking the region ID option in the query interface.

[0265] Furthermore, if you are interested in data from all four regions, you can query the data from 8:00 to 20:00; if you are interested in only four regions, you can query the data from 16:00 to 20:00.

[0266] As a result, by shortening the query interval, the data displayed for each hour in the query results is wider, eliminating the need for users to zoom in and drag the horizontal axis to view the data, thus improving the user experience.

[0267] In another embodiment shown, the method further includes a modification step, modifying the first query condition to a second query condition based on the first statistical data; wherein the second query condition includes a second type parameter and a third time parameter; the time period corresponding to the third time parameter is included within the time period corresponding to the second time parameter.

[0268] The process involves repeating the steps of obtaining query conditions, determining the data table, and determining the statistical data to identify the second statistical data.

[0269] In practical applications, users can modify query conditions based on the first set of statistical data. For example, by modifying the time parameter, they can obtain statistics on the existence of a second target data point within a more precise time period. Specifically, callback functions can be set for the controls related to the query conditions. When the query conditions are modified, the callback function is triggered. When the time control or the region selection box control changes, the callback function completes the query on the first data table and displays the second set of statistical data under the given query conditions.

[0270] The specific processing procedure is as follows:

[0271] Step a: The user modifies the value of the query-related control, triggering the callback function;

[0272] Step b: Locate the corresponding first data table based on the query conditions (channel number, query start and end time, region);

[0273] Step c: Calculate the index range corresponding to the query times start and end. This is done by subtracting Tstart_hour from start and end respectively, then dividing by Tscale to obtain the corresponding index [left, right). Assume the array length is 2N+1. If start is earlier than Tstart_hour, then left is set to 0; if the right index calculated from end time is ≥2N, then it is set to 2N; otherwise, the search index range is [left, right).

[0274] Step d: By calculating whether data[right] – data[left] is 0, it can be determined whether there is new data within the range [start, end). This takes constant time.

[0275] Repeat steps b to d above until all types of data have been processed. This will give you the conclusion that there is second target data for all types under the given query conditions. The second target data for each type can be displayed on the same result display chart using different identifiers.

[0276] Through the above processing, once multiple primary data tables are maintained in the NVR for each channel supporting population statistics in a given area, whenever a user switches the start and end time of the query or modifies the query area on the primary statistics display page, it can instantly calculate whether there is secondary target data under the given query conditions, providing a prompt to the user without actually querying the database.

[0277] Optionally, if data persistence is required, an intermediate database can be established to store the relevant fields from the first data table. This database is much smaller than the actual database and queries are much faster. To avoid the overhead of querying the database, the database content can be read into the first data table when the device is powered on, and the data in the first data table can be synchronized to the database when the device is powered off. Alternatively, the data in the first data table in memory can be written to a disk file in real time, read into memory when the device is powered on, and written to the file when the device is powered off. This embodiment does not impose any other limitations or explanations on this.

[0278] To better understand the method of querying the second target data corresponding to multiple region IDs simultaneously, please refer to [link to relevant documentation]. Figure 13 , Figure 13 This embodiment illustrates another data query method, such as... Figure 13 As shown, the above query steps include:

[0279] S1301, Obtain the first query condition from the client query interface.

[0280] For example, channel number, query type, start and end time.

[0281] S1302, based on the second parameter information in the first query condition, determine the corresponding first data table, and traverse at least one first data table found.

[0282] S1303, determine whether all data in the first data table has been traversed. If the traversal is complete, jump to S1304; if the traversal is not complete, jump to S1305.

[0283] S1304, summarize the first statistical results corresponding to each first data table, and display the second statistical results using different identifiers.

[0284] S1305, Select a first data table that has not been queried and perform a query. After the query, continue to execute S1303.

[0285] Optionally, after a user modifies the first query condition based on the first statistical result, the query can be repeated. Figure 13 The steps shown are used to obtain the corresponding second statistical results.

[0286] In another embodiment shown, the above method further includes:

[0287] The query step involves querying the first database based on the second query condition to obtain the second target data; wherein, the first database stores the second target data.

[0288] In practical applications, the database containing the actual data is accessed only when the user clicks the "Search" button on the query interface in order to query the second target data.

[0289] Users can modify their query conditions (e.g., shorten the start and end time range) based on the prompts to select a valid data time period or a valid query type. Compared to directly accessing the database storing the second target data and determining the data range corresponding to the second target data, the method in this embodiment can quickly determine the existence range of the second target data and query the first database based on that range, which can improve the user's query efficiency. At the same time, it avoids the problem of directly accessing the database to query the second target data when the existence range of the second target data is not clear, and then finding that the second target data does not exist under the query conditions, resulting in poor query results. This improves query efficiency while ensuring query results and enhancing the user experience.

[0290] This embodiment also provides a data processing apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. The terms "module," "unit," "subunit," etc., used below refer to combinations of software and / or hardware that perform a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0291] Please see Figure 14 , Figure 14 This is a structural block diagram of a data query device shown in this embodiment. For example... Figure 14 As shown, the device includes:

[0292] The acquisition module 1401 is used to acquire the first query condition corresponding to the second target data; wherein, the first query condition includes a second type parameter and a second time parameter;

[0293] The first determining module 1402 is used to determine a first data table based on a second type of parameter; wherein the data in the first data table is stored in the order of a first unit time, and the difference between each adjacent data is used to determine whether there is second target data in the first unit time; the first unit time is a preset minimum statistical time;

[0294] The second determining module 1403 is used to determine whether there is a first statistical data of the second target data in the first data table within each second unit time period corresponding to the second time parameter; wherein, the second unit time is the statistical unit time in the first statistical data.

[0295] The method for maintaining the first data table includes: acquiring first data to be processed; wherein the first data to be processed includes a first type parameter, a first time parameter, and first target data; determining a first data table corresponding to the first target data based on the first type parameter; wherein the data in the first data table is stored in order according to a first unit time, and the difference between each adjacent data is used to determine whether the first target data exists within the first unit time; the first unit time is a preset minimum statistical time; determining a first target time based on the first data to be processed; wherein the first target time is the minimum statistical time within the time period corresponding to the first time parameter in the first data table where the first target data was received; updating the first data table so that the difference between the first data and the second data in the first data table is not zero; wherein the first data is the data corresponding to the first target time; and the second data is the data adjacent to the first data.

[0296] This embodiment also provides a computer device, including a memory and a processor. The memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above method embodiments. It should be noted that specific examples in this embodiment can be found in the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0297] Furthermore, in conjunction with the data query method provided in the above embodiments, this embodiment can also provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, it implements any of the data query methods in the above embodiments. It should be noted that specific examples in this embodiment can be found in the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0298] It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. All other embodiments derived by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.

[0299] Obviously, the accompanying drawings are merely some examples or embodiments of this application. Those skilled in the art can apply this application to other similar situations based on these drawings without any creative effort. Furthermore, it is understood that although the work done in this development process may be complex and lengthy, for those skilled in the art, certain design, manufacturing, or production modifications made based on the technical content disclosed in this application are merely conventional technical means and should not be considered as insufficient disclosure of this application.

[0300] The term "embodiment" in this application refers to a specific feature, structure, or characteristic described in connection with an embodiment that may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily imply the same embodiment, nor does it imply that it is mutually exclusive with or independent of other embodiments. It will be clearly or implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0301] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of patent protection. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the appended claims.

Claims

1. A data storage method, characterized in that, The method includes: Obtain the first data to be processed; wherein the first data to be processed includes a first type parameter, a first time parameter, and a first target data; Based on the first type parameter, a first data table corresponding to the first target data is determined; wherein, the data in the first data table is stored in order according to a first unit time, and the difference between each adjacent data is used to determine whether the first target data exists within the first unit time; the first unit time is a preset minimum statistical time. Based on the first time parameter, a first target time is determined; wherein, the first target time is the minimum statistical time within the time period corresponding to the first time parameter during which the first target data was received. Update the first data table so that the difference between the first data and the second data in the first data table is not zero; wherein, the first data is the data corresponding to the first target time; and the second data is the data adjacent to the first data. Updating the first data table includes: When the data to be processed is historical data to be processed, if the historical data to be processed has not been completely received, the data corresponding to the historical data to be processed in the first data table is updated sequentially, and if the historical data to be processed has been completely received, the data corresponding to the historical data to be processed in the first data table is updated in reverse order; wherein, the sequential update is used to use different identifiers to indicate whether the first target data has been received in each first unit time corresponding to the historical data to be processed; the reverse order update is used to update the data corresponding to the historical data to be processed in the first data table according to the update result after the sequential update, so that the difference between the first data and the second data in the first data table is not zero. When the data to be processed is real-time data, and when the real-time data to be processed includes the first target data, the difference between the data corresponding to the first unit time at the current time and the previous data is not zero. When the real-time data to be processed does not include the first target data, the data corresponding to the first unit time at the current time is updated to be equal to the previous data. The first target data is the data that needs to be stored in the data to be processed.

2. The data storage method according to claim 1, characterized in that, Before determining the first data table corresponding to the first target data based on the first type parameter, the method further includes: Based on the first type parameter, determine whether the first data table exists; If the first data table exists, then the first target time is determined based on the first data to be processed; If the first data table does not exist, then construct the first data table corresponding to the first type parameter according to the first unit time.

3. The data storage method according to claim 2, characterized in that, The first type of parameters includes: online channel number, region ID, and processing rules.

4. The data storage method according to claim 2, characterized in that, If the first data table does not exist, constructing the first data table corresponding to the first type parameter according to the first unit time includes: The first data table corresponding to the first type parameter is created according to the first unit time. Initialize the first data table.

5. A data query method, characterized in that, The data query method is used to query data stored using the data storage method according to any one of claims 1 to 4; the method includes: Query condition acquisition steps: Acquire first query condition; wherein, the first query condition includes a second type parameter and a second time parameter; the first query condition is used to determine the second target data; Data table determination steps: Based on the second type parameters, determine a first data table; wherein, the data in the first data table is stored in the order of a first unit time, and the difference between each adjacent data is used to determine whether the second target data exists within the first unit time; the first unit time is a preset minimum statistical time; Statistical data determination steps: Determine whether the second target data exists in the first data table within each second unit time period corresponding to the second time parameter; wherein, the second unit time is the statistical unit time in the first statistical data.

6. The data query method according to claim 5, characterized in that, The step of determining whether the second target data exists in the first data table within each second unit time period corresponding to the second time parameter includes: Obtain the third and fourth data points within each second time unit in the first data table, and determine whether the difference between the third and fourth data points is zero; wherein, the third data point is the data corresponding to the first first time unit within the second time unit; and the fourth data point is the data corresponding to the last first time unit within the second time unit. If the difference between the third data and the fourth data is not zero, then the second target data exists within the second unit time period; If the difference between the third data and the fourth data is zero, then the second target data does not exist within the second unit time period.

7. The data query method according to claim 5, characterized in that, The method further includes: The modification step involves changing the first query condition to a second query condition based on the first statistical data; wherein the second query condition includes a second type parameter and a third time parameter; the time period corresponding to the third time parameter is included within the time period corresponding to the second time parameter. Repeat the steps of obtaining query conditions, determining data tables, and determining statistical data to determine the second statistical data.

8. The data query method according to claim 7, characterized in that, The method further includes: Based on the second query condition, the first database is queried to obtain the second target data; wherein, the first database stores the second target data.

9. A computer device, comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method of any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Statistical method and apparatus of personal information, terminal equipment and storage medium

    CN107679613A

  • Data query method and device and server

    CN109977135A