An information prediction method and device, computer device and storage medium
By using web workers on the browser side to extract and analyze application data fields and field values, the problem of browsers being unable to process metadata is solved, improving data processing efficiency and security.
Patent Information
- Application Number
- CN202210043143.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-14
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2042-01-14
AI Technical Summary
The browser is unable to properly process the metadata of the application data obtained from the server, leading to data security and processing efficiency issues.
By using pre-created web workers, fields and values of application data can be extracted and analyzed on the browser side to determine the current metadata and update the storage, thus avoiding the consumption of main thread resources.
It enables timely and accurate determination of application data metadata on the browser side, improving data processing efficiency and ensuring the proper operation of the browser's main thread.
Smart Images

Figure CN114385954B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to an information prediction method, apparatus, computer device, and storage medium. Background Technology
[0002] For applications running in a browser, their various application data are typically created by the user on the server and stored in a database on the server. When the application loads, the browser needs to retrieve the application data stored in the database from the server.
[0003] However, in order to ensure the security of the application data stored, the application data obtained by the browser from the server usually lacks metadata such as data structure and data type, which makes it impossible to properly process the obtained application data in the browser based on the above metadata. Summary of the Invention
[0004] This disclosure provides at least one information prediction method, apparatus, computer device, and storage medium.
[0005] In a first aspect, embodiments of this disclosure provide an information prediction method, including:
[0006] Obtain the data table corresponding to the front-end application, where each piece of application data in the data table is pre-stored in the target database;
[0007] Using a pre-created web worker, at least one field and the field value of each field are extracted from each piece of application data. Based on the extracted at least one field and the field value of each field, the current metadata of each piece of application data in the data table is determined.
[0008] Based on the current metadata corresponding to each piece of application data, the metadata of each piece of application data is updated and stored; wherein, the metadata is used to characterize the basic attributes of the application data.
[0009] In one possible implementation, the metadata of each piece of application data is updated and stored based on the current metadata corresponding to each piece of application data, including:
[0010] If historical metadata for this application data exists, determine whether the historical metadata is consistent with the current metadata.
[0011] If the historical metadata is inconsistent with the current metadata, the previously stored historical metadata of the application data and the current metadata are used as the updated metadata corresponding to the application data and stored.
[0012] In one possible implementation, after updating and storing the metadata for each piece of application data, the method further includes:
[0013] In response to a data editing request for any application data in the data table, an editing prompt message is generated and displayed based on the metadata corresponding to the application data; the editing prompt message is used to prompt the user to edit the data according to the basic attributes indicated by the metadata.
[0014] In one possible implementation, the step of extracting at least one field and the field value of each piece of application data, and determining the current metadata of each piece of application data in the data table based on the extracted at least one field and the field value of each field, includes:
[0015] For each piece of application data, a depth-first traversal algorithm is used to traverse the application data to determine at least one field included in the application data, and the field value corresponding to each field.
[0016] For each field currently traversed, determine the field type based on the field value.
[0017] Based on the number of fields in the application data, the field value corresponding to each field, and the field type corresponding to each field, the current metadata of the application data is determined.
[0018] In one possible implementation, determining the field type corresponding to the field based on the field value includes:
[0019] If, based on the field value corresponding to the field, it is determined that there are multiple field types corresponding to the field, the multiple field types are combined into a union type, and the union type is used as the final field type of the field.
[0020] In one possible implementation, obtaining the data table corresponding to the front-end application includes:
[0021] Retrieve at least one piece of search information from user input;
[0022] Based on the data search information, each piece of application data corresponding to the data search information is obtained from the target database corresponding to the server, and the obtained application data is used as the application data in the data table.
[0023] In one possible implementation, the target database includes a MongoDB database.
[0024] Secondly, embodiments of this disclosure also provide an information prediction device, comprising:
[0025] The acquisition module is used to acquire the data table corresponding to the front-end application, wherein each piece of application data in the data table is pre-stored in the target database;
[0026] The determination module is used to extract at least one field and the field value of each field from each piece of application data using a pre-created web worker, and to determine the current metadata of each piece of application data in the data table based on the extracted at least one field and the field value of each field.
[0027] The update module is used to update and store the metadata of each piece of application data based on the current metadata corresponding to each piece of application data; wherein the metadata is used to characterize the basic attributes of the application data.
[0028] In one possible implementation, the update module is used to determine whether the historical metadata is consistent with the current metadata if historical metadata of the previously stored application data exists.
[0029] If the historical metadata is inconsistent with the current metadata, the previously stored historical metadata of the application data and the current metadata are used as the updated metadata corresponding to the application data and stored.
[0030] In one possible implementation, the device further includes:
[0031] The editing module is used to update and store the metadata of each piece of application data, and in response to a data editing request for any piece of application data in the data table, generate and display the editing prompt information corresponding to the application data based on the metadata of that piece of application data; the editing prompt information is used to prompt the user to edit the data according to the basic attributes indicated by the metadata.
[0032] In one possible implementation, the determining module is used to traverse each piece of application data using a depth-first traversal algorithm to determine at least one field included in the application data, and the field value corresponding to each field.
[0033] For each field currently traversed, determine the field type based on the field value.
[0034] Based on the number of fields in the application data, the field value corresponding to each field, and the field type corresponding to each field, the current metadata of the application data is determined.
[0035] In one possible implementation, the determining module is configured to, when determining that there are multiple field types corresponding to the field based on the field value corresponding to the field, combine the multiple field types into a union type, and use the union type as the final field type of the field.
[0036] In one possible implementation, the acquisition module is used to acquire at least one piece of data search information input by the user;
[0037] Based on the data search information, each piece of application data corresponding to the data search information is obtained from the target database corresponding to the server, and the obtained application data is used as the application data in the data table.
[0038] In one possible implementation, the target database includes a MongoDB database.
[0039] Thirdly, an optional implementation of this disclosure also provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is configured to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the steps of the first aspect above, or any possible implementation of the first aspect, are performed.
[0040] Fourthly, an optional implementation of this disclosure also provides a computer-readable storage medium storing a computer program that, when run, performs the steps of the first aspect or any possible implementation of the first aspect.
[0041] For a description of the effects of the aforementioned information prediction device, computer equipment, and computer-readable storage medium, please refer to the description of the aforementioned information prediction method; it will not be repeated here.
[0042] The information prediction method, apparatus, computer equipment, and storage medium provided in this disclosure include fields and field values in the application data, which can reflect the metadata of the application data. Therefore, after obtaining the application data, a pre-created web worker is used to extract the fields and field values from the application data. Based on the analysis and processing of the fields and field values, the current metadata of each piece of application data in the data table can be determined in a timely and accurate manner. This enables the browser to proactively determine the metadata of the obtained application data, which is beneficial for subsequent processing of the obtained application data based on the determined metadata. Furthermore, since the web worker is an independently runnable thread, using a pre-created web worker to perform the above-mentioned operation of determining the metadata of the application data avoids resource occupation of the browser's main thread (such as the page interaction / rendering thread), ensuring the reasonable operation of the browser's main thread.
[0043] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0044] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.
[0045] Figure 1 A flowchart of an information prediction method provided by an embodiment of this disclosure is shown;
[0046] Figure 2 A schematic diagram of an information prediction device provided in an embodiment of this disclosure is shown;
[0047] Figure 3 A schematic diagram of a computer device structure provided in an embodiment of this disclosure is shown. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown herein can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.
[0049] Furthermore, the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein.
[0050] In this article, "multiple or several" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0051] Research has revealed that MongoDB, as a NoSQL database, grants users significant control over its data resources. For example, users can freely modify existing application data and add new application data incompatible with existing data. However, because MongoDB is server-side and to ensure application data security, it only provides the ability to retrieve metadata about each piece of application data stored on the server. The application data retrieved by the browser from the server typically lacks metadata such as data structure and data type, making it impossible to process the retrieved application data within the browser based on this metadata.
[0052] Based on the above research, this disclosure provides an information prediction method, apparatus, computer device, and storage medium. The fields and field values included in the application data can reflect the metadata of the application data. Therefore, after acquiring the application data, a pre-created web worker is used to extract the fields and field values from the application data. Based on the analysis and processing of the fields and field values, the current metadata of each piece of application data in the data table can be determined promptly and accurately. This allows for the proactive determination of the metadata of the acquired application data on the browser side, which is beneficial for subsequent processing of the acquired application data based on the determined metadata. Furthermore, since the web worker is an independently running thread, using a pre-created web worker to perform the above-mentioned operation of determining the metadata of the application data avoids resource occupation of the browser's main thread (such as the page interaction / rendering thread), ensuring the reasonable operation of the browser's main thread.
[0053] The shortcomings of the above solutions are the result of the inventor's practical experience and careful research. Therefore, the discovery process of the above problems and the solutions proposed in this disclosure below should be considered as the inventor's contribution to this disclosure.
[0054] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0055] It should be noted that the specific terms mentioned in the embodiments of this disclosure include:
[0056] NoSQL databases: generally refers to non-relational databases, which have the following advantages: easy to expand; although there are many types of NoSQL databases, they all share the common feature of removing the relational characteristics of relational databases; and no relationship between data, which allows for data expansion.
[0057] Depth-first traversal: Generally refers to depth-first search, which is used to traverse every possible branch path in a tree structure until it can go as far as it can, and each node in the tree can only be visited once; that is, it can traverse each field corresponding to the application data and its corresponding field value.
[0058] Type of: In JavaScript, it is a unary operator that can determine the type of the operand. Its return value is a string. It can be used as type of operand or type of(operand). In this embodiment of the disclosure, it can be used as type of field value or type of(field value).
[0059] To facilitate understanding of this embodiment, a detailed description of the information prediction method disclosed in this disclosure embodiment will be provided first. The execution subject of the information prediction method provided in this disclosure embodiment is generally a computer device with certain computing power. In some possible implementations, the information prediction method can be implemented by the processor calling computer-readable instructions stored in the memory.
[0060] The information prediction method provided in this disclosure embodiment will be described below using a computer device as an example.
[0061] like Figure 1 The flowchart shown is a method for information prediction provided in an embodiment of this disclosure, which may include the following steps:
[0062] S101: Obtain the data table corresponding to the front-end application. Each piece of application data in the data table is pre-stored in the target database.
[0063] Here, the front-end application refers to the application that can run in a browser. Each piece of application data in the data table corresponds to a piece of data related to the aforementioned front-end application. For example, the front-end application could be a resident management application, and its corresponding application data could include page data corresponding to the application page, resident count data, resident contact information data, and so on.
[0064] The target database can be any type of NoSQL database, such as a Remote Dictionary Server (Redis), Memcache, or MongoDB. Memcache is a high-performance distributed memory object caching system used to reduce database load and improve database access speed; MongoDB is a distributed file storage-based database with high performance, ease of deployment, ease of use, and convenient data storage. For ease of description, this disclosure uses MongoDB as the target database in all embodiments to illustrate the above information prediction method.
[0065] The MongoDB database can be pre-created by the user on the server, storing application data corresponding to the front-end application. Users can manage the MongoDB database on the server, such as creating and modifying data. Each piece of application data can be pre-created and stored in the MongoDB database. Application data in the target database can exist independently or be divided into multiple tables, each table containing one or more pieces of application data.
[0066] In practice, the browser can send a data retrieval request to the client. After receiving the request, the server can filter out the application data that matches the request from the target database and send the matching application data back to the browser. The browser can then receive these matching application data entries in batches and use them as data in a data table.
[0067] S102: Using a pre-created web worker, extract at least one field and the field value of each application data entry, and determine the current metadata of each application data entry in the data table based on the extracted at least one field and the field value of each field.
[0068] The aforementioned web worker allows the browser's main thread (primarily responsible for page interaction and rendering) to create worker threads and assign tasks to them. While the main thread runs, the worker threads run in the background, without interference. Once the worker threads have completed their tasks, they return the results to the main thread. In this way, computationally intensive or high-latency tasks are handled by the worker threads, allowing the main thread to run smoothly without being blocked or slowed down, ensuring page responsiveness to the user.
[0069] Taking the main thread as an example for rendering and displaying a page, if a calculation task for the page is received during the main thread's page rendering and display process, the calculation task can be executed using a pre-created web worker child thread. The calculation task can be completed without affecting the main thread's execution, and the task result can be fed back to the main thread.
[0070] Application data can include one or more fields, each of which can correspond to different field values. In other words, application data is a collection of multiple fields and their corresponding values. Specifically, each piece of application data can exist in the form of a "tree," with each field corresponding to a branch, and each field value corresponding to the value of each leaf node. Based on the position of each field, we can determine the data structure of the application data, the number of fields included in the application data, and other information.
[0071] Each field can correspond to a different field type, such as an address field, a numeric field, a string field, etc., and the value of each field is the value of the corresponding field.
[0072] Meta-information is used to characterize the basic attributes of application data. Specifically, it can characterize attributes such as the data structure corresponding to the application data, the number of fields included in the application data, the types of fields, and the set of field values. The current meta-information is the meta-information corresponding to the application data determined after the current analysis of the application data. For the same piece of data, its corresponding data content can be changed; therefore, the meta-information determined for the application data can be different each time.
[0073] In practice, after obtaining the above data table, for each piece of application data in the data table, a pre-created web worker sub-thread can be used to analyze the application data, determine at least one field included in the application data (that is, determine the number of fields included in the application data), the position of each field in the "tree" corresponding to the application data, and the field value corresponding to each field.
[0074] Furthermore, based on the position of each field in the application data, the data structure of the application data can be determined; according to the field value of each field, the set of field values included in the application data can be determined; and by analyzing the field value of each field, the field type corresponding to that field can be determined. Subsequently, the number of fields included in the application data, the data structure of the application data, the set of field values included in the application data, and the field type corresponding to each field can be used as the current metadata of the application data.
[0075] Based on the above steps, the current metadata corresponding to each piece of application data in the above data table can be determined, that is, the current metadata corresponding to the data table can be obtained.
[0076] S103: Based on the current metadata corresponding to each piece of application data, update and store the metadata of each piece of application data; wherein, the metadata is used to characterize the basic attributes of the application data.
[0077] Here, the current metadata is used to characterize the metadata corresponding to each piece of application data determined in the current iteration.
[0078] In practice, for each piece of application data, the current metadata corresponding to that piece of application data can be directly used as the latest metadata corresponding to that piece of application data.
[0079] Furthermore, if there is previously stored historical metadata for this application data, the current metadata can be used to update the stored historical metadata, and the current metadata can be stored as the latest metadata.
[0080] Alternatively, if historical metadata exists for this application data, it can be compared with the current metadata to determine the differences between the two. For information other than the non-distinguishing information between the two metadata, the information corresponding to the non-distinguishing information in the stored historical metadata can be used. For the determined distinguishing information, the information corresponding to the distinguishing information in the current metadata is used to update the information corresponding to the distinguishing information in the historical metadata. Thus, the updated storage of historical metadata can be achieved, resulting in the latest metadata for this application data.
[0081] If the application data does not contain previously stored historical metadata, the current metadata can be directly used as the latest metadata and stored. Specifically, the latest metadata can be stored in the browser's local storage location.
[0082] Furthermore, after updating and storing the metadata for each piece of application data, the metadata corresponding to the aforementioned data table can be determined and stored in local storage. Here, the metadata corresponding to the data table is used to comprehensively represent the updated and stored metadata for each piece of application data in the data table.
[0083] In this way, the fields and field values included in the application data can reflect the metadata of the application data. Therefore, after obtaining the application data, by using a pre-created web worker to extract the fields and field values from the application data, and then by analyzing and processing the fields and field values, the current metadata of each piece of application data in the data table can be determined in a timely and accurate manner. This allows the browser to proactively determine the metadata of the obtained application data, which is beneficial for subsequent processing of the obtained application data based on the determined metadata. In addition, since the web worker is an independently running thread, using a pre-created web worker to perform the above-mentioned operation of determining the metadata of the application data avoids the resource occupation of the browser's main thread (such as the page interaction / rendering thread), ensuring the reasonable operation of the browser's main thread.
[0084] In one embodiment, S102 described above can be implemented according to the following steps:
[0085] S102-1: For each piece of application data, use a depth-first traversal algorithm to traverse the application data, determine at least one field included in the application data, and the field value corresponding to each field.
[0086] As can be seen from the above embodiments, each application data can exist in the form of a "tree". Therefore, in specific implementation, the depth-first traversal algorithm can be used to traverse the application data, realize the traversal of each node corresponding to the application data, determine each field included in the application data, and the field value corresponding to each field.
[0087] S102-2: For each field currently traversed, determine the field type corresponding to that field based on its corresponding field value.
[0088] In practice, for each field currently being traversed, the `type of` method can be used to process the field value and determine the corresponding field type.
[0089] S102-3: Based on the number of fields in the application data, the field value corresponding to each field, and the field type corresponding to each field, determine the current metadata of the application data.
[0090] For example, for each piece of application data, the application data can include the number of fields, the field value of each field, the field type of each field, and the data structure determined according to the position of each field during traversal, as the current metadata of the application data.
[0091] Furthermore, when storing the current metadata corresponding to the application data, the field value and field type of each field can be stored according to the position of each field when traversing the application data.
[0092] In one embodiment, when determining the field type of a field based on its corresponding field value, multiple field types may be identified. Taking a field named "Address" as an example, the address indicated by its field value might initially include three text-type data entries indicating the address, thus identifying the "Address" field as a text type. However, if a user adds a string-type data entry to this field on the server side, this string-type data can still be retrieved after the user refreshes the page. Therefore, when iterating through this field, it can be determined that it includes three text-type data entries and one string-type data entry. Thus, multiple field types are identified in this case.
[0093] In practice, when determining the field type based on the field value, if multiple field types are identified, these types can be combined into a union type, which will then be used as the final field type. For example, if the field types identified include both text and string types, the resulting union type will also include both text and string types.
[0094] In one embodiment, S103 described above can be implemented according to the following steps:
[0095] S103-1: If there is historical metadata for this application data that was previously stored, determine whether the historical metadata is consistent with the current metadata.
[0096] Here, historical metadata refers to the metadata corresponding to the application data that was previously stored in the local storage location. Each piece of application data in the data table may or may not contain historical metadata.
[0097] In practice, for each piece of application data in the data table, the system can check if historical metadata for that piece of application data previously stored exists in the local storage location. If not, the corresponding current metadata for that piece of application data can be directly stored in the local storage location.
[0098] If so, it is necessary to determine whether the historical metadata is consistent with the current metadata. The reason for comparing the consistency of the two metadata is that the corresponding field value may change for the same field. In the process of determining the field type based on the field value, the field value used in different calculations may result in different calculated field types, and consequently, the historical metadata and the current metadata will also be different.
[0099] Alternatively, for the same field, even with identical field values, the field type might be determined differently in different calculations. For example, for the same field A, in the previous calculation based on the field value of field A, the field type of field A might have been determined to be text; while in the current calculation based on the field value of field A, the field type of field A might have been determined to be numeric.
[0100] For the reasons stated above, after obtaining the current metadata, it is necessary to first determine whether the historical metadata is consistent with the current metadata.
[0101] S103-2: If the historical metadata is inconsistent with the current metadata, the previously stored historical metadata and the current metadata of the application data shall be used as the updated metadata corresponding to the application data and stored.
[0102] Here, if it is determined that the historical metadata and the current metadata are inconsistent, the historical metadata and the current metadata of the previously stored application data can be merged directly as the updated metadata corresponding to the application data and stored.
[0103] Specifically, inconsistencies between historical and current metadata can be merged and stored. For consistent information, the stored portion of the historical metadata can be used, while the portion corresponding to the current metadata can be deleted. For example, if the inconsistency between historical and current metadata pertains to the field type of field A, where the historical metadata corresponds to a text field and the current metadata corresponds to a numeric field, then field A can be stored as either a text or numeric type.
[0104] In one implementation, for each piece of application data in the data table, before analyzing it using a pre-created webworker sub-thread, the system can check in local storage whether historical metadata corresponding to that piece of application data already exists. If historical metadata is found to exist, it can be used as the current metadata to be modified for that piece of application data; that is, the historical metadata can be assigned to the metaInfo variable corresponding to that piece of application data, and the metaInfo variable can be used as the current metadata to be modified for that piece of application data.
[0105] Conversely, if it is determined that there is no historical metadata, an empty object can be assigned to the metaInfo variable corresponding to the application data, and the metaInfo variable can be used as the current metadata to be modified for the application data.
[0106] After determining the current metadata corresponding to the application data using the web worker sub-thread, the metadata of each application data can be updated and stored based on the determined current metadata, thereby storing the latest metadata corresponding to each application data in the data table locally.
[0107] In one embodiment, after updating and storing the metadata of each piece of application data, in response to a data editing request for any piece of application data in the data table, an editing prompt message corresponding to that piece of application data can be generated and displayed based on the latest updated and stored metadata corresponding to that piece of application data.
[0108] The aforementioned data editing request can be a request to update, add, or edit application data in a data table. The editing prompt message is used to guide the user to edit the data according to the basic attributes indicated by the metadata. For example, the editing prompt message could be: "The data type of the application data corresponding to the current data editing request is text. If you want to update this application data, please enter the updated text data."
[0109] For example, when a user initiates a data editing request for field B in the application data, the browser can respond to the request and generate an editing prompt message for the user to enter the updated data in string type based on the field type string type corresponding to field B.
[0110] Furthermore, if the field type of the updated data entered by the user does not match the field type indicated in the editing prompt, the user's edit can be rejected. Alternatively, an edit confirmation message can be displayed to the user, indicating that the data type of the updated data does not match the field type indicated in the editing prompt, and requesting the user to confirm whether to edit. If the user confirms the edit, the updated data is used to update field B.
[0111] In one embodiment, the step of obtaining the data table corresponding to the front-end application in S101 above can be implemented according to the following steps:
[0112] S101-1: Obtain at least one piece of search information from user input.
[0113] Here, when the application data in the target database exists independently, the data search information can be the data identifiers corresponding to each application data entered by the user, with each data identifier entered by the user serving as a data search information.
[0114] When the application data of the target database is divided into multiple different data tables, the data search information can be the data table identifiers corresponding to one or more data tables entered by the user, and each data table identifier entered by the user can be used as a data search information.
[0115] Alternatively, data search information can be automatically generated by the browser. For example, when a user clicks on any icon on the page, the browser can respond to the click operation, determine the data table corresponding to that icon, and use the data table icon information corresponding to that data table as the data search information.
[0116] S101-2: Based on the data search information, retrieve each piece of application data corresponding to the data search information from the target database on the server side, and use each piece of application data as application data in the data table.
[0117] In practice, the browser can send the data search information to the server. After receiving the data search information, the server can determine the corresponding application data entries stored in the target database based on the search information, and then send the determined application data entries back to the browser. The browser can then obtain the application data entries corresponding to the search information and use them as application data in a data table.
[0118] For example, when the data search information corresponds to the data identifier entered by the user, after receiving the data search information, the server can search for application data that matches each data identifier in the target database and return the application data that matches each data identifier to the browser. Then, the browser can use each piece of application data returned by the server as application data in the data table.
[0119] When the data search information corresponds to a data table identifier entered by the user, the server, upon receiving the search information, can search the target database for the data table that matches each data table identifier and then return the application data from each data table to the browser. Thus, the browser can obtain the application data corresponding to each data table.
[0120] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0121] Based on the same inventive concept, this disclosure also provides an information prediction device corresponding to the information prediction method. Since the principle of the device in this disclosure for solving the problem is similar to that of the information prediction method described above, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0122] like Figure 2 The diagram shown is a schematic representation of an information prediction device provided in an embodiment of this disclosure, comprising:
[0123] The acquisition module 201 is used to acquire the data table corresponding to the front-end application, wherein each piece of application data in the data table is pre-stored in the target database;
[0124] The determination module 202 is used to extract at least one field and the field value of each field from each piece of application data using a pre-created web worker, and to determine the current metadata of each piece of application data in the data table based on the extracted at least one field and the field value of each field.
[0125] The update module 203 is used to update and store the metadata of each piece of application data based on the current metadata corresponding to each piece of application data; wherein the metadata is used to characterize the basic attributes of the application data.
[0126] In one possible implementation, the update module 203 is used to determine whether the historical metadata is consistent with the current metadata if historical metadata of the previously stored application data exists.
[0127] If the historical metadata is inconsistent with the current metadata, the previously stored historical metadata of the application data and the current metadata are used as the updated metadata corresponding to the application data and stored.
[0128] In one possible implementation, the device further includes:
[0129] The editing module 204 is used to update and store the metadata of each piece of application data, and in response to a data editing request for any piece of application data in the data table, generate and display the editing prompt information corresponding to the application data based on the metadata of that piece of application data; the editing prompt information is used to prompt the user to edit the data according to the basic attributes indicated by the metadata.
[0130] In one possible implementation, the determining module 202 is used to traverse each piece of application data using a depth-first traversal algorithm to determine at least one field included in the application data and the field value corresponding to each field.
[0131] For each field currently traversed, determine the field type based on the field value.
[0132] Based on the number of fields in the application data, the field value corresponding to each field, and the field type corresponding to each field, the current metadata of the application data is determined.
[0133] In one possible implementation, the determining module 202 is used to combine multiple field types into a union type when it is determined that the field type corresponding to the field includes multiple field types based on the field value corresponding to the field, and to use the union type as the final field type of the field.
[0134] In one possible implementation, the acquisition module 201 is used to acquire at least one piece of data search information input by the user;
[0135] Based on the data search information, each piece of application data corresponding to the data search information is obtained from the target database corresponding to the server, and the obtained application data is used as the application data in the data table.
[0136] In one possible implementation, the target database includes a MongoDB database.
[0137] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.
[0138] This disclosure also provides a computer device, such as... Figure 3 The diagram shown is a schematic representation of a computer device structure provided in an embodiment of this disclosure, including:
[0139] The processor 31 and memory 32 are provided. The memory 32 stores machine-readable instructions executable by the processor 31. The processor 31 executes the machine-readable instructions stored in the memory 32. When the machine-readable instructions are executed by the processor 31, the processor 31 performs the following steps: S101: Obtain the data table corresponding to the front-end application. Each piece of application data in the data table is pre-stored in the target database; S102: Using a pre-created web worker, extract at least one field and the field value of each piece of application data. Based on the extracted at least one field and the field value of each field, determine the current metadata of each piece of application data in the data table; and S103: Based on the determined current metadata of each piece of application data, update and store the metadata of each piece of application data. The metadata is used to characterize the basic attributes of the application data.
[0140] The aforementioned memory 32 includes a main memory 321 and an external memory 322; the main memory 321, also known as internal memory, is used to temporarily store the computational data in the processor 31, as well as the data exchanged with external memory 322 such as a hard disk. The processor 31 exchanges data with the external memory 322 through the main memory 321.
[0141] The specific execution process of the above instructions can be referred to the steps of the information prediction method described in the embodiments of this disclosure, and will not be repeated here.
[0142] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the information prediction method described in the above-described method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
[0143] The computer program product of the information prediction method provided in this disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the steps of the information prediction method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.
[0144] The computer program product can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0145] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.
[0146] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0147] In addition, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0148] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0149] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.
Claims
1. An information prediction method, characterized in that, Applied to browsers, including: The server retrieves the data table corresponding to the front-end application running in the browser. Each piece of application data in the data table is pre-stored in the target database. The target database is pre-created on the server to manage the application data generated by the front-end application. A pre-created web worker is used to create sub-threads through the main thread running the browser, and some tasks are assigned to the sub-threads to extract at least one field and the value of each field from each piece of application data. Based on the extracted at least one field and the value of each field, the missing metadata for each piece of application data in the data table is determined. The main thread and the sub-threads do not interfere with each other. The sub-threads run in the background while the main thread is running, and the sub-threads return the results to the main thread after completing their tasks. Based on the current metadata corresponding to each piece of application data determined by the browser, each piece of application data in the acquired data table is processed, and the metadata of each piece of application data is updated and stored; wherein, the metadata is used to characterize the basic attributes of the application data. The step of extracting at least one field and the field value of each piece of application data, and determining the current metadata of each piece of application data in the data table based on the extracted at least one field and the field value of each field, includes: For each piece of application data, a depth-first traversal algorithm is used to traverse the application data to determine at least one field included in the application data, and the field value corresponding to each field. For each field currently traversed, the field type corresponding to the field is determined by calculation based on the field value corresponding to the field; Based on the application data, including the number of fields, the field value corresponding to each field, and the field type corresponding to each field, the current metadata of the application data is determined.
2. The method according to claim 1, characterized in that, The metadata of each piece of application data is updated and stored, including: If historical metadata for this application data exists, determine whether the historical metadata is consistent with the current metadata. If the historical metadata is inconsistent with the current metadata, the previously stored historical metadata of the application data and the current metadata are used as the updated metadata corresponding to the application data and stored.
3. The method according to claim 2, characterized in that, After updating and storing the metadata for each piece of application data, the method further includes: In response to a data editing request for any application data in the data table, an editing prompt message is generated and displayed based on the metadata corresponding to the application data; the editing prompt message is used to prompt the user to edit the data according to the basic attributes indicated by the metadata.
4. The method according to claim 1, characterized in that, Based on the field value corresponding to the field, determine the field type corresponding to the field, including: If, based on the field value corresponding to the field, it is determined that there are multiple field types corresponding to the field, the multiple field types are combined into a union type, and the union type is used as the final field type of the field.
5. The method according to claim 1, characterized in that, The step of obtaining the data table corresponding to the front-end application from the server includes: Retrieve at least one piece of search information from user input; Based on the data search information, each piece of application data corresponding to the data search information is obtained from the target database corresponding to the server, and the obtained application data is used as the application data in the data table.
6. The method according to any one of claims 1 to 5, characterized in that, The target database includes the MongoDB database.
7. An information prediction device, characterized in that, include: The acquisition module is used to obtain the data table corresponding to the front-end application running in the browser from the server. Each piece of application data in the data table is pre-stored in the target database. The target database is a pre-created database on the server used to manage the application data generated by the front-end application. The module is configured to utilize a pre-created web worker to create sub-threads through the main thread running in the browser and assign some tasks to the sub-threads for execution. This is to extract at least one field and the value of each field from each piece of application data, and based on the extracted at least one field and the value of each field, determine the current metadata corresponding to each piece of application data in the data table that is missing from the application data. The main thread and the sub-threads operate independently; the sub-threads run in the background while the main thread runs, and the sub-threads return the results to the main thread upon completing their tasks. The update module is used to process each piece of application data in the acquired data table based on the current metadata corresponding to each piece of application data determined by the browser, and to update and store the metadata of each piece of application data; wherein, the metadata is used to characterize the basic attributes of the application data; The step of extracting at least one field and the field value of each piece of application data, and determining the current metadata of each piece of application data in the data table based on the extracted at least one field and the field value of each field, includes: For each piece of application data, a depth-first traversal algorithm is used to traverse the application data to determine at least one field included in the application data, and the field value corresponding to each field. For each field currently traversed, the field type corresponding to the field is determined by calculation based on the field value corresponding to the field; Based on the application data, including the number of fields, the field value corresponding to each field, and the field type corresponding to each field, the current metadata of the application data is determined.
8. A computer device, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, the processor executing the machine-readable instructions stored in the memory, wherein when the machine-readable instructions are executed by the processor, the processor performs the steps of the information prediction method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a computer device, performs the steps of the information prediction method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and system for dynamically returning data, and server-side
CN106506661A
Webpage data processing method and device, electronic equipment and storage medium
CN112799948A