Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2009
    Posts
    7

    Optimal design for exercise tracking

    I'm trying to design a database framework to track workouts. I want to be able to add exercise types, the measurement features of the exercise, and then create instances of that exercise with different measurements.

    For instance, on the Exercise table, the user should be able to define "Jogging" and "Bench Press". Exercise has a M2M link to Metrics. Through this, "Jogging" can be attached to "Distance" and "Time". "Bench Press" can be attached to "Weight" and "Reps". The user should be able to create an instance of a Workout (date/time stamped) that I guess ideally has a link to Exercise. The choose the Exercises completed.

    I get stuck on the Measurements. Every Metric should have a Measurement. Distance = 1 mile or Weight = 150 lbs. But if I attach Measurement to Metric, then it's like predefining that all instances of Jogging has Distance of 1 mile. The Measurement should be unique to the date/time stamped workout, right? So Jogging always has predefined Metrics (distance and time), but the Measurements can be set/changed for each instance. But I can't add a random Measurement to a workout without knowing what Metric it's attached to (or even how many Metrics need Measurements).

    So for right now, I have a Workout with M2M link to Exercise, Exercise having a M2M link to Measurement, and Measurement with a O2M link to Metric. How might you reorder this?

    Does this make sense?

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Try looking at the problem another way... The M2M table creates the definition of a set of measures. The measurement type table might also have another M2M table to define what units are appropriate/acceptable for that measurement. The (not discussed yet) Exercise table should then link to the M2M that defines the measures for the event and it should include a unit from the other M2M table along with a measurement.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    FYI, just to tickle my funnybone you could include furlongs per fortnight for the jogging category! Ever since encountering 1.8026175e12 in a physics test, I've always been amused by that unit of measure!

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  4. #4
    Join Date
    Aug 2009
    Posts
    7
    I get you. Except I don't think this yet solves the problem (and actually sounds very similar to what I think I'm doing anyway).

    So I believe you're saying that the Exercise is connected to the Measurements which is connected to the Metrics. That's what I currently have. The problem though is that every time a Jogging Exercise is created, the user has to "tell" the system that distance and time are appropriate. I would instead want to create an Exercise called Jogging that is always connected to Distance and Time. And then the user, by selecting Jogging, would have to enter Distance and Time because those are the defined metrics for that Exercise.

    So it would instead be Workout has a type of Exercise which has Metrics. The specific Workout instance has a Measurement for every Metric of the Exercise.

    This versus many Exercise instances which each have Measurements with Metrics.

    In another effort to describe, if I have an obscure exercise, Log-Rolling, which always has distance, time, and sets, it would be more convenient for the user to define Log-Rolling's Metrics once and then simply fill out the Measurements (one furlong per fortnight at 3 sets) rather than redefine Log-Rolling: needs distance, time, and sets, and these are the Measurements.

    Or am I trying to be too complicated?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •