Blood glucose data storage method and device, electronic equipment and storage medium
By dividing blood glucose monitoring equipment into hot equipment and cold equipment, and selecting different databases for storage according to the device type, the problems of poor read and write performance and high storage costs in traditional blood glucose data storage solutions are solved, and the effect of reducing storage costs and improving read and write performance is achieved.
Patent Information
- Application Number
- CN202410011253.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-02
- Publication Date
- 2025-05-30
Smart Images

Figure CN120067072A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage, and in particular, to a blood glucose data storage method, apparatus, electronic device, and storage medium. Background Art
[0002] A CGM (Continuous Glucose Monitoring) device can collect blood glucose data from the human body at a frequency of 1 time per minute and report it to the cloud. A CGM device manufactured according to modern manufacturing processes can be used continuously for 14 days, that is, a total of 20,160 blood glucose data are collected and reported to the cloud during the entire life cycle of a CGM device; in the case where 10,000 CGM devices need to report blood glucose data to the cloud, 201,600,000 blood glucose data need to be stored and queried. It can be seen that there is usually a large amount of blood glucose data that needs to be stored and queried.
[0003] However, traditional blood glucose data storage solutions usually cannot meet the storage and query requirements for a large amount of blood glucose data, and are prone to problems such as poor read and write performance and high storage costs.
[0004] Therefore, how to improve the read and write performance of a large amount of blood glucose data while reducing the storage cost is an urgent problem to be solved at present. Summary of the Invention
[0005] The present invention provides a blood glucose data storage method, apparatus, electronic device, and storage medium, which are used to solve the defects in the prior art that usually cannot meet the storage and query requirements for a large amount of blood glucose data, and are prone to problems such as poor read and write performance and high storage costs, and to realize the cold and hot separation of devices, and selectively store data in different databases, so as to improve the read and write performance of a large amount of blood glucose data while reducing the storage cost.
[0006] The present invention provides a blood glucose data storage method, and the method includes:
[0007] Receiving the currently reported blood glucose data of a blood glucose monitoring device;
[0008] Determining the device type of the blood glucose monitoring device;
[0009] When the blood glucose monitoring device is a hot device, storing the currently reported blood glucose data in a first database;
[0010] When the blood glucose monitoring device changes from a hot device to a cold device, migrating the blood glucose data of the blood glucose monitoring device stored in the first database to a second database.
[0011] A blood glucose data storage method provided by the present invention, the determining the device type of the blood glucose monitoring device includes:
[0012] Determine the target cycle range;
[0013] Determine the blood glucose monitoring devices with a life cycle within the target cycle range as hot devices, and determine the blood glucose monitoring devices with a life cycle not within the target cycle range as cold devices.
[0014] A blood glucose data storage method provided by the present invention, the determining the target cycle range includes:
[0015] Determine the target cycle range according to the business usage requirements of the blood glucose data of the blood glucose monitoring device.
[0016] A blood glucose data storage method provided by the present invention, in the case where the blood glucose monitoring device is a hot device, storing the currently reported blood glucose data in the first database includes:
[0017] In the case where the blood glucose monitoring device is a hot device, perform binary serialization on the currently reported blood glucose data;
[0018] Store the serialized blood glucose data in the first database.
[0019] A blood glucose data storage method provided by the present invention, the performing binary serialization on the currently reported blood glucose data includes:
[0020] Perform Protobuf serialization on the reported blood glucose data.
[0021] A blood glucose data storage method provided by the present invention further includes:
[0022] In the case where the blood glucose monitoring device is a cold device, store the currently reported blood glucose data in the second database.
[0023] A blood glucose data storage method provided by the present invention, the first database is MongoDB, and the second database is Object Storage Service OSS.
[0024] The present invention also provides a blood glucose data storage device, including:
[0025] A blood glucose data receiving module, configured to receive the blood glucose data currently reported by the blood glucose monitoring device;
[0026] A device type determining module, configured to determine the device type of the blood glucose monitoring device;
[0027] A first storage module, configured to store the currently reported blood glucose data in a first database when the blood glucose monitoring device is a hot device;
[0028] A second storage module, configured to migrate the blood glucose data of the blood glucose monitoring device stored in the first database to a second database when the blood glucose monitoring device changes from a hot device to a cold device.
[0029] The present invention further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the steps of the blood glucose data storage method described in any one of the above are implemented.
[0030] The present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the blood glucose data storage method described in any one of the above are implemented.
[0031] The blood glucose data storage method, device, electronic device, and storage medium provided by the present invention divide the blood glucose monitoring device into a hot device and a cold device. The blood glucose data reported by the hot device is only temporarily stored in the first database, and when the hot device changes to a cold device, the blood glucose data of the blood glucose monitoring device is migrated from the first database to the second database for persistent storage, realizing targeted selection of different databases for storage. On the one hand, it can significantly reduce the storage pressure of the first database, thereby reducing the overall storage cost. On the other hand, since the storage space usage of the first database is reduced, when processing a large number of read and write requests for hot device blood glucose data, the limited memory resources can focus on processing frequently read and written hot data, thereby improving the effective load and throughput of the entire system and improving the read and write performance of hot device blood glucose data. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0033] Figure 1 is a flowchart of the blood glucose data storage method provided by an embodiment of the present invention;
[0034] Figure 2 is a data flow diagram of the blood glucose data provided by an embodiment of the present invention;
[0035] Figure 3 is a structural diagram of the blood glucose data storage device provided by an embodiment of the present invention;
[0036] Figure 4 It is a schematic structural diagram of the electronic device provided by the embodiment of the present invention. Specific embodiments
[0037] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings in the present invention. Obviously, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present invention without making creative efforts shall fall within the protection scope of the present invention.
[0038] The industry usually adopts a relational database or a document database for data storage. According to the business relationship between CGM devices and blood glucose data, that is, one device is associated with 20,160 pieces of blood glucose data, two storage schemes can be adopted. One is to store by device granularity, and the other is to store by single-piece blood glucose data granularity. Four storage schemes in this context are introduced below respectively.
[0039] (1) Store by device granularity using a relational database
[0040] Taking the current mainstream relational database PostgreSQL as an example, two tables, namely a device table and a blood glucose data table, can be designed. Among them, the device table can include a device ID (Identity Document) field with a uniqueness constraint and other auxiliary business fields. The blood glucose data table can include a device ID field with a uniqueness constraint, a blood glucose data field, and other auxiliary business fields. The blood glucose data field can adopt the jsonb type, and each piece of blood glucose data can be appended to the blood glucose data field after being serialized in json format. The 20,160 pieces of blood glucose data of a CGM device with a complete life cycle are only centrally stored in one blood glucose data record. Even for 10,000 devices, there are only 10,000 rows of blood glucose data records.
[0041] However, although the number of records of a large amount of blood glucose data in the database is small, the number of bytes occupied by each blood glucose data record is very large. When performing append storage and query of blood glucose data, the read and write performance is very low. When blood glucose data is uploaded in real time, the relational database needs to load all the blood glucose data of the device from the disk into the memory, then append the incremental blood glucose data and then flush it into the disk. And a large number of operation logs will be generated during this period. Frequent disk read and write will ultimately lead to a decrease in database performance.
[0042] (2) Store by single-piece blood glucose data granularity using a relational database
[0043] Taking the current mainstream relational database PostgreSQL as an example, it is also possible to design two tables: a device table and a blood glucose data table. The blood glucose data table can contain a device ID field without a uniqueness constraint and 15 fields for blood glucose data, and use the device ID + the index value index in the 15 fields of each blood glucose data as a composite primary key. Each piece of blood glucose data can be saved as an independent record in the blood glucose data table, and a CGM device with a complete life cycle has 20,160 records.
[0044] However, due to the generation of a large number of database record rows, for example, 10,000 devices will have more than 200 million records. Therefore, the performance of PostgreSQL when querying tables with more than ten million data rows far fails to meet the requirements of regular business.
[0045] In summary, relational databases are not suitable for storing a large amount of blood glucose data.
[0046] (3) Use a document database for storage by device granularity
[0047] Taking the current mainstream document database MongoDB as an example, a blood glucose data collection can be designed. The documents in this collection can contain a device ID with a uniqueness constraint and blood glucose data fields, and use the device ID as the index of the document. The 20,160 pieces of blood glucose data of a CGM device with a complete life cycle are only centrally stored in one blood glucose data document. Even for 10,000 devices, there are only 10,000 blood glucose data documents stored in the blood glucose data collection.
[0048] However, although the number of blood glucose data documents is small, the documents occupy a large amount of space. When appending and storing blood glucose data, MongoDB will continuously apply for memory from the operating system, resulting in frequent system calls and greatly reducing the service performance. When querying, since it is impossible to establish a database secondary index for the blood glucose data index index inside a single document, when it is necessary to page query the blood glucose data under a certain device, it is necessary to perform 20,160 loop matches, resulting in a reduction in query performance.
[0049] (4) Use a document database for storage by single-piece blood glucose data granularity
[0050] Taking the current mainstream document database MongoDB as an example, a blood glucose data collection can be designed. The documents in this collection can contain a device ID without a uniqueness constraint and 15 fields for blood glucose data, and use the device ID + the index value index in the 15 fields of each blood glucose data as a composite index. A CGM device with a complete life cycle will have 20,160 documents stored in the blood glucose data collection.
[0051] However, although this solution can improve the read and write performance, the space occupied by the index is too large. Since the storage space of MongoDB is relatively expensive, as the business volume continues to grow, the storage cost will also continue to rise.
[0052] In summary, the disadvantages of the above four storage solutions are shown in Table 1 below:
[0053] Solution Read performance Write performance Storage cost Index space Solution 1 Low Low High Low Solution 2 Low Medium Relatively high Relatively high Solution 3 Relatively high Relatively high Relatively low Low Solution 4 Highest Highest Highest Relatively high
[0054] Table 1
[0055] Therefore, how to improve the read and write performance of a large amount of blood glucose data while reducing the storage cost is an urgent problem to be solved at present. In the embodiments of the present invention, by dividing blood glucose monitoring devices into hot devices and cold devices and selectively choosing different databases for storage, it is possible to improve the read and write performance of a large amount of blood glucose data while reducing the storage cost.
[0056] Figure 1 is a schematic flowchart of the blood glucose data storage method provided by the embodiments of the present invention. Referring to Figure 1 , the embodiments of the present invention provide a blood glucose data storage method, and the method may specifically include the following steps:
[0057] Step 101, receive the blood glucose data currently reported by the blood glucose monitoring device.
[0058] The execution subject of the blood glucose data storage method provided by the embodiments of the present invention may be a cloud server. The blood glucose monitoring device may continuously collect blood glucose data from the human body at a preset collection frequency. Every time the blood glucose monitoring device collects a piece of blood glucose data, it will report this piece of blood glucose data to the cloud server in real time. During the entire life cycle of the blood glucose monitoring device, a large amount of blood glucose data can be continuously collected and reported to the cloud server.
[0059] In the embodiments of the present invention, the cloud server may be communicatively connected to multiple blood glucose monitoring devices. The cloud server may receive the blood glucose data reported by multiple blood glucose monitoring devices, and may continuously receive multiple pieces of blood glucose data currently reported in real time by each blood glucose monitoring device and store them in the database, so as to realize the storage of a large amount of blood glucose data continuously reported by a large number of blood glucose monitoring devices.
[0060] Among them, the blood glucose monitoring device may refer to a blood glucose monitoring device that can continuously collect and report a large amount of blood glucose data, such as a CGM device, and the present invention is not limited thereto.
[0061] Among them, the preset collection frequency may be set to 1 time / minute or 2 times / minute, and the present invention does not limit the specific setting of the collection frequency here.
[0062] Step 102, determine the device type of the blood glucose monitoring device.
[0063] When the cloud server receives a piece of blood glucose data currently reported in real time by the blood glucose monitoring device, it can determine the device type of the blood glucose monitoring device, and thus determine the blood glucose data storage method based on the device type.
[0064] Among them, the device type can include hot devices and cold devices, and different databases can be selected to store the blood glucose data reported by different types of devices, so as to optimize the overall storage cost.
[0065] Step 103, when the blood glucose monitoring device is a hot device, store the currently reported blood glucose data in the first database.
[0066] In the embodiment of the present invention, a document-based database can be used as the first database. A blood glucose data collection can be designed in the first database. The documents in this blood glucose data collection can include a device ID field with a uniqueness constraint and multiple fields of blood glucose data (i.e., multiple attributes, and the values are numerical types), such as 15 fields of blood glucose data, and the device ID is used as the index of the document. Multiple pieces of blood glucose data of at least one blood glucose monitoring device with a complete life cycle can be centrally stored in a blood glucose data document.
[0067] When the blood glucose monitoring device reports the currently collected blood glucose data, it can also report the device ID. In the embodiment of the present invention, when it is determined that the device type of the blood glucose monitoring device is a hot device, the target document for storing the blood glucose data of the blood glucose monitoring device can be searched in the first database according to the device ID of the blood glucose monitoring device, and the currently reported blood glucose data of the blood glucose monitoring device can be stored in the target document.
[0068] It should be noted that the fields included in the blood glucose data collected by different blood glucose monitoring devices may be different. In actual applications, the documents in the blood glucose data collection of the first database can store other fields that are not exactly the same as the above 15 fields of blood glucose data, and the present invention does not limit this here.
[0069] Step 104, when the blood glucose monitoring device changes from a hot device to a cold device, migrate the blood glucose data of the blood glucose monitoring device stored in the first database to the second database.
[0070] In the embodiment of the present invention, after the blood glucose data reported by the blood glucose monitoring device with the device type of a hot device is stored in the first database, it can be monitored whether the device type of the blood glucose monitoring device changes.
[0071] In the case where the device type of the blood glucose monitoring device changes, that is, the blood glucose monitoring device changes from a hot device to a cold device, all the blood glucose data reported by the blood glucose monitoring device stored in the first database can be migrated to the second database for storage.
[0072] Among them, the second database is different from the first database, and the second database can be a database for persistently storing blood glucose data.
[0073] In the embodiment of the present invention, the blood glucose monitoring device is divided into a hot device and a cold device. The blood glucose data reported by the hot device is only temporarily stored in the first database, and when the hot device changes to a cold device, the blood glucose data of the blood glucose monitoring device is migrated from the first database to the second database for persistent storage, so as to selectively store in different databases. On the one hand, it can significantly reduce the storage pressure of the first database, thereby reducing the overall storage cost. On the other hand, since the storage space usage of the first database is reduced, when processing read and write requests for a large amount of blood glucose data of hot devices, the limited memory resources can focus on processing frequently read and written hot data, thereby improving the effective load and throughput of the entire system and improving the read and write performance of the blood glucose data of hot devices.
[0074] In an optional embodiment, the first database is MongoDB, and the second database is the Object Storage Service OSS.
[0075] MongoDB is a database based on distributed file storage, which can provide an extensible high-performance data storage solution. In the embodiment of the present invention, the first database can be a document database, and the document database can be MongoDB.
[0076] Alibaba Cloud OSS (Object Storage Service) is a cloud-based object storage service, which is a massive, secure, stable, low-cost, and highly reliable cloud storage service. In the embodiment of the present invention, OSS can be Alibaba Cloud OSS.
[0077] In the embodiment of the present invention, by storing the blood glucose data of the hot device in the more performant document database MongoDB, and when the hot device changes to a cold device, migrating the blood glucose data of the cold device to the more cost-effective object storage service, that is, the OSS service of Alibaba Cloud, it can significantly reduce the storage pressure of the MongoDB server and make the limited memory resources focus on processing frequently read and written hot data, thereby further improving the read and write performance of the hot data.
[0078] In an alternative embodiment, the determining the device type of the blood glucose monitoring device includes: determining a target cycle range; determining a blood glucose monitoring device with a life cycle within the target cycle range as a hot device, and determining a blood glucose monitoring device with a life cycle not within the target cycle range as a cold device.
[0079] In the embodiment of the present invention, it is possible to determine whether the life cycle of a blood glucose monitoring device is within the target cycle range, and classify the blood glucose monitoring device into a hot device and a cold device according to the judgment result.
[0080] Specifically, for a blood glucose monitoring device with a life cycle within the target cycle range, the blood glucose data of this blood glucose monitoring device is usually read and written frequently, and it can be determined that this blood glucose monitoring device is a hot device; for a blood glucose monitoring device with a life cycle not within the target cycle range, the blood glucose data of this blood glucose monitoring device is rarely read and written, and it can be determined that this blood glucose monitoring device is a cold device.
[0081] In the embodiment of the present invention, by classifying devices into hot devices and cold devices according to the target cycle range, different databases can be selectively used for storage, thereby optimizing the overall storage cost, reducing the burden on the MongoDB database, and improving the throughput of the entire system.
[0082] In an alternative embodiment, the determining the target cycle range includes: determining the target cycle range according to the business usage requirements of the blood glucose data of the blood glucose monitoring device.
[0083] Specifically, based on the business usage requirements of the blood glucose data of the blood glucose monitoring device in the actual business scenario, the corresponding business attributes can be determined, and then the target cycle range can be set according to the business attributes. The business attributes in different business scenarios are different, and the set target cycle ranges can also be different.
[0084] As an example, in the business scenario where the blood glucose data of a user within 14 days can be queried on the relative's side of the user and a report can be generated based on the blood glucose data of the user within 14 days, the target cycle range can be set to one device life cycle (i.e., 14 days), so as to classify hot devices and cold devices by determining whether the life cycle of the blood glucose monitoring device is within one life cycle.
[0085] As another example, in the business scenario where the blood glucose data of a user within 28 days can be queried on the relative's side of the user and a report can be generated based on the blood glucose data of the user within 28 days, the target cycle range can be set to two device life cycles (i.e., 28 days), so as to classify hot devices and cold devices by determining whether the life cycle of the blood glucose monitoring device is within two life cycles.
[0086] In the embodiments of the present invention, by classifying blood glucose monitoring devices into hot devices and cold devices according to business usage requirements (business attributes), different databases can be selectively used for storage, thereby optimizing the overall storage cost, reducing the burden on the MongoDB database, and improving the throughput of the entire system.
[0087] In an alternative embodiment, when the blood glucose monitoring device is a hot device, storing the currently reported blood glucose data in the first database includes: when the blood glucose monitoring device is a hot device, performing binary serialization on the currently reported blood glucose data; storing the serialized blood glucose data in the first database.
[0088] Binary serialization may refer to the process of converting a data object from its original form into binary data. During binary serialization, the attributes and values of the data object can be converted into binary codes for transmission or persistent storage on files, networks, or storage devices. In the embodiments of the present invention, when the blood glucose monitoring device is a hot device, binary serialization can be performed on the currently reported blood glucose data of the hot device, and the binary serialized blood glucose data can be written into the MongoDB database.
[0089] In the embodiments of the present invention, by performing binary serialization on the currently reported blood glucose data of the hot device and writing the binary serialized blood glucose data into MongoDB, the size of the blood glucose data of a single device can be compressed. Compared with the JSON storage method, the storage space requirement can be reduced by half, greatly reducing the storage space usage of MongoDB, effectively improving the bandwidth utilization rate, enhancing the throughput capacity of the MongoDB service, and further improving the read and write performance.
[0090] In an alternative embodiment, performing binary serialization on the currently reported blood glucose data includes: performing Protobuf serialization on the reported blood glucose data.
[0091] Protobuf serialization is a binary serialization format that can be used for efficient data exchange between different computer systems. Compared with other serialization formats, Protobuf has higher efficiency and smaller data size. In the embodiments of the present invention, when the blood glucose monitoring device is a hot device, Protobuf serialization can be performed on the currently reported blood glucose data of the hot device, and the Protobuf serialized blood glucose data can be written into the MongoDB database.
[0092] In the embodiment of the present invention, by performing Protobuf serialization on the currently reported blood glucose data of the thermal device and writing the Protobuf-serialized blood glucose data into MongoDB, not only can the storage space be made more compact, but also the performance of serialization and deserialization can be improved.
[0093] In an optional embodiment, the method further includes: when the blood glucose monitoring device is a cold device, storing the currently reported blood glucose data in the second database.
[0094] Specifically, when it is determined that the blood glucose monitoring device for the currently reported blood glucose data is a cold device, the currently reported blood glucose data of the cold device can be stored in the OSS service in real time, thereby avoiding the problem that the storage space is insufficient due to the blood glucose data reported by the cold device being stored in MongoDB, and further avoiding the problem that when a large number of read and write requests for the blood glucose data of the thermal device need to be processed, the limited memory resources cannot focus on processing the frequently read and written hot data, resulting in a decrease in the read and write performance of the blood glucose data of the thermal device.
[0095] Figure 2 It is a schematic diagram of the data flow of the blood glucose data provided by the embodiment of the present invention. Refer to Figure 2 , the CGM device can report a piece of blood glucose data to the cloud every 1 minute, and the cloud can provide cloud upload services and cloud archiving services. When the cloud determines that the CGM device is a thermal device, it can serialize the currently reported blood glucose data in the Protobuf manner and store it in the MongoDB server in real time; when the cloud determines that the CGM device is a cold device, it can store the currently reported blood glucose data in the OSS service in real time.
[0096] When the blood glucose monitoring device changes from a thermal device to a cold device, the archived device data can be queried from MongoDB and written into the OSS server, thereby migrating the blood glucose data of the device stored in MongoDB to the Alibaba Cloud OSS service.
[0097] In the embodiment of the present invention, by classifying the blood glucose monitoring device into a thermal device and a cold device, the blood glucose data reported by the thermal device is only temporarily stored in the first database, and when the thermal device changes to a cold device, the blood glucose data of the blood glucose monitoring device is migrated from the first database to the second database for persistent storage, realizing targeted selection of different databases for storage. On the one hand, the storage pressure on the first database can be significantly reduced, thereby reducing the overall storage cost. On the other hand, since the storage space usage of the first database is reduced, when a large number of read and write requests for the blood glucose data of the thermal device need to be processed, the limited memory resources can focus on processing the frequently read and written hot data, thereby improving the effective load and throughput of the entire system and improving the read and write performance of the blood glucose data of the thermal device.
[0098] The blood glucose data storage device provided by the present invention will be described below. The blood glucose data storage device described below can be correspondingly referred to the blood glucose data storage method described above.
[0099] Figure 3 It is a schematic structural diagram of the blood glucose data storage device provided by an embodiment of the present invention. Referring to Figure 3 An embodiment of the present invention provides a blood glucose data storage device, which may specifically include the following modules:
[0100] A blood glucose data receiving module 301, configured to receive the blood glucose data currently reported by a blood glucose monitoring device;
[0101] A device type determining module 302, configured to determine the device type of the blood glucose monitoring device;
[0102] A first storage module 303, configured to store the currently reported blood glucose data in a first database when the blood glucose monitoring device is a hot device;
[0103] A second storage module 304, configured to migrate the blood glucose data of the blood glucose monitoring device stored in the first database to a second database when the blood glucose monitoring device changes from a hot device to a cold device.
[0104] In an optional embodiment, the device type determining module is specifically configured to:
[0105] Determine a target cycle range;
[0106] Determine the blood glucose monitoring devices with a life cycle within the target cycle range as hot devices, and determine the blood glucose monitoring devices with a life cycle not within the target cycle range as cold devices.
[0107] In an optional embodiment, the device type determining module is specifically configured to:
[0108] Determine a target cycle range according to the service usage requirements of the blood glucose data of the blood glucose monitoring device.
[0109] In an optional embodiment, the first storage module is specifically configured to:
[0110] When the blood glucose monitoring device is a hot device, perform binary serialization on the currently reported blood glucose data;
[0111] Store the serialized blood glucose data in the first database.
[0112] In an optional embodiment, the first storage module is specifically configured to:
[0113] Perform Protobuf serialization on the reported blood glucose data.
[0114] In an alternative embodiment, the device further includes:
[0115] A third storage module, configured to store the currently reported blood glucose data in the second database when the blood glucose monitoring device is a cold device.
[0116] In an alternative embodiment, the first database is MongoDB and the second database is Object Storage Service (OSS).
[0117] In the embodiment of the present invention, the blood glucose monitoring devices are classified into hot devices and cold devices. The blood glucose data reported by hot devices is only temporarily stored in the first database, and when a hot device changes to a cold device, the blood glucose data of the blood glucose monitoring device is migrated from the first database to the second database for persistent storage, realizing targeted selection of different databases for storage. On the one hand, it can significantly reduce the storage pressure of the first database, thereby reducing the overall storage cost. On the other hand, since the storage space usage of the first database is reduced, when dealing with read and write requests for a large amount of blood glucose data of hot devices, the limited memory resources can focus on processing frequently read and written hot data, thereby improving the effective load and throughput of the entire system and enhancing the read and write performance of blood glucose data of hot devices.
[0118] Figure 4 An example of the entity structure diagram of an electronic device is shown as Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430, and a communication bus 440. Among them, the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 can call the logical instructions in the memory 430 to execute the blood glucose data storage method, and the method includes:
[0119] Receive the currently reported blood glucose data of the blood glucose monitoring device;
[0120] Determine the device type of the blood glucose monitoring device;
[0121] When the blood glucose monitoring device is a hot device, store the currently reported blood glucose data in the first database;
[0122] When the blood glucose monitoring device changes from a hot device to a cold device, migrate the blood glucose data of the blood glucose monitoring device stored in the first database to the second database.
[0123] In addition, when the logical instructions in the above-mentioned memory 430 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0124] In another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is configured to execute the blood glucose data storage method provided by the above-mentioned various methods. The method includes:
[0125] Receiving the blood glucose data currently reported by a blood glucose monitoring device;
[0126] Determining the device type of the blood glucose monitoring device;
[0127] When the blood glucose monitoring device is a hot device, storing the currently reported blood glucose data in a first database;
[0128] When the blood glucose monitoring device changes from a hot device to a cold device, migrating the blood glucose data of the blood glucose monitoring device stored in the first database to a second database.
[0129] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative effort.
[0130] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0131] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for storing blood sugar data, characterized in that: The method comprises: Receive blood sugar data currently reported by blood sugar monitoring equipment; Determining a device type of the blood glucose monitoring device; In the case where the blood glucose monitoring device is a thermal device, storing the currently reported blood glucose data in a first database; When the blood glucose monitoring device is changed from a hot device to a cold device, the blood glucose data of the blood glucose monitoring device stored in the first database is migrated to the second database.
2. The method according to claim 1, characterized in that The determining the device type of the blood glucose monitoring device comprises: Determine the target cycle range; The blood glucose monitoring devices whose life cycles are within the target cycle range are determined as hot devices, and the blood glucose monitoring devices whose life cycles are not within the target cycle range are determined as cold devices.
3. The method according to claim 2, characterized in that Determining the target cycle range includes: A target cycle range is determined according to business usage requirements of the blood glucose data of the blood glucose monitoring device.
4. The method according to claim 1, characterized in that When the blood glucose monitoring device is a thermal device, storing the currently reported blood glucose data in a first database includes: In the case where the blood glucose monitoring device is a thermal device, binary serializing the currently reported blood glucose data; The serialized blood sugar data is stored in the first database.
5. The method according to claim 4, characterized in that The binary serialization of the currently reported blood sugar data includes: The reported blood sugar data is serialized in Protobuf format.
6. The method according to claim 1, characterized in that Also includes: In the case where the blood glucose monitoring device is a cold device, the currently reported blood glucose data is stored in the second database.
7. The method according to any one of claims 1 to 6, characterized in that: The first database is MongoDB, and the second database is object storage service OSS.
8. A blood sugar data storage device, characterized in that: include: A blood sugar data receiving module, used to receive the blood sugar data currently reported by the blood sugar monitoring device; A device type determination module, used to determine the device type of the blood glucose monitoring device; A first storage module, configured to store the currently reported blood sugar data in a first database when the blood sugar monitoring device is a thermal device; The second storage module is used to migrate the blood glucose data of the blood glucose monitoring device stored in the first database to the second database when the blood glucose monitoring device is changed from a hot device to a cold device.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the blood glucose data storage method according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the blood glucose data storage method according to any one of claims 1 to 7 is implemented.