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

Add body battery #22

Merged
merged 4 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions docs-sphinx/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@

import os
import sys
sys.path.insert(0, os.path.abspath('../..')) # Source code dir relative to this file

sys.path.insert(0, os.path.abspath("../..")) # Source code dir relative to this file

autodoc_mock_imports = ["terra"]

project = 'Python Wrapper for Terra API'
copyright = '2022, Terra'
author = 'Terra'
release = '1'
project = "Python Wrapper for Terra API"
copyright = "2022, Terra"
author = "Terra"
release = "1"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
]

autosummary_generate = True
autosummary_generate = True

templates_path = ['_templates']
templates_path = ["_templates"]
exclude_patterns = []



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_static_path = ['_static']
html_theme = "alabaster"
html_static_path = ["_static"]
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ def parse_requirements_file(path):
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: Apache Software License"
"License :: OSI Approved :: Apache Software License",
],
)
2 changes: 1 addition & 1 deletion terra/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def fill_in_user_info(self) -> None:

if self._client:
user_info = self._client.get_user_info(self)
if not user_info.json:
if not user_info.json or user_info.json.get("status") == "error":
raise exceptions.NoUserInfoException

self.provider = user_info.json["user"]["provider"]
Expand Down
1 change: 1 addition & 0 deletions terra/models/v2/daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class StressData(base_model.TerraDataModel):
avg_stress_level: typing.Optional[float] = dataclasses.field(default=None)
max_stress_level: typing.Optional[float] = dataclasses.field(default=None)
samples: typing.List[samples_.StressSample] = dataclasses.field(default_factory=list)
body_battery_samples: typing.List[samples_.BodyBatterySample] = dataclasses.field(default_factory=list)


@dataclasses.dataclass
Expand Down
7 changes: 7 additions & 0 deletions terra/models/v2/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"PulseVelocitySample",
"AFibClassificationSample",
"DrinkSample",
"BodyBatterySample",
]


Expand Down Expand Up @@ -322,3 +323,9 @@ class DrinkSample(base_model.TerraDataModel):
class MenstruationFlowSample(base_model.TerraDataModel):
timestamp: typing.Optional[str] = dataclasses.field(default=None)
flow: typing.Optional[int] = dataclasses.field(default=None)


@dataclasses.dataclass
class BodyBatterySample(base_model.TerraDataModel):
timestamp: typing.Optional[str] = dataclasses.field(default=None)
level: typing.Optional[float] = dataclasses.field(default=None)