Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Enable inticating carb entries on the graph #321

Open
motinis opened this issue Jan 8, 2025 · 9 comments
Open

Feature Request: Enable inticating carb entries on the graph #321

motinis opened this issue Jan 8, 2025 · 9 comments

Comments

@motinis
Copy link

motinis commented Jan 8, 2025

In a similar way to how there are little markers for boluses, it would be great if, for example, a little white dot could be put on the graph to mark carb entries. This is useful when tracking from a far to know for example if a kid has received a low treatment yet or not without needing to check alternative applications.

Thank you!!

@dhermanns
Copy link
Collaborator

You mean like so:

image

@motinis
Copy link
Author

motinis commented Jan 8, 2025

Yep. That looks good

@dhermanns
Copy link
Collaborator

So it should already work this way. I think right now it's displayed only when carbs AND bolus has been applied.

But this is just from memory.

@motinis
Copy link
Author

motinis commented Jan 9, 2025

Ok - this is odd then. When you say carbs have been applied I'm assuming you're not talking within Nightguard, right? That it's pulling them from NS? I have 3.9.2.906 installed.

@dhermanns
Copy link
Collaborator

The app transfers the entered carbs to NS, yes. And retrieves them from the NS Backend.

@motinis
Copy link
Author

motinis commented Jan 28, 2025

So in I it case Loop is the one recording the carbs and they aren’t displayed for us.

@dhermanns
Copy link
Collaborator

You could compare the entries in nightguard that loop creates, versus the ones from NS/Nightguard. I would expect that there a differences.

@motinis
Copy link
Author

motinis commented Jan 29, 2025

Here is the format for Loop carb treatments:

{
    "_id": "6799e6bc69ef86c8bedc4f22",
    "carbs": 24,
    "eventType": "Carb Correction",
    "syncIdentifier": "A3D3269F-1684-4B76-9544-44F242C277AA",
    "absorptionTime": 180,
    "timestamp": "2025-01-29T08:20:22Z",
    "userEnteredAt": "2025-01-29T08:28:22Z",
    "enteredBy": "loop://iPhone",
    "foodType": "🌮",
    "created_at": "2025-01-29T08:20:22.000Z",
    "utcOffset": 0,
    "insulin": null
  }

Looking at the code in Nightguard I see:

{"eventType": "Carb Correction",
        "carbs": \(carbs),
        "duration": 0,
        "enteredBy": "nightguard"}

Note that in Loop carbs are double and not int (e.g. 3.5 is fine).

Perhaps the difference here then is in terms of "absorptionTime" vs "duration"?

@motinis
Copy link
Author

motinis commented Jan 29, 2025

The relevant code in Nightguard:

 fileprivate func extractCarbCorrection(_ jsonTreatment: [String : Any]) {
        
        if let id = jsonTreatment["_id"] as? String {
            if isNew(id: id) {
                if let date = jsonTreatment["mills"] as? Double {
                    let carbs = jsonTreatment["carbs"] as? Int ?? 0
                    
                    addTreatment(
                        treatment:
                            CarbCorrectionTreatment.init(id: id, timestamp: date, carbs: carbs))
                }
            }
        }
    }

So I think the problem is mainly in the "mills" field as opposed to the "timestamp" field.

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

No branches or pull requests

2 participants