StephenBlackWasAlreadyTaken / xDrip-Experimental

Experimental Branches for Collaboration on DexDrip
GNU General Public License v3.0
25 stars 62 forks source link

Chart Filtered Data / Database Schema updates / Treatment model #334

Closed jamorham closed 8 years ago

jamorham commented 8 years ago

This adds an optional plot of the filtered data readings available from WiFi Wixels / Parakeet / xBridge etc. (Note the grey line and dots on the attached screen shot)

To facilitate this, the database schema is changed to add filtered_calculated_value to the BgReadings table.

At the same time the BgReadings UUID field is enforced as actually unique and a model is added for Treatments

This mirrors the database structure used by xDrip+ which takes the database field names from Nightscout for easier integration of treatments syncing etc. These changes make the database structure compatible between xDrip+ and xDrip.

screenshot_2016-04-27-10-35-46

AdrianLxM commented 8 years ago

Thanks @jamorham.

I really like this PR. Having the option to show a curve with the filtered values really may come in handy when the sensor gets noisy. Being on the same DB level makes it possible for people that have tested xDrip+ to switch back to xDrip without loss of data :p And the treatments class almost looks like a promise that we soon will get treatment entries/uploads as well ;)

tzachi-dar commented 8 years ago

Looks good.

A few comments questions: 1) Will also need to upload the filtered_calculated_value for xDripViewer. 2) What is the reason for the changes to the index change? +DROP INDEX index_BgReadings_uuid; +CREATE UNIQUE INDEX index_BgReadings_uuid on BgReadings(uuid);

3) Seems that we will need to have some fixes for the cases that there is no data for 20 minutes or so.

We can either fix now, or merge this pr and fix later.

Tzachi

jamorham commented 8 years ago

With xDripViewer, do you mean this section? https://github.com/StephenBlackWasAlreadyTaken/xDrip-Experimental/blob/master/app/src/main/java/com/eveningoutpost/dexdrip/Services/XDripViewer.java#L148L156

The index change on BgReadings is to ensure that the UUID field is absolutely unique in the database (as it should be) - Sqlite unique fields are enforced using a unique index. Creating the index has the same effect as the field being set unique and so it migrates the table.

I'm not sure what issue you mean in point 3?

AdrianLxM commented 8 years ago

@tzachi-dar

We can either fix now, or merge this pr and fix later.

If it doesn't crash the xDripViewer if there is no data (it is defaulted to 0), I'd say, we can merge it and add the up/download for xDripViewer later.

tzachi-dar commented 8 years ago

Ok, I'm merging it. Hope to have a pr for xDripviewer ready tomorrow.

jamorham commented 8 years ago

Many thanks