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 Breathing Rate Summary #8

Merged
merged 1 commit into from
Dec 27, 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
](https://pypi.org/project/fitbit-cli/) [![PyPI - Version](https://img.shields.io/pypi/v/fitbit-cli)
](https://pypi.org/project/fitbit-cli/)

> ⚠️ This is not an official Fitbit CLI
> This is not an official Fitbit CLI

Access your Fitbit data directly from your terminal 💻. View 💤 sleep logs, ❤️ heart rate, 🏋️‍♂️ activity levels, 🩸 SpO2, and more, all presented in a simple, easy-to-read table format!

Expand All @@ -25,7 +25,7 @@ Access your Fitbit data directly from your terminal 💻. View 💤 sleep logs,
| [SpO2](https://dev.fitbit.com/build/reference/web-api/spo2/) | ✅ |
| [Heart Rate Time Series](https://dev.fitbit.com/build/reference/web-api/heartrate-timeseries/) | ✅ |
| [Active Zone Minutes (AZM) Time Series](https://dev.fitbit.com/build/reference/web-api/active-zone-minutes-timeseries/) | ✅ |
| [Activity](https://dev.fitbit.com/build/reference/web-api/activity/) | 👷 |
| [Activity](https://dev.fitbit.com/build/reference/web-api/activity/) | |

## Usage Guide

Expand Down
2 changes: 1 addition & 1 deletion fitbit_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
fitbit_cli Module
"""

__version__ = "1.1.0"
__version__ = "1.2.0"
9 changes: 9 additions & 0 deletions fitbit_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ def parse_arguments():
metavar="DATE[,DATE]",
help="Show Active Zone Minutes (AZM) Time Series data",
)
group.add_argument(
"-b",
"--breathing-rate",
type=parse_date_range,
nargs="?",
const=(datetime.today().date(), None),
metavar="DATE[,DATE]",
help="Show Breathing Rate Summary data",
)
group.add_argument(
"-u",
"--show-user-profile",
Expand Down
17 changes: 17 additions & 0 deletions fitbit_cli/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,20 @@ def display_azm_time_series(azm_data):
)

CONSOLE.print(table)


def display_breathing_rate(breathing_rate_data):
"""Breathing Rate data formatter"""

table = Table(title="Breathing Rate Summary 🫁", show_header=True)

table.add_column("Date :calendar:")
table.add_column("Breaths Per Minute :dash:")

for br in breathing_rate_data.get("br", []):
table.add_row(
br.get("dateTime", "N/A"),
str(br.get("value", {}).get("breathingRate", "N/A")),
)

CONSOLE.print(table)
4 changes: 4 additions & 0 deletions fitbit_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ def main():
fmt.display_heart_data(fitbit.get_heart_rate_time_series(*args.heart))
if args.active_zone:
fmt.display_azm_time_series(fitbit.get_azm_time_series(*args.active_zone))
if args.breathing_rate:
fmt.display_breathing_rate(
fitbit.get_breathing_rate_summary(*args.breathing_rate)
)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
project_urls={
"Documentation": "https://github.com/veerendra2/fitbit-cli",
},
keywords=["fitbit", "cli", "python"],
keywords=["fitbit", "fitbit-api", "cli", "python"],
license="MIT",
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
Loading