nightscout / cgm-remote-monitor

nightscout web monitor
GNU Affero General Public License v3.0
2.4k stars 71.68k forks source link

Admin Tool needed to clean Mongo profile database #8144

Open oddst opened 11 months ago

oddst commented 11 months ago

When Nightscout is used with the Loop app, a problem arises too often for many users in connection with Nightscout. The Loop app sends extremely variable length records when it uploads data to Nightscout’s profile collection in MongoDB. It seems that these records also are not very indexed, so a number of problems arise typically when the profile collection has 1,500 documents or more. Examples of problems are:

Describe the solution you'd like Ideally, the profile collection should be restructured to handle the situation when all settings in Loop incl. all override definitions get store in one single record in the profile collection. This is just not a scalable design.

If not, then having an easy “clean Mongo profile database” option, similar to the other clean options - should be made available as one of the admin tools in Nightscout…! It should probably default to clean everything in the data collection except the 10-100 last records…

Describe alternatives you've considered As specified in the nightscout.github.io documentation, a user can go into the MongoDB user interface, and delete and then recreate (or cause an upload of settings to make Nightscout recreate) the profile collection (empty). But many users find this too complicated and want to avoid doing it - if at all possible.

There are also tools available to edit the MongoDB profile collection, but that is only an approach for people working with IT as a profession,

Additional context Usage (on/off/length) of Overrides in Loop is stored in the DeviceStatus collection, but that presents less of a problem - and any problem can usually be solved from the admin tools in Nightscout (unless the situation is extreme, but then nightscout.github.io specifies how to solve this as well - but this is a less likely situation to get into).

iAPS probably will have some of the same challenges, when iAPS now starts to upload/download profile data (basis settings so far, but more settings will come). iAPS is today not uploading the “Profile” definitions (somewhat similar as Loop override definitions), but will most likely do so shortly.

So this challenge will just increase if it is not done anything with…! ;)