Data storage method and device, electronic equipment, storage medium and product
By storing template data to the first database and the second database in the clinical trial data acquisition system, the problem of complex operation of relational databases when adjusting data structures is solved, the flexibility and security of data storage are realized, and the system performance is improved.
Patent Information
- Application Number
- CN202510110645.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-05-23
AI Technical Summary
In the clinical trial data acquisition system, the configuration of the electronic case report form template is complex and flexible, resulting in complex and cumbersome operation of relational databases when adjusting the data structure, and is prone to causing data consistency and transaction processing problems.
By responding to a template release request, the template data is obtained and stored in the first database and the second database respectively; when responding to the input data request, the template data in the second database is output; when responding to the data submission request, the input data is obtained and stored in the first database. This method uses the second database to alleviate the access pressure of the first database and simplifies the process of data structure adjustment.
It realizes the flexibility and security of data storage, simplifies the data storage and query process, and improves system performance and data management efficiency.
Smart Images

Figure CN120030025A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of data processing technology, and more particularly to data storage methods, devices, electronic devices, storage media, and products. Background Art
[0002] In professional clinical trial data capture (EDC) systems, configuring electronic case report form (eCRF) templates is a complex and flexible process. EDC is a computer network-based technology for clinical trial data collection. Through the integration of software, hardware, standard operating procedures, and personnel, it directly collects and transmits clinical data in electronic form. While managers can freely configure the template structure during project creation, it is often difficult to define all the details at once. This is because the CRF template structure will constantly change as the project progresses, requiring dynamic addition, modification, and deletion operations.
[0003] Relational databases organize data through a strict relationship model of rows and columns and are well-known in the field of data storage for their structure and consistency. This model has the advantages of clear data structure, easy to understand and maintain, and the ACID characteristics (Atomicity, Consistency, Isolation, Durability) ensure the consistency and integrity of the data. However, this structural advantage also brings its inherent limitations. When fields and attributes need to be expanded, the operation of relational databases can be particularly complex and cumbersome because they require strict constraints between rows and columns. This leads to a huge workload when adjusting the data structure and easily causes data consistency and transaction processing issues. Summary of the Invention
[0004] Embodiments of the present disclosure provide data storage methods, devices, electronic devices, storage media, and products.
[0005] In a first aspect, an embodiment of the present disclosure provides a data storage method, the method comprising:
[0006] In response to receiving a template publishing request, acquiring template data, and storing the template data in a first database and a second database respectively;
[0007] In response to receiving a data entry request, outputting the template data in the second database;
[0008] In response to receiving the data submission request, the input data is acquired and stored in the first database.
[0009] In some optional implementations, after storing the input data in the first database, the method further includes:
[0010] Acquire query data and store the query data in the first database, wherein the query data is used to characterize erroneous data in the input data;
[0011] In response to receiving the query data acquisition request, outputting the query data in the first database;
[0012] In response to receiving the query data modification request, modification data is obtained; and based on the modification data, corresponding input data in the first database is modified.
[0013] In some optional embodiments, the method further comprises:
[0014] Before receiving the template publishing request for the first time, the working status is set to the initial status;
[0015] In response to receiving the template publishing request, setting the working state to a template updating state;
[0016] After storing the template data in the first database and the second database respectively, setting the working state to a data updating state;
[0017] After the input data is stored in the first database, the working state is set to a normal state.
[0018] In some optional embodiments, the method further comprises:
[0019] When the working state is the initial state, in response to receiving a data entry request, a data submission request, a questioned data acquisition request and / or a questioned data modification request, a first error prompt is output.
[0020] In some optional embodiments, the method further comprises:
[0021] When the working state is the template update state, in response to receiving a template publishing request, applying for a distributed mutex; in response to obtaining the distributed mutex, acquiring updated template data; and using the updated template data, updating the template data in the first database and the second database;
[0022] When the working state is the template update state, in response to receiving a data entry request, applying for a distributed mutex lock; in response to obtaining the distributed mutex lock, outputting the template data in the second database;
[0023] When the working state is a template update state, in response to receiving a data submission request, discarding the input data in the data submission request and outputting a second error prompt;
[0024] When the working state is a template updating state, in response to receiving a questioned data acquisition request, ignoring the questioned data acquisition request and outputting a third error prompt;
[0025] When the working state is the template updating state, in response to receiving the questioned data modification request, the questioned data acquisition request is ignored and a fourth error prompt is output.
[0026] In some optional implementations, after setting the working state to a data update state, the method further includes:
[0027] Determine whether there is any data entered in the first database;
[0028] If yes, updating the input data in the first database according to the template data of the first database;
[0029] The working state is set to a normal state.
[0030] In some optional embodiments, the method further comprises:
[0031] When the working state is the data update state, in response to receiving a template publishing request, stopping the execution of the template data according to the first database, updating the input data in the first database; recording a log; and transferring the working state to the template update state;
[0032] When the working state is a data updating state, in response to receiving a data entry request, outputting the template data in the second database;
[0033] When the working state is the data update state, in response to receiving a data submission request, determining whether the version number of the input data in the currently received data submission request is the same as the version number of the template data in the first database; if so, updating the input data in the first database using the input data in the currently received data submission request; if not, discarding the input data in the currently received data submission request and outputting a fifth error prompt;
[0034] When the working state is a data update state, in response to receiving a query data acquisition request, outputting query data having a version number identical to that of the template data in the first database;
[0035] When the working status is the data update status, in response to receiving a request to modify the questioned data, obtain the modified data; determine whether the version number of the modified data is the same as the version number of the template data in the first database; if so, modify the corresponding input data in the first database based on the modified data; if not, ignore the modified data and output a sixth error prompt.
[0036] In a second aspect, an embodiment of the present disclosure provides a data storage device, the device comprising:
[0037] a template publishing module, configured to obtain template data in response to receiving a template publishing request, and store the template data in the first database and the second database respectively;
[0038] a template output module, configured to output the template data in the second database in response to receiving a data entry request;
[0039] The data entry module is used to obtain entry data in response to receiving a data submission request, and store the entry data in the first database.
[0040] In a third aspect, an embodiment of the present disclosure provides an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner in the first aspect.
[0041] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by one or more processors, implements the method described in any implementation manner in the first aspect.
[0042] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the method described in any implementation manner in the first aspect.
[0043] To facilitate data structure adjustment, embodiments of the present disclosure provide data storage methods, devices, electronic devices, storage media, and products. In response to a template publishing request, the methods first obtain template data and store the template data in a first database and a second database, respectively. Furthermore, in response to a data entry request, the methods output the template data in the second database. Subsequently, in response to a data submission request, the methods obtain entry data and store the entry data in the first database. This reduces the pressure on the first database to access template data, ensures smooth updates of template and entry data in the first database, and enhances the security and integrity of data storage. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Other features, objects, and advantages of the present disclosure will become more apparent upon reading the detailed description of non-limiting embodiments made with reference to the following drawings. The drawings are for illustration purposes only and are not to be considered as limiting the present disclosure. In the drawings:
[0045] Figure 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure may be applied;
[0046] Figure 2 is a flow chart of an embodiment of a data storage method according to the present disclosure;
[0047] Figure 3 is a flow chart of another embodiment of the data storage method according to the present disclosure;
[0048] Figure 4 is a state transition scenario diagram according to an embodiment of the data storage method of the present disclosure;
[0049] Figure 5 is a structural diagram of an embodiment of a data storage device according to the present disclosure;
[0050] Figure 6 It is a schematic diagram of the structure of a computer system of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION
[0051] The present disclosure will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to illustrate the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the relevant invention are shown in the accompanying drawings.
[0052] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0053] Figure 1 An exemplary system architecture 100 is shown to which embodiments of the data storage method, apparatus, electronic device, storage medium, and product of the present disclosure may be applied.
[0054] like Figure 1As shown, system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. Network 104 is a medium for providing communication links between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0055] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as data storage applications, voice recognition applications, short video social applications, audio and video conferencing applications, live video applications, document editing applications, input method applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0056] Terminal devices 101, 102, and 103 can be hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various electronic devices with display screens, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, Moving Picture Experts Group Audio Layer 3), MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Group Audio Layer 4) players, laptop computers, and desktop computers, etc. When terminal devices 101, 102, and 103 are software, they can be installed in the terminal devices listed above. It can be implemented as multiple software or software modules (for example, to provide data storage services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0057] In some cases, the data storage method provided by the present disclosure may be executed by the terminal devices 101, 102, 103, and accordingly, the data storage device may be provided in the terminal devices 101, 102, 103. In this case, the system architecture 100 may also not include the server 105.
[0058] In some cases, the data storage method provided by the present disclosure can be jointly performed by terminal devices 101, 102, 103 and server 105. For example, the steps of "responding to receiving a template publishing request, obtaining template data and storing the template data in the first database and the second database, respectively" can be performed by terminal devices 101, 102, 103, and steps such as "responding to receiving a data entry request, outputting the template data in the second database" can be performed by server 105. This disclosure is not limited to this. Accordingly, data storage devices can also be provided in terminal devices 101, 102, 103 and server 105, respectively.
[0059] In some cases, the data storage method provided by the present disclosure may be executed by the server 105 , and accordingly, the data storage device may also be set in the server 105 . In this case, the system architecture 100 may also not include the terminal devices 101 , 102 , and 103 .
[0060] It should be noted that the server 105 can be hardware or software. When the server 105 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server 105 is software, it can be implemented as multiple software or software modules (for example, to provide distributed services), or it can be implemented as a single software or software module. No specific limitations are given here.
[0061] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0062] In a clinical trial's electronic data capture (EDC) system, template data is configured when a project is created. Template data, including visits, forms, and variables, together form the basic framework for data collection and management.
[0063] A project refers to a specific clinical trial study, covering the entire process from trial design, data collection to data analysis and reporting. In the EDC system, the project is the highest level of data management and contains all information and data related to the trial. A project usually includes multiple visits, each of which represents a specific stage or time point in the trial. For example, in a drug efficacy study, it may include baseline visits, mid-term visits, and final visits. During the project creation stage, managers can configure various parameters and settings for the project, such as project name, research plan, participants, data access rights, etc.
[0064] Template data defines the CRF template structure of the project, that is, defines which forms and variables the project contains, as well as the relationship and logic between them.
[0065] A form is a spreadsheet used to collect data for a specific visit or phase. It's a component of a project, designed to meet specific visit or data collection needs. A form typically contains multiple variables, each representing a data point or piece of information to be collected.
[0066] For example, a baseline visit form may include variables such as "age," "sex," and "weight." The form design needs to be based on the purpose and requirements of the trial to ensure that the required data can be collected comprehensively and accurately.
[0067] When designing a form, you can consider the type of variables (such as text, numbers, dates, etc.), the data input method (such as single choice, multiple choice, text box, etc.), the data validation rules (such as range restrictions, format requirements, etc.), etc.
[0068] During project implementation, the EDC system can provide flexible form management functions, and can adjust forms according to actual conditions, such as adding new variables, modifying the options or properties of existing variables, etc.
[0069] A variable is a field or data point used to record specific data in a form. It is the smallest unit of data collection and represents the specific information that needs to be observed and recorded in a project. Each variable has specific properties, such as data type (such as text, number, date, etc.), input format (such as text box, drop-down list, etc.), validation rules (such as required field, range restriction, etc.), and whether it is optional. These properties define the characteristics of the variable and the data entry requirements. Each attribute can also be composed of multiple values. For example, for a "single-choice" question type, it is necessary to define a varying number of answer "options" for it.
[0070] During the actual data entry process, relevant personnel will enter the corresponding data in the fields corresponding to each form and variable based on the output template data. For example, enter the participant's age in the text box of the "Age" variable.
[0071] The input data will be verified by the system or manually to form questioned data, which will be saved in the database for subsequent data management and analysis.
[0072] Reference below Figure 2 , which shows a process 200 according to an embodiment of the data storage method of the present disclosure, the process 200 includes the following steps 201 to 206:
[0073] Step 201 : in response to receiving a template publishing request, obtaining template data, and storing the template data in a first database and a second database respectively.
[0074] A template release request is used to publish a template structure. After creating a new project, relevant personnel can configure and publish the template release request on the front-end page as needed. Upon receiving the template release request, the terminal device can retrieve the template data configured in the template release request and store the template data in the first and second databases respectively.
[0075] The first database is used to store template data and input data.
[0076] As a possible implementation, the first database can employ various NoSQL databases. NoSQL databases are typically designed as high-performance and scalable systems. They support a distributed architecture and can be horizontally scaled by adding more servers, thereby increasing data storage capacity and processing capabilities. Many NoSQL databases also support automatic partitioning and load balancing, enabling efficient handling of large-scale data and high-concurrency access.
[0077] Preferably, the first database can be MongoDB, a NoSQL database. MongoDB is a document-based database, the most feature-rich and relational-like non-relational database. It uses a JSON-formatted document model to store data, making data storage highly flexible and providing a scalable, high-performance data storage solution for applications. These features make it a highly flexible and feature-rich database solution, particularly suitable for processing large amounts of semi-structured or unstructured data.
[0078] During the design of the first database, template tables and data tables can be created for visits, forms, and variables, respectively. The structure of the data tables can be automatically created and dynamically adjusted based on the fields in the template tables. Data identifiers (e.g., template ID and data ID) can be used as primary keys to establish relationships between the visit data table, form data table, and variable data table. These data identifiers can also be combined to form a key value for accessing the second database.
[0079] If only the first database is designed, every time relevant personnel prepare to enter data, they need to filter out the template data required for this entry from the template data in the first database and output it to the front-end page. At the same time, when different relevant personnel are entering data at the same time, they need to compete for the resources of the first database. Therefore, the first database will be accessed frequently. In order to reduce the pressure on the database, this embodiment sets up a second database and synchronously stores the template structure data in the second database. In this way, when entering data, the template data can be directly obtained from the second database, which not only improves access speed but also diverts requests to access the first database.
[0080] As a possible implementation, the second database may be various cache databases, such as Redis, KeyDB, etc.
[0081] Among them, Redis is a key-value database. The value is the template data, and the key can be defined according to the template data and the characteristics of the actual business. For example, the key value is composed of the data identifiers (for example, template ID and data ID, etc.) of the visit data table, form data table, and variable data table.
[0082] First, each project has template data, so the key value needs to include the project ID. Second, front-end operations are mostly performed on a form-by-form basis, so the value can be the template data for a form, so the key value also needs to include the form ID. Once assigned, the project ID and form ID remain unchanged, even through multiple template upgrades, making them suitable for use as key values.
[0083] As a possible implementation method, when entering template data for a project, the environment can be divided into a verification environment and an online environment. The template data of the same project in different environments may be different, so the environments can be distinguished.
[0084] For example, a Key value might be composed of: environment ID:project ID:form ID. The environment ID consists of letters, while the project ID and form ID are both letters and numbers, separated by the ASCII character ":". For example, verify:project001:form001, where verify is the verification environment, project001 is the project ID, and form001 is the form ID. The Value is the form's template data, and since the form is a list of variables, the Value is defined as a List type, with all its components being variables.
[0085] Furthermore, the second database can have a cold start function. During initial startup, this embodiment can trigger a check to determine whether the second database contains template data. If not, the template data in the first database is read and stored in the second database. Due to the stability of the template structure data, once cached, it does not expire due to time or other constraints, unlike ordinary data. The template data in the second database can be retained until a new version is available.
[0086] As a possible implementation, since storing data in the first and second databases in step 201 cannot be completed within a single transaction, a distributed locking mechanism can be used to ensure the atomicity of these two operations. This locking mechanism can ensure that when reading template data, even if the template data is being updated, the error of reading different versions of the template data will not occur, thereby maintaining data consistency and integrity.
[0087] Step 202: In response to receiving a data entry request, output template data in the second database.
[0088] When a data entry request is received, the corresponding form data structure can be generated according to the template data configured in the project, and output to the front end and displayed to relevant personnel so that relevant personnel can fill in the data corresponding to the variables in the form one by one according to the prompts and requirements of the form.
[0089] Step 203: In response to receiving the data submission request, obtain the input data and store the input data in the first database.
[0090] When a data submission request is received, it indicates that the relevant person has entered and submitted the data corresponding to a form or variable. Therefore, these input data can be obtained and stored in the corresponding position of the first database after identification or other necessary processing.
[0091] It should be noted that the storage location of template data and input data can be set according to specific needs and is not specifically limited here.
[0092] As a possible implementation, to ensure data integrity and traceability, version control can be implemented for template data and input data using version numbers. For example, if a person submits input data for a template with version number 1.1, the input data will also have version number 1.1. This way, each modification will be recorded with a version number, making it easier for managers to track and manage data change history.
[0093] As a possible implementation, after step 203, the process 200 may further include:
[0094] Step 204: Obtain the query data and store it in the first database.
[0095] Questionable data refers to data that has questions or problems regarding accuracy, completeness, consistency, validation rules, etc. This data may be caused by errors in data collection, transmission, storage, or inconsistent data replication in a distributed architecture.
[0096] Questionable data can be discovered through the database's own validation mechanisms, such as MongoDB's data validation features, or through program logic checks, such as discovering data that doesn't conform to expectations when validating data against business rules at the application layer. Furthermore, questionable data can be discovered through human verification, such as when a data analyst, during data cleaning and analysis, discovers that certain data doesn't align with common business practices or historical data trends, raising questions about the data.
[0097] Whether through automated verification or manual inspection, the questioned data requires further investigation and processing to ensure the quality and reliability of the data stored in the database. Therefore, the questioned data needs to be obtained and stored in the first database.
[0098] Step 205: In response to receiving the query data acquisition request, output the query data in the first database.
[0099] Since the questioned data is used to characterize the erroneous data in the input data, the relevant personnel will issue a questioned data acquisition request so as to modify it. When the questioned data acquisition request is received, the questioned data in the first database can be output to the front-end page so that the relevant personnel can provide modified data for it.
[0100] Step 206 : In response to receiving the query data modification request, obtain modification data, and modify the corresponding input data in the first database based on the modification data.
[0101] Modified data refers to the data entry resubmitted by the relevant personnel in response to the questioned data. Subsequently, based on the modified data, the corresponding entry record in the primary database is located. After verification, the entry in the primary database is modified, and the data in the database is updated. This process includes checks for data relevance, integrity, and consistency to ensure database quality.
[0102] For example, suppose a person's age data is recorded as "25 years old" when it should actually be "30 years old." After the relevant person discovers the error and submits a request to modify the data, the system receives the modified data as "30 years old." Based on this modified data, the system finds the incorrect record in the first database and corrects it to "30 years old." It also checks other information associated with the age data, such as date of birth and ID number, to ensure that this information matches the modified age data, maintaining the integrity and consistency of the database data.
[0103] In summary, the data storage method proposed in the above-mentioned embodiments of the present disclosure stores template data in a first database and a second database. During data entry, only the cached data in the second database is read, reducing queries to the first database, improving access speed, diverting requests, enhancing system performance, and facilitating efficient data management. This data storage method can enhance data storage flexibility and security, simplify the access process, and make data queries more convenient and efficient.
[0104] In the actual execution process, the above process 200 may receive Figure 2 The five types of requests shown (i.e., template publishing request, data entry request, data submission request, query data acquisition request, and query data modification request) access the first database or the second database, interrupting the data storage process.
[0105] Therefore, a special database storage service module can be designed and developed based on object-oriented technology to handle database access services and define a unified interface for accessing the first database to achieve two major functions: one is to realize the service function of accessing the first database through the state machine mechanism; the other is to manage the second database, maintain the consistency of cached data and the first database data, and convert the request for accessing the template structure into accessing the second database.
[0106] When processing the above five requests, you can refer to the four working states of "Initial", "Template Update", "Data Update", and "Normal" set by the state machine. If the same request is received in different states, different processing processes will occur.
[0107] To ensure safety, except for the "normal" state, the other three states have limited functions and may not support all subsequent operations.
[0108] The following combination Figure 3 and Figure 4 , Figure 3 is a process 300 of another embodiment of the data storage method of the present disclosure, Figure 4 This is a state transition scenario diagram of an embodiment of the data storage method disclosed herein. The process 300 includes steps 301 to 304:
[0109] Step 301: before receiving a template publishing request for the first time, set the working state to an initial state.
[0110] When the working state is the initial state, since no template has been released, it is impossible to submit input data, and there will be no input data or query data in the database. In this way, in response to receiving a request to enter data, submit data, obtain query data, or modify query data, a first error prompt is output so that the user can make the above requests again after the template is released.
[0111] Step 302: In response to receiving the template publishing request, the working state is set to the template updating state; the template data is acquired, and the template data is stored in the first database and the second database respectively.
[0112] After receiving the template publishing request, the working state is first changed to the template updating state, and then the process of "obtaining template data and storing the template data in the first database and the second database respectively" is executed, which is the template updating process.
[0113] Various requests may also be received during the execution of step 302. Since this state lasts very short and its main task is to update the first and second databases, there are some restrictions on accessing the databases in this state. Some requests to access the databases may need to wait or be denied access.
[0114] The specific processing flow for different requests is as follows:
[0115] First, in response to receiving a template publish request, a distributed mutex lock is first applied. This lock mechanism ensures that no other processes or threads can simultaneously operate on the template data in the first and second databases during the template data update process, thus avoiding data conflicts and inconsistencies.
[0116] After successfully acquiring the distributed mutex, the updated template data is obtained. The updated template data is the template data in the template publish request received this time. The updated template data is then used to update the template data in the first and second databases, ensuring consistency between the template data in the two databases.
[0117] This request is still updating the template, so the working status is not transferred.
[0118] Second, when receiving a data entry request, a distributed mutex lock is also requested. This measure is to ensure that there is no interference from other operations when reading template data, thereby ensuring data accuracy and consistency.
[0119] After obtaining the distributed mutex lock, the template data in the second database is output, along with version information. This data will be used for subsequent data entry operations, providing users with an accurate template structure and ensuring that the format and content of the entered data meet the requirements.
[0120] This request does not affect template updates in the database, so the working state is not transferred.
[0121] Third, in response to receiving a data submission request, the input data in the request can be directly discarded and a second error message can be output. This second error message can be used to remind the user to redo the operation, without limitation. This processing mechanism is designed to avoid data errors caused by version inconsistencies during template data updates. This ensures that only input data based on the latest template data is accepted and processed, thereby maintaining data consistency and accuracy.
[0122] This request is effectively rejected, so the work status is not transferred.
[0123] Fourth, in response to receiving a query data acquisition request, the request will be ignored and a third error message will be output. This third error message can be used to remind the user to redo the operation, without limitation. This is because the query configuration may change during template data updates. Ignoring the request prevents the user from operating based on an outdated configuration, thereby avoiding potential data inconsistencies.
[0124] This request is effectively rejected, so the work status is not transferred.
[0125] Fifth, in response to receiving a request to modify the query data, the request will be ignored and a fourth error message will be output. This fourth error message can be used to remind the user to redo the operation, without limitation. This measure is to ensure that after the template data is updated, the user can modify the configuration based on the latest query, ensuring data accuracy and consistency.
[0126] This request is effectively rejected, so the work status is not transferred.
[0127] If the request event is rejected, the relevant personnel will generally try again. Since the template update process is fast, the status may have been transferred to "data update" when the next request is made.
[0128] Step 303, setting the working state to the data update state; in response to receiving the data entry request, outputting the template data in the second database; in response to receiving the data submission request, obtaining the entry data, and storing the entry data in the first database.
[0129] After the template is updated, it will automatically enter the data update state. If there is already input data in the first database, it is necessary to perform adaptive synchronization on the input data.
[0130] Therefore, step 303 may also include: determining whether there is entry data in the first database. If there is entry data, the entry data in the first database can be updated according to the template data of the first database to ensure the accuracy and consistency of the data. After the update is completed, the working state can be reset to normal and restored to a state where requests can be processed normally. If there is no entry data, it is necessary to wait for the execution of "responding to receiving a request to enter data, outputting the template data in the second database; responding to receiving a request to submit data, obtaining the entry data, and storing the entry data in the first database" to perform data update.
[0131] At the same time, when accessing the database in the data update state, the consistency of the database must be considered. The access processing logic is the most complex and different processing is required according to different access requests.
[0132] The specific processing flow for different requests is as follows:
[0133] First, in response to receiving a template publishing request, it will immediately stop "updating the input data in the first database according to the template data of the first database" to ensure that the consistency and accuracy of the data update are not disturbed; at the same time, the log of this event can be recorded, including key information such as time and operator, for subsequent tracing and problem troubleshooting.
[0134] Receiving this request is equivalent to stopping the execution of step 303 and jumping to step 302. Therefore, after the jump, the working state will be transferred to "template update".
[0135] Second, in response to receiving a data entry request, the template data in the second database is output. This data will be used for subsequent entry operations, providing users with an accurate template structure and ensuring that the format and content of the entered data meet the requirements.
[0136] This request does not affect the data update of the database, so the working status is not transferred.
[0137] Third, in response to receiving a data submission request, the system first obtains the version number of the data entered in the data submission request. This version number is then compared with the version number of the template data in the first database. If the two version numbers match, the entered data matches the current database template and can be used to update the entered data in the first database. Conversely, if the version numbers do not match, the entered data may be based on an outdated template. To avoid data confusion, the entered data will be discarded and a fifth error message will be displayed to the user, prompting them to resubmit the entered data to ensure data consistency and validity.
[0138] This request is still updating data, so the working status is not transferred.
[0139] Fourth, in response to a query data acquisition request, query data with a version number that matches the template data version number in the first database is filtered and output. This ensures that the query data obtained by the user is valid data based on the latest template update, accurately reflecting the current system data state and business logic, and providing a reliable basis for subsequent data processing and analysis.
[0140] This request does not affect data updates, so the working status is not transferred.
[0141] Fifth, in response to receiving a request to modify questioned data, the modified data is first obtained. Next, it is determined whether the version number of the modified data is the same as the version number of the template data in the first database. If the version numbers are consistent, it indicates that the modified data is based on the latest template, and the corresponding input data in the first database will be modified based on the modified data to ensure real-time updating and accuracy of the database data; if the version numbers are different, it means that the modified data may not have been synchronized or is based on an old template. To ensure data quality, the system will decisively ignore the modified data and output the sixth error prompt to the user, so as to prompt the user to re-acquire the questioned data before performing the modification operation, thereby maintaining the integrity and reliability of the database data.
[0142] This request is still updating data, so the working status is not transferred.
[0143] Step 304: Set the working state to normal state.
[0144] After executing step 303, the system automatically jumps to set the working state to normal state. Normal state refers to the state after the template structure database and the history database have been upgraded and updated. At this time, the data in all databases are completely consistent and there are no restrictions when accessing the database.
[0145] The specific processing flow for different requests is as follows:
[0146] First, in response to receiving the template publishing request, jump to step 302 to transfer the working state.
[0147] Second, in response to receiving a data entry request, the template data in the second database is output and version information is provided without transferring the working state.
[0148] Third, in response to receiving the data submission request, the input data is obtained and stored in the first database without transferring the working state.
[0149] Fourth, in response to receiving the query data acquisition request, the query data in the first database is output without transferring the working state.
[0150] Fifth, in response to receiving the query data modification request, the modification data is obtained, and based on the modification data, the corresponding input data in the first database is modified without transferring the working state.
[0151] In summary, in the data storage method proposed in the above-mentioned embodiment of the present disclosure, the first database utilizes its unstructured storage mechanism to enable the template structure data to be flexibly modified and expanded, and the database can adapt to changes in fields and attributes. At the same time, the database storage service module can provide access services with different restrictions according to the different working states of the database, ensuring the security of database access during template upgrades. In addition, the template structure data is stored as a hotspot in the second database, and when accessing this data, it can be directly obtained from the second database without accessing the first database, thereby improving IO performance and diverting access requests to the first database.
[0152] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a data storage device. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0153] like Figure 5 As shown, the data storage device 500 of this embodiment includes: a template publishing module 501 , a template output module 502 and a data input module 503 .
[0154] The template publishing module 501 is configured to obtain template data in response to receiving a template publishing request, and store the template data in the first database and the second database respectively;
[0155] The template output module 502 is configured to output the template data in the second database in response to receiving a data entry request;
[0156] The data entry module 503 is configured to obtain entry data in response to receiving a data submission request, and store the entry data in the first database.
[0157] In this embodiment, the specific processing of the data storage device 500 and the technical effects thereof can be referred to in Figure 2 The relevant descriptions of steps 201 to 203 in the corresponding embodiment are not repeated here.
[0158] In some optional implementations, the data storage device 500 further includes:
[0159] Questioning the data acquisition module ( Figure 5(not shown), for acquiring questioned data and storing the questioned data in the first database, wherein the questioned data is used to characterize erroneous data in the input data;
[0160] Question data output module ( Figure 5 (not shown) for outputting the questioned data in the first database in response to receiving a questioned data acquisition request;
[0161] Question data modification module ( Figure 5 (not shown) for obtaining modification data in response to receiving a query data modification request; and modifying the corresponding input data in the first database based on the modification data.
[0162] In some optional implementations, the data storage device 500 further includes:
[0163] Initial state module ( Figure 5 (not shown) for setting the working state to an initial state before receiving a template publishing request for the first time;
[0164] Template Update Status Module ( Figure 5 (not shown) for setting the working state to a template update state in response to receiving a template publishing request;
[0165] Data update status module ( Figure 5 (not shown) for setting the working state to a data update state after storing the template data in the first database and the second database respectively;
[0166] Normal status module ( Figure 5 (not shown) is used to set the working state to a normal state after storing the input data in the first database.
[0167] In some optional implementations, the data storage device 500 further includes:
[0168] Initial processing module ( Figure 5 (not shown) is used to output a first error prompt in response to receiving a data entry request, a data submission request, a questioned data acquisition request and / or a questioned data modification request when the working state is the initial state.
[0169] In some optional implementations, the data storage device 500 further includes:
[0170] The first template update processing module ( Figure 5(not shown) for, when the working state is a template update state, applying for a distributed mutex in response to receiving a template publishing request; acquiring updated template data in response to obtaining the distributed mutex; and updating the template data in the first database and the second database using the updated template data;
[0171] The second template update processing module ( Figure 5 (not shown) for, when the working state is the template update state, in response to receiving a data entry request, applying for a distributed mutex lock; in response to obtaining the distributed mutex lock, outputting the template data in the second database;
[0172] The third template update processing module ( Figure 5 (not shown) for discarding the input data in the data submission request and outputting a second error prompt in response to receiving the data submission request when the working state is the template update state;
[0173] The fourth template update processing module ( Figure 5 (not shown) for, when the working state is the template update state, ignoring the questioned data acquisition request in response to receiving the questioned data acquisition request, and outputting a third error prompt;
[0174] The fifth template update processing module ( Figure 5 (not shown) for ignoring the questioned data acquisition request and outputting a fourth error prompt in response to receiving a questioned data modification request when the working state is a template update state.
[0175] In some optional implementations, the data storage device 500 further includes:
[0176] Judgment module ( Figure 5 (not shown) for determining whether there is data entered into the first database;
[0177] Data update module ( Figure 5 (not shown) for updating the input data in the first database according to the template data of the first database, if any;
[0178] State switching module ( Figure 5 (not shown) for setting the working state to a normal state.
[0179] In some optional implementations, the data storage device 500 further includes:
[0180] The first data update processing module ( Figure 5(not shown), for, when the working state is the data update state, in response to receiving a template publishing request, stopping execution of the template data according to the first database, updating the input data in the first database; recording a log; and transferring the working state to the template update state;
[0181] The second data update processing module ( Figure 5 (not shown) for outputting the template data in the second database in response to receiving a data entry request when the working state is a data update state;
[0182] The third data update processing module ( Figure 5 (not shown), configured to, when the working state is the data update state, in response to receiving a data submission request, determine whether the version number of the input data in the currently received data submission request is the same as the version number of the template data in the first database; if so, update the input data in the first database using the input data in the currently received data submission request; if not, discard the input data in the currently received data submission request and output a fifth error prompt;
[0183] The fourth data update processing module ( Figure 5 (not shown) for, when the working state is the data update state, in response to receiving a query data acquisition request, outputting query data having a version number identical to that of the template data in the first database;
[0184] The fifth data update processing module ( Figure 5 (not shown), used for obtaining modified data in response to receiving a request to modify questioned data when the working state is a data update state; judging whether the version number of the modified data is the same as the version number of the template data in the first database; if so, modifying the corresponding input data in the first database based on the modified data; if not, ignoring the modified data and outputting a sixth error prompt.
[0185] It should be noted that the implementation details and technical effects of each module and unit in the data storage device provided by the embodiments of the present disclosure can be referred to the description of other embodiments in the present disclosure and will not be repeated here.
[0186] Reference below Figure 6 , which shows a schematic structural diagram of a computer system 600 suitable for implementing the electronic device of the present disclosure. Figure 6 The computer system 600 shown is only an example and should not bring any limitation to the functions and usage scope of the embodiments of the present disclosure.
[0187] like Figure 6As shown, the computer system 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the computer system 600 are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0188] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the computer system 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The computer system 600 of the electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0189] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0190] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0191] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0192] The computer readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device can realize the following operation: Figure 2 The illustrated embodiment and its alternative implementations illustrate a method for storing data.
[0193] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0194] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0195] The units or modules involved in the embodiments described in this disclosure may be implemented in software or hardware. The name of a unit or module does not, in some cases, limit the unit itself. For example, a template output module may also be described as "a module for, in response to receiving a template publishing request, obtaining template data and storing the template data in a first database and a second database, respectively."
[0196] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also encompasses other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in the present disclosure.
Claims
1. A data storage method, characterized in that: include: In response to receiving a template publishing request, acquiring template data, and storing the template data in a first database and a second database respectively; In response to receiving a data entry request, outputting the template data in the second database; In response to receiving the data submission request, the input data is acquired and stored in the first database.
2. The method according to claim 1, characterized in that After storing the input data in the first database, the method further includes: Acquire query data, and store the query data in the first database, wherein the query data is used to characterize erroneous data in the input data; In response to receiving the query data acquisition request, outputting the query data in the first database; In response to receiving the query data modification request, modification data is obtained, and based on the modification data, corresponding input data in the first database is modified.
3. The method according to claim 2, characterized in that The method further comprises: Before receiving the template publishing request for the first time, the work status is set to the initial status; In response to receiving the template publishing request, setting the working state to a template updating state; After storing the template data in the first database and the second database respectively, setting the working state to a data updating state; After the input data is stored in the first database, the working state is set to a normal state.
4. The method according to claim 3, characterized in that The method further comprises: When the working state is the initial state, in response to receiving a data entry request, a data submission request, a question data acquisition request and / or a question data modification request, a first error prompt is output.
5. The method according to claim 3, characterized in that: The method further comprises: When the working state is the template update state, in response to receiving a template publishing request, applying for a distributed mutex lock; in response to obtaining the distributed mutex lock, acquiring updated template data; using the updated template data, updating the template data in the first database and the second database; When the working state is a template update state, in response to receiving a data entry request, applying for a distributed mutex lock; in response to obtaining the distributed mutex lock, outputting the template data in the second database; When the working state is a template update state, in response to receiving a data submission request, discarding input data in the data submission request and outputting a second error prompt; When the working state is a template updating state, in response to receiving a question data acquisition request, ignoring the question data acquisition request and outputting a third error prompt; When the working state is a template updating state, in response to receiving a question data modification request, the question data acquisition request is ignored, and a fourth error prompt is output.
6. The method according to claim 5, characterized in that After setting the working state to a data updating state, the method further includes: Determine whether there is any data entered in the first database; If yes, updating the input data in the first database according to the template data of the first database; The working state is set to a normal state.
7. The method according to claim 6, characterized in that The method further comprises: When the working state is a data update state, in response to receiving a template publishing request, stopping the execution of the template data according to the first database, updating the input data in the first database; recording a log; and transferring the working state to a template update state; When the working state is a data updating state, in response to receiving a data entry request, outputting the template data in the second database; When the working state is the data update state, in response to receiving a data submission request, determining whether the version number of the input data in the data submission request received this time is the same as the version number of the template data in the first database; if so, using the input data in the data submission request received this time to update the input data in the first database; if not, discarding the input data in the data submission request received this time, and outputting a fifth error prompt; When the working state is a data update state, in response to receiving a query data acquisition request, outputting query data having a version number identical to a version number of the template data in the first database; When the working status is the data update status, in response to receiving a request to modify questioned data, obtain modified data; determine whether the version number of the modified data is the same as the version number of the template data in the first database; if so, modify the corresponding input data in the first database based on the modified data; if not, ignore the modified data and output a sixth error prompt.
8. A data storage device, characterized in that: include: A template publishing module, configured to obtain template data in response to receiving a template publishing request, and store the template data in the first database and the second database respectively; A template output module, configured to output the template data in the second database in response to receiving a data entry request; The data entry module is used to obtain the entry data in response to receiving the data submission request, and store the entry data in the first database.
9. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, wherein when the computer program is executed by one or more processors, the method according to any one of claims 1 to 7 is implemented.
11. A computer program product, characterized in that The method comprises a computer program / instruction, which implements the method according to any one of claims 1 to 7 when executed by a processor.