Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add blood oxygen as a metric type

Roland Geiderd031e19e7a86
diff --git a/wger/measurements/limits.py b/wger/measurements/limits.py
index 4f67212f2..c84b1f6ee 100644
--- a/wger/measurements/limits.py
+++ b/wger/measurements/limits.py
@@ -83,6 +83,9 @@ METRIC_LIMITS: dict[str, dict[str | None, Limits]] = {
MetricType.RESTING_HEART_RATE: {
None: Limits(Decimal(30), Decimal(120), Decimal(40), Decimal(100)),
},
+ # A saturation cannot exceed 100 %, and the floor is deliberately far below
+ # what a pulse oximeter still displays
+ MetricType.BLOOD_OXYGEN: {None: Limits(Decimal(50), Decimal(100), Decimal(90), Decimal(100))},
# The cumulative types hold a whole day, and a rest day really is 0 steps
MetricType.STEPS: {None: Limits(Decimal(0), Decimal(100000), Decimal(0), Decimal(30000))},
MetricType.DISTANCE: {None: Limits(Decimal(0), Decimal(500), Decimal(0), Decimal(30))},
diff --git a/wger/measurements/migrations/0006_health_sync.py b/wger/measurements/migrations/0006_health_sync.py
index 41fcc51fb..c428cec55 100644
--- a/wger/measurements/migrations/0006_health_sync.py
+++ b/wger/measurements/migrations/0006_health_sync.py
@@ -46,6 +46,7 @@ class Migration(migrations.Migration):
('blood_pressure_diastolic', 'Blood Pressure Diastolic'),
('heart_rate', 'Heart Rate'),
('resting_heart_rate', 'Resting Heart Rate'),
+ ('blood_oxygen', 'Blood Oxygen'),
('steps', 'Steps'),
('distance', 'Distance'),
('energy', 'Energy'),
diff --git a/wger/measurements/models/category.py b/wger/measurements/models/category.py
index 47e1544c7..d3ae80fdb 100644
--- a/wger/measurements/models/category.py
+++ b/wger/measurements/models/category.py
@@ -38,6 +38,7 @@ class MetricType(models.TextChoices):
BLOOD_PRESSURE_DIASTOLIC = 'blood_pressure_diastolic'
HEART_RATE = 'heart_rate'
RESTING_HEART_RATE = 'resting_heart_rate'
+ BLOOD_OXYGEN = 'blood_oxygen'
STEPS = 'steps'
DISTANCE = 'distance'
ENERGY = 'energy'