Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
linenumberstrue
{
  "config": { // All clients listen here permanently
    "articleBaseUrl": "http://cloud-storage.com/articles/"
  },
  "users": {
    "user_id_01": { // Clients listen here permanently
      "username": "user", // [default:null]
      "email": "user@somewhere.com", // [default:null]
      "fitnessLevel": 10, // [default:10]
      "fitnessBias": 1, // [default:1]
      "created": 987654345, // Unix timestamp (seconds) [default:0]
      "maxImpactCredit": 3, // [default:0]
      "impactCredit": 0.9, // [default:0]
      "updatedIC": 987654345, // Unix timestamp (seconds) [default:0]
      "triggersFired": { "triggerId_01": true, "triggerId_02": true }, // [default:null]
      "sessions": {
        "for7MW": 2, // [default:0]
        "forAfterburner": 0 // [default:0]
      },
      "totalActivities": 2, // [default:0]
      "totalActivities7MW": 1, // [default:0]
      "totalActivitiesAF": 1, // [default:0]
      "firstActivity7MW": 987654345, // Unix timestamp (seconds) [default:0]
      "firstActivityAF": 987654345 // Unix timestamp (seconds) [default:0]
    }
  },
  "visibleWorkoutDefsvisibles": {
    "workoutDefs": { // Workout defs that are visible to the user
      "user_id_01": { 
        "for7MW": { // 7MW clients listen here permanently for ChildAdded, ChildChanged and ChildRemoved
          "wktdef1": {
            "recommended": "", // Not recommended, just visible // [default:null]
 	           "locked": true, // Not available to user (unlocked via IAP and/or journey trigger) [default:false]
  		        "lockString": "Finish 6 more workouts before Thurs 9th June", // Displayed to user [default:null]
            "MWI": 0.54, // [default:0.5]
            "breakdown": {
              "epoc": 0.1, // [default:0.25]
              "cardio": 0.1, // [default:0.25]
              "metabolic": 0.1, // [default:0.25]
              "strength": 0.1 // [default:0.25]
            }
          },
          "wktdef2": {
            "recommended": "You need to work on your abs", // Recommended and reason for this to be shown to user
		            "locked": false, // Available to user
		
            "lockString": "",
            "MWI": 0.54,
            "breakdown": {
              "epoc": 0.1,
              "cardio": 0.1,
              "metabolic": 0.1,
              "strength": 0.1
            }
          }
        },
        "forAfterburner": { // Afterburner clients listen here permanently for ChildAdded, ChildChanged and ChildRemoved
          "wktdef1": {
            "recommended": "", // Not recommended, just visible
  	        "locked": false, // Available to user
  		        "lockString": "",
            "MWI": 0.54,
            "breakdown": {
              "epoc": 0.1,
              "cardio": 0.1,
              "metabolic": 0.1,
              "strength": 0.1
            }
          },
          "wktdef2": {
            "recommended": "You need to work on your abs", // Recommended and reason for this to be shown to user
		            "locked": false, // Available to user
		            "lockString": "",
            "MWI": 0.54,
            "breakdown": {
              "epoc": 0.1,
              "cardio": 0.1,
              "metabolic": 0.1,
              "strength": 0.1
            }
          }
        }
      }
    },
    "workoutsroutines": {
      "activitiesuser_id_01": { 
        "user_id_01for7MW": { // 7MW Clientsclients listen here permanently for ChildAdded, ChildChanged and ChildRemoved
          "workoutroutine_id_01": {
// Clients post new activity to here with auto id, server listens "locked": true, // Not available to user (unlocked via  "workoutDefId": "wktdef1", // [no default]IAP and/or journey trigger) [default:false]
            "finishlockString": 987654345, // Unix timestamp (seconds) [default:0]
      "Finish 6 more workouts before Thurs 9th June" // Displayed to user [default:null]
   "iterations": 1.5, // Number of times it was},
performed [default:1]           "exertion"routine_id_02": 0.5, // [default:0.5]{
            "finalHeartRateBPMlocked": 160true,
// [default:140]           "finalHeartRateDelaylockString": 0,"" // LengthNo oflock delay (in secs) after the workout before the HR was measured (0 if they didn't press the 'start again' button) [default:0]
		  "app": "7MW" // Short code of the app the activity was performed in: 7MW, AF, etc [default:null]
  string, so only unlocked via IAP [default:null]
          },
          "routine_id_03": {
            "locked": false, // Available
     }       "lockString": ""
          }
        },
        "receiptsforAfterburner": { // 7MW clients listen here permanently  "user_id_01": {for ChildAdded, ChildChanged and ChildRemoved
          "receipt_autoroutine_id_0103": {
            "receiptlocked": "receipt_data"false, // WrittenAvailable
by the client after an IAP purchase      "lockString": ""
   "validation": { // Written by the server after}
the receipt has been processed    }
      }
 "validationDate": 3456789, // Timestamp}
  },
         "isValid"workouts": true{
          }
        }
      }
    },
    "results"activities": {
      "user_id_01": { // Clients listen here permanently for ChildAdded, ChildChanged and ChildRemoved
        "workout_id_01": { // Clients Serverpost postsnew workoutactivity resultsto here with auto id, server listens
     "     "workoutDefId": "wktdef1", // [no default]
          "finish": 987654345, // Unix timestamp (seconds) // [no default:0]
          "AWIiterations": 01.15, // Number of times it was performed [default:0.51]
          "responseDurationexertion": 34560.5, // [default: 0.5]
          "intensityfinalHeartRateBPM": 0.9160, // [default:0.5]
		140]
          "appfinalHeartRateDelay": "7MW"0, // Short code of Length of delay (in secs) after the appworkout before the activityHR was performedmeasured in: 7MW, AF, etc [no default]
          "responses": { // [no default]
            "cardio": {(0 if they didn't press the 'start again' button) [default:0]
		  "app": "7MW" // Short code of the app the activity was performed in: 7MW, AF, etc [default:null]
        }
      "stress": 43,}
    },
         "magnitudeProductresults": 0.6,{
      "user_id_01": { // Clients listen here permanently  "halflifeProduct": 0.3for ChildAdded, ChildChanged and    ChildRemoved
        "durationworkout_id_01": 5678,{ // Server posts workout results here
          "volumeworkoutDefId": 3456
  "wktdef1", // [no default]
         }, "finish": 987654345, // Unix timestamp (seconds) // [no default]
   "strength": {        "AWI": 0.1, // [default:0.5]
          "stressresponseDuration": 433456, // [default:  0]
          "magnitudeProductintensity": 0.69, // [default:0.5]
		  "app": "7MW", // Short code of the app the activity  "halflifeProduct"was performed in: 0.37MW, AF, etc [no default]
          "durationresponses": { 5678,// [no default]
            "volumecardio": 3456
            },
            "epoc": {
              "stress": 43,
              "magnitudeProduct": 0.6,
              "halflifeProduct": 0.3,
              "duration": 5678,
              "volume": 3456
            },
            "metabolicstrength": {
              "stress": 43,
              "magnitudeProduct": 0.6,
              "halflifeProduct": 0.3,
              "duration": 5678,
              "volume": 3456
            },
           }, "epoc": {
              "muscleGroupsstress": 43,
{              "uppermagnitudeProduct": 0.36,
// [default: 0.3]             "lowerhalflifeProduct": 0.3,
// [default: 0.3]
            "coreduration": 0.4 // [default: 0.3]5678,
              }"volume": 3456
       }     },
 }     }   },   "afterburnmetabolic": {
    "user_id_01": { // Clients listen here permanently       "startstress": 34567898743,
//  Unix timestamp (seconds) // [no default]       "responsemagnitudeProduct": { // [default:null] 0.6,
              "resolutionhalflifeProduct": 6000.3,
 //    Secs         "epoc": [0.6,0.5,0.3,0.2,0.1,0.0],duration": 5678,
              "volume": 3456
            }
          },
          "muscleGroups": {
            "upper": 0.3, // [default: 0.3]
            "lower": 0.3, // [default: 0.3]
            "core": 0.4 // [default: 0.3]
          }
        }
      }
    }
  },
  "afterburn": {
    "user_id_01": { // Clients listen here permanently
      "start": 345678987, // Unix timestamp (seconds) // [no default]
      "response": { // [default:null]
        "resolution": 600, // Secs
        "epoc": [0.6,0.5,0.3,0.2,0.1,0.0],
        "cardio": [0.6,0.5,0.3,0.2,0.1,0.0],
        "strength": [0.6,0.5,0.3,0.2,0.1,0.0],
        "metabolic": [0.6,0.5,0.3,0.2,0.1,0.0]
      },
      "impactCredit": { // [default:null]
        "resolution": 600, // Secs
        "futureCredit": 0.9,
        "pending": [0.0,0.1,0.2,0.3,0.4,0.5]
      },
      "messages": [ // Messages displayed below the radar chart [default:null]
        {"t":0,"body":"Restoring body temperature", "detail": ""},
        {"t":120,"body":"Replenishing glycogen stores", "detail": "detail/glycogen"}
      ],
      "notifications": [ // [default:null]
        {"t":6000,"body":"Great workout! You're still burning calories and building strength."},
        {"t":14400,"body":"Fitness test unlocked! You're ready to take another fitness test."}
      ]
    }
  },
  "timelineArticles": {
    "user_id_01": { // Clients listen here permanently for ChildAdded, ChildChanged and ChildRemoved
      "article_id_01": {
        "date": 4567890987, // Unix timestamp (seconds) // [no default]
        "title": "Post title", // [no default]
        "read": false, // [default:true]
        "cardiolocation": [0.6,0.5,0.3,0.2,0.1,0.0],"post/location.html", // [no default]
		"icon": "default", // [default:"default"]
        "strengthappMask": [0.6,0.5,0.3,0.2,0.1,0.0],
   "7MW,AF" // [default: all apps]
    "metabolic": [0.6,0.5,0.3,0.2,0.1,0.0]
  }
    },
  },
   "impactCreditdefinitions": { // [default:null]
   
    "resolutionroutines": 600,{ // Secs
  Clients listen here permanently for ChildAdded, ChildChanged and ChildRemoved
      "futureCreditroutine_id_01": 0.9,{
        "pendingtitle": [0.0,0.1,0.2,0.3,0.4,0.5]
      },"6 Week Wedding Routine", // [no default]
        "messagesimage": [ // Messages displayed below the radar chart"some_image", // [default:null"default-routine"]
        {"tdesc":0,"body":"Restoring body temperature", "detail": ""}, "Big long description", // [default:null]
         {"tappStoreId7MW":120,"body":"Replenishing glycogen stores", "detail": "detail/glycogen"}
      ], "routine01", // StoreKit product id [default:null]
         "notificationsin7MW": [ // true, // For server use [default:nullfalse]
        {"tinAfterburner":6000,"body":"Great workout! You're still burning calories and building strength."}, false, // For server use [default:false]
           {"t":14400,"body"workoutDefs":"Fitness test[ unlocked! You're ready to take another fitness test."}// [no default]
          {
]     }
  },
  "timelineArticles": {       "user_id_01": {"wktDef01" // Clients[no listendefault]
here permanently for ChildAdded, ChildChanged and ChildRemoved    },
  "article_id_01": {       {
 "date": 4567890987, // Unix timestamp (seconds) // [no default]   "id": "wktDef02"
    "title": "Post title", // [no default]   }
     "read": false, // [default:true]
      }
   "location": "post/location.html" },
//  [no default] 		"iconexerciseDefs": "default",{ // [default:"default"]
        "appMask": "7MW,AF" // [default: all apps]
 Clients listen here permanently for ChildAdded, ChildChanged and ChildRemoved
      "exdef1": {
    }     }
  },
  "definitions": {"behaviour": 1, // [default:1]
        "exerciseDefstitle": {"Cruches", // Clients[no listendefault]
here permanently for ChildAdded, ChildChanged and ChildRemoved  "video": "01-Crunches.mp4", // [no default]
"exdef1": {         "behaviourimage": 1"abs", // [default:1"default"]
        "titledesc": "Cruches", // [no default]
        "video": "01-Crunches.mp4", // [no default]
        "image": "abs", // [default:"default"]
        "desc": "A crunch begins with lying face up on the floor with knees bent. The movement begins by curling the shoulders towards the pelvis. The hands can be behind or beside the neck or crossed over the chest. Injury can be caused by pushing against the head or neck with hands."A crunch begins with lying face up on the floor with knees bent. The movement begins by curling the shoulders towards the pelvis. The hands can be behind or beside the neck or crossed over the chest. Injury can be caused by pushing against the head or neck with hands.", // [default:null]
        "subtitle": "Target your abs for a balanced set of stomach muscles.", // [default:null]
        "calPerSec": 5, // [default:0]
        "skill": 0.2, // [default:null:0.5]
        "subtitlestrength": "Target your abs for a balanced set of stomach muscles."0.7, // [default:null0.5]
        "calPerSeccardio": 50.1, // [default:0.5]
        "skillepoc": 0.24, // [default:0.5]
        "strengthmetabolic": 0.74, // [default:0.5]
        "cardioupper": 0.15, // [default:0.5]
        "epoccore": 0.45, // [default:0.5]
        "metaboliclower": 0.45, // [default:0.5]
        "upperneedsHalfwaySwap": 0.5,false // [default:0.5]false]
      },
      "exdef2": {
        "corebehaviour": 0.5, // [default:0.5]1,
        "lowertitle": 0.5"Squats",
// [default:0.5]        "video": "needsHalfwaySwap": false // [default:false]02-Squats.mp4",
         }"image": "abs",
        "exdef2desc": "Squats are {an excellent exercise for training the lower body and "behaviour": 1core muscles, if done regularly they help to define thighs "title": "Squatsand buttocks.",
        "videosubtitle": "02-Squats.mp4Train your lower body and core.",
        "imagecalPerSec": "abs"4,
        "descskill": "Squats are an excellent exercise for training the lower body and core muscles, if done regularly they help to define thighs and buttocks."0.2,
        "strength": 0.6,
        "cardio": 0.3,
        "subtitleepoc": "Train your lower body and core." 0.4,
        "metabolic": 0.6,
        "calPerSecupper": 40.5,
        "skillcore": 0.25,
        "strengthlower": 0.65,
        "cardioneedsHalfwaySwap": 0.3, true
      }
    },
    "epocworkoutDefs": 0.4,
  { // Clients listen here permanently for ChildAdded, ChildChanged and ChildRemoved
      "metabolicwktdef1": 0.6,{
        "uppertype": 0.5,1, // [default:1]
        "coretitle": 0.5,"Aerobic", // [no default]
        "lowerimage": 0.5,"abs", // [default:"default"]
        "needsHalfwaySwapdesc": true"Aerobic Basic Movement", // [default:null]
    }    "breakDuration": }5, // // [default:10]
		"appStoreId7MW: "workoutDefsworkout01": {, // Clients listen here permanently for ChildAdded, ChildChanged and ChildRemoved
      "wktdef1": {StoreKit product id [default:null]
        "in7MW": true, // For server use [default:false]
        "typeinAfterburner": 1false, // For server use [default:1false]
        "titleexercises": "Aerobic",[ // [no default]
          {
"image": "abs", // [default:"default"]         "descid": "Aerobic Basic Movementexdef1", // [no default:null]
            "breakDurationduration": 5, //20 // [no default:10]
		"appStoreId7MW: "workout01", // StoreKit product id [default:null]
          },
        "in7MW": true, //{
For server use [default:false]         "inAfterburnerid": false"exdef2",
// For server use [default:false]
        "exercisesduration": [ // [no default] 15
          },
          {
            "id": "exdef1exdef3", // [no default]
            "duration": 20 // [no default]10
          },
          {
            "id": "exdef2exdef4",
            "duration": 155
          },
          {
            "id": "exdef3exdef5",
            "duration": 10
          },
         ],
{             "idadaptiveStress": "exdef4",{
            "durationstrength": 5
 0.2, // [default:1]
        },  "cardio": 0.9,        {
 // [default:1]
          "idmetabolic": "exdef5",
 0.6, // [default:1]
          "durationepoc": 100.6 // [default:1]
        }
        ],
        "adaptiveStressmuscleStress": {
          "strengthupper": 0.210, // [default:1]
          "cardiolower": 0.910, // [default:1]
          "metaboliccore": 0.6,10 // [default:1]
        }
      },
      "wktdef2": {
        "type": 1,
        "epoctitle": 0.6 // [default:1]"Thai Boxing",
         }"image": "abs",
        "muscleStressdesc": {"Boxing With Kicking",
        "upper"breakDuration": 4,
		"appStoreId7MW: 10"", // [default:1]StoreKit product id
        "lowerin7MW": 10false, // [default:1]For server use
        "coreinAfterburner": 10true, // [default:1] For server use
        "exercises": [
         } {
     },       "wktdef2id": { "exdef5",
            "typeduration": 1,15
        "title": "Thai Boxing"},
         "image": "abs", {
            "descid": "exdef3"Boxing,
  With Kicking",         "breakDurationduration": 4,
		"appStoreId7MW: "", // StoreKit product id 10
          },
        "in7MW": false, //{
 For server use         "inAfterburnerid": true"exdef1",
// For server use         "exercisesduration": 5
  [        }
  {      ],
        "idstress": "exdef5",{
            "durationstrength": 150.2,
          }"cardio": 0.9,
          {
 "metabolic": 0.6,
          "idepoc": "exdef3",0.6
        },
   "duration": 10           },
"muscleStress": {
         { "upper": 10,
          "idlower": "exdef1"10,
 
          "durationcore": 10
  5      }
      }
    },
   ], "journeyTriggers: {
      "stressforAfterburner": {
          "strengthtrigger01": 0.2,{
          "cardiocategory": 0.9"achievement",
          "metabolictriggerType": 0.6"activeDaysInWeeks",
          "epoccondition1": 0.6
        },4, // 4 active days
          "muscleStresscondition2": {8, // every         "upper": 10,week for 8 weeks
          "loweractions": [
 10,           "core": 10
{"actionType":"postArticle","articleId":"article_id_01","data":"e.g. url parameters"},
       }       }{"actionType":"unlockWorkout","workoutDefId":"workoutDef_id_01","articleId":"article_id_02","data":""}
      },     "journeyTriggers:]
{       "forAfterburner": { },
        "trigger01trigger02": {
          "category": "achievementeducation",
          "triggerType": "activeDaysInWeekstotalActivities",
          "condition1": 410, // 410 active daysactivities
          "condition2": 80, // everyNot weekused
for 8 weeks           "actions": [
            {"actionType":"postArticle","articleId":"article_id_01","data":"e.g. url parameters"},
            {"actionType":"unlockWorkout","workoutDefId":"workoutDef_id_01","articleId":"article_id_02","data":" url parameters"}
          ]
        }
      },
      "for7MW": {
        "trigger02trigger01": {
          "category": "educationachievement",
          "triggerType": "totalActivitiesactiveDaysInWeeks",
          "condition1": 104, // 104 active activitiesdays
          "condition2": 08, // Not usedevery week for 8 weeks
          "actions": [
            {"actionType":"postArticle","articleId":"article_id_01","data":"e.g. url parameters"},
          ]
    {"actionType":"unlockWorkout","workoutDefId":"workoutDef_id_01","articleId":"article_id_02","data":""}
     }     ]
 },       "for7MW": {},
        "trigger01trigger02": {
          "category": "achievementeducation",
          "triggerType": "activeDaysInWeekstotalActivities",
          "condition1": 410, // 410 active daysactivities
          "condition2": 80, // everyNot weekused
for 8 weeks
          "actions": [
            {"actionType":"postArticle","articleId":"article_id_01","data":"e.g. url parameters"}, "actions": [
            {"actionType":"unlockWorkout","workoutDefId":"workoutDef_id_01postArticle","articleId":"article_id_0201","data":"e.g. url parameters"}
          ]
        },
      }
 "trigger02": {  }
  },
     "categoryreceipts": "education",{
    "user_id_01": {
      "triggerTypereceipt_auto_id_01": "totalActivities",{
        "receipt":  "condition1": 10, // 10 activities
 receipt_data", // Written by the client after an IAP purchase
        "condition2validation": 0,{ // NotWritten usedby the server after the receipt has been processed
  "actions": [       "validationDate": 3456789, //    {"actionType":"postArticle","articleId":"article_id_01","data":"e.g. url parameters"}Timestamp [default:0]
          "isValid": true [default:false]
        }
      }
    }
  },
}

Client-Side Data Validation & Error Handling

...