Skip to content

New stats#516

Open
codebymini wants to merge 30 commits intodevfrom
new-stats
Open

New stats#516
codebymini wants to merge 30 commits intodevfrom
new-stats

Conversation

@codebymini
Copy link
Collaborator

@codebymini codebymini commented Jan 31, 2026

This PR adds a new Statistics experience, a full Treatments workflow, and a more flexible Tab/Menu customization system.

  • Introduces a new stats screen with date-range support, core glucose/insulin metrics, and visualizations for AGP, TIR (including tight range toggle), and GRI.
  • Adds data availability handling and stats data-fetching logic so calculations can run against the selected date range.
  • Adds a Treatments screen with grouped history, pull-to-refresh, pagination (“Load more”), and treatment detail views with contextual Loop/device data when available.
  • Adds treatment filtering so users can quickly narrow to carbs, basal, and bolus-related entries (including automatic/SMB/manual distinctions).
  • Refactors tab customization to dynamic drag/reorder behavior, letting users control which items appear in the top tabs vs Menu.
  • Updates storage and migration logic to support the new tab-position model and preserve compatibility for existing users.
  • Updates navigation/menu integration so Stats and Treatments can be accessed cleanly via tabs/menu depending on user configuration.

@marionbarker
Copy link
Collaborator

For Loop, at least, stats should go by whole days. Otherwise Daily carbs and TDD will be off. This particular Nightscout URL is new with only a few days of history.

Might not matter for most people as far as first day is concerned although I think it should be first full day in range and I think it should stop at midnight of previous day. Current time is 2026-02-08 at 8:30 am.

For reference

  • first data in the URL is 13:00 local on 2026-02-06
  • my TDD is ~33 U

Possibly there should be a current day option that has values since midnight.

IMG_8740

missingIntervals: missingIntervals,
dataQuality: quality
)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing final }

@marionbarker
Copy link
Collaborator

Test

✅ Overall very nice. Just a few comments below

Comments

This works very nicely. (Had to add a missing } for it to build.)

I love the new tab reordering option.

  • I suggest the Home be required to be the first tab similar to how Menu has to be tab 5;
  • I dragged Home down so it was not in the tabbar and it is really inconvenient. (You have to tap Done upper right to return to settings.)

It seems like tapping on Home is really slow to update - but it might just be me.

Graphic showing new tabbar flexibility

These screenshots were acquired after I rearranged the tabs using to Tab Setting shown on right.

lf-pr-516

Statistics Time Range Selection

The first set of screenshots shows any set of whole days can be selected.

  • Left side: specified the days
  • Right side: tapped on 14 day option
lf-pr516-selectdays

Statistics

Additional 14 day plots are shown below

lf-pr516-stats

Treatments

The treatments display is very nice too.

lf-pr516-treatments

@marionbarker marionbarker requested a review from bjorkert March 2, 2026 02:30
@codebymini
Copy link
Collaborator Author

I suggest the Home be required to be the first tab similar to how Menu has to be tab 5;
I dragged Home down so it was not in the tabbar and it is really inconvenient. (You have to tap Done upper right to return to settings.)

I’d prefer not to require Home to always be the first tab. The intent is to let users order tabs however they want, including placing another tab first.

If Home is removed from the tab bar, it shouldn’t become inaccessible. Even if that leads to slightly unusual behavior, this is an edge case and users can still reach it via Menu.

The top-right Done action has been updated to a checkmark so it matches the pattern used on other screens

@marionbarker
Copy link
Collaborator

Test

I tested again this morning on an iOS 18 phone in addition to an iOS 26 phone.

Comment on Tab Settings

I accept @codebymini response about changing home position.

  • not having Home in the tabbar at all is quite strange but it works and folks can then choose the layout

I think the Tab Settings rearranging should be modified to have a check mark on upper right to accept the change.

  • Any change made while on that screen is immediately effective
  • The current screen shows only a back button on upper left
  • I think the button on upper left should be cancel (or back), with the check mark being required to accept the new configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants