Skip to content

Commit

Permalink
Add mmol/L SGV delta values
Browse files Browse the repository at this point in the history
  • Loading branch information
marciogranzotto committed Nov 1, 2021
1 parent 7cb2e50 commit 64c2c8a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions py_nightscout/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def __init__(self, **kwargs):
"sgv": None,
"sgv_mmol": None,
"delta": None,
"delta_mmol": None,
"date": None,
"direction": None,
"device": None,
Expand All @@ -78,6 +79,7 @@ def __init__(self, **kwargs):
for (param, default) in self.param_defaults.items():
setattr(self, param, kwargs.get(param, default))
self.sgv_mmol = self.mgdlTommolL(self.sgv)
self.delta_mmol = self.mgdlTommolL(self.delta)

@classmethod
def json_transforms(cls, json_data):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

setup(
name="py_nightscout",
version="1.3.1",
version="1.3.2",
description="A library that provides a Python async interface to Nightscout",
long_description=README,
long_description_content_type="text/markdown",
Expand Down
2 changes: 2 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ async def test_get_sgv(api: nightscout.Api):
assert 10 == len(entries)
assert 169 == entries[0].sgv
assert 9.4 == entries[0].sgv_mmol
assert -5.257 == entries[0].delta
assert -0.3 == entries[0].delta_mmol
assert "FortyFiveDown" == entries[0].direction
assert -5.257 == entries[0].delta
assert datetime(2020, 8, 5, 19, 1, 6, 533000, tzinfo=tzutc()) == entries[0].date
Expand Down

0 comments on commit 64c2c8a

Please sign in to comment.