Create a new app for fitnesstrax and start setting up the record data structures #114
|
@ -756,6 +756,17 @@ dependencies = [
|
||||||
"typenum",
|
"typenum",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dimensioned"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a0b0a86c5d31c93238ff4b694fa31f3acdf67440770dc314c57d90e433914397"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array 0.14.7",
|
||||||
|
"num-traits",
|
||||||
|
"typenum",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "displaydoc"
|
name = "displaydoc"
|
||||||
version = "0.2.4"
|
version = "0.2.4"
|
||||||
|
@ -807,7 +818,7 @@ version = "0.6.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"chrono-tz",
|
"chrono-tz",
|
||||||
"dimensioned",
|
"dimensioned 0.7.0",
|
||||||
"serde 1.0.188",
|
"serde 1.0.188",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -960,6 +971,15 @@ version = "1.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6"
|
checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fitnesstrax"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"chrono",
|
||||||
|
"dimensioned 0.8.0",
|
||||||
|
"emseries",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flate2"
|
name = "flate2"
|
||||||
version = "1.0.27"
|
version = "1.0.27"
|
||||||
|
|
|
@ -10,6 +10,7 @@ members = [
|
||||||
"dashboard",
|
"dashboard",
|
||||||
"emseries",
|
"emseries",
|
||||||
"file-service",
|
"file-service",
|
||||||
|
"fitnesstrax",
|
||||||
"fluent-ergonomics",
|
"fluent-ergonomics",
|
||||||
"geo-types",
|
"geo-types",
|
||||||
"gm-control-panel",
|
"gm-control-panel",
|
||||||
|
|
1
build.sh
1
build.sh
|
@ -11,6 +11,7 @@ RUST_ALL_TARGETS=(
|
||||||
"dashboard"
|
"dashboard"
|
||||||
"emseries"
|
"emseries"
|
||||||
"file-service"
|
"file-service"
|
||||||
|
"fitnesstrax"
|
||||||
"fluent-ergonomics"
|
"fluent-ergonomics"
|
||||||
"geo-types"
|
"geo-types"
|
||||||
"gm-control-panel"
|
"gm-control-panel"
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
[package]
|
||||||
|
name = "fitnesstrax"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
chrono = { version = "0.4" }
|
||||||
|
dimensioned = {version = "0.8" }
|
||||||
|
emseries = { path = "../emseries" }
|
|
@ -0,0 +1,24 @@
|
||||||
|
use crate::types;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
#[test]
|
||||||
|
fn read_a_legacy_set_rep_record() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn read_a_legacy_steps_record() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn read_a_legacy_time_distance_record() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn read_a_legacy_weight_record() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
use chrono::NaiveDate;
|
||||||
|
use dimensioned::si;
|
||||||
|
use emseries::DateTimeTz;
|
||||||
|
|
||||||
|
mod legacy;
|
||||||
|
mod types;
|
|
@ -0,0 +1,3 @@
|
||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
/// SetRep represents workouts like pushups or situps, which involve doing a "set" of a number of
|
||||||
|
/// actions, resting, and then doing another set.
|
||||||
|
pub struct SetRep {
|
||||||
|
/// I assume that a set/rep workout is only done once in a day.
|
||||||
|
date: NaiveDate,
|
||||||
|
/// Each set entry represents the number of times that the action was performed in a set. So, a
|
||||||
|
/// pushup workout that involved five sets would have five entries. Each entry would be x
|
||||||
|
/// number of pushups. A viable workout would be something like [6, 6, 4, 4, 5].
|
||||||
|
sets: Vec<u32>,
|
||||||
|
comments: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The number of steps one takes in a single day.
|
||||||
|
pub struct Steps {
|
||||||
|
date: NaiveDate,
|
||||||
|
count: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// TimeDistance represents workouts characterized by a duration and a distance travelled. These
|
||||||
|
/// sorts of workouts can occur many times a day, depending on how one records things. I might
|
||||||
|
/// record a single 30-km workout if I go on a long-distanec ride. Or I might record multiple 5km
|
||||||
|
/// workouts if I am out running errands. Distance and Duration are both optional because different
|
||||||
|
/// people have different priorities and may choose to measure different things.
|
||||||
|
pub struct TimeDistance {
|
||||||
|
/// The precise time (and the relevant timezone) of the workout. One of the edge cases that I
|
||||||
|
/// account for is that a ride which occurred at 11pm in one timezone would then count as 1am
|
||||||
|
/// if one moved two timezones to the east. This is kind of nonsensical from a human
|
||||||
|
/// perspective, so the DateTimeTz keeps track of the precise time in UTC, but also the
|
||||||
|
/// timezone in which the event was recorded.
|
||||||
|
datetime: DateTimeTz,
|
||||||
|
/// The distance travelled. This is optional because such a workout makes sense even without
|
||||||
|
/// the distance.
|
||||||
|
distance: Option<si::Meter<f64>>,
|
||||||
|
/// The duration of the workout, which is also optional. Some people may keep track of the
|
||||||
|
/// amount of distance travelled without tracking the duration.
|
||||||
|
duration: Option<si::Second<f64>>,
|
||||||
|
comments: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A singular daily weight measurement. Weight changes slowly enough that it seems unlikely to
|
||||||
|
/// need to track more than a single weight in a day.
|
||||||
|
pub struct Weight {
|
||||||
|
date: NaiveDate,
|
||||||
|
weight: si::Kilogram<f64>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The unified data structure for all records that are part of the app.
|
||||||
|
pub enum TraxRecord {
|
||||||
|
BikeRide(TimeDistance),
|
||||||
|
Pushups,
|
||||||
|
Row(TimeDistance),
|
||||||
|
Run(TimeDistance),
|
||||||
|
Situps,
|
||||||
|
Squats,
|
||||||
|
Steps(Steps),
|
||||||
|
Swim(TimeDistance),
|
||||||
|
Walk(TimeDistance),
|
||||||
|
Weight(Weight),
|
||||||
|
}
|
Loading…
Reference in New Issue