Calculating calories with the Lifelog API

819 Views Asked by At

I have actual data coming in from the Lifelog API now in the below format

{
   "result" : [
  ...
  {
     "id" : "ba2e7500-e022-4daf-817b-1e607e0cff43",
     "type" : "physical",
     "subtype" : "walk",
     "sources" : [
        {
           "name" : "abc123",
           "id" : "42ad35b065e880a3",
           "type" : "phone"
        }
     ],
     "startTime" : "2014-06-09T10:54:00.000+01:00",
     "endTime" : "2014-06-09T10:57:00.000+01:00",
     "details" : {
        "steps" : [ 20, 28, 19 ],
        "distance" : [ 13.662, 19.1268, 12.9789 ],
        "aee" : [ 2.1361, 2.1361, 2.1361 ],
        "tee" : [ 3.1361, 3.1361, 3.1361 ]
     }
  }
  ...
  ]
}

This is great but what I want is to calculate calories. How do I do this with the API?

2

There are 2 best solutions below

1
On

I am not sony expert, I'm just trying to find out more about their apis. Here is what I've read so far and may be helpful to you.

aee

Active Energy Expenditure(AEE), an array of KCAL values, recorded for each minute in this time period. This represents energy burned above the user’s BMR.

tee

Total Energy Expenditure(TEE). An array of KCAL values, recorded for each minute in this time period. This represents energy burned including the user’s BMR.

Sony API reference (available until May 2017)

So according to these your total calories consumption was 3.1361 + 3.1361 + 3.1361 ~= 9.4 kcal in that three minutes.

Without BMR 2.1361 + 2.1361 + 2.1361 ~= 6.4 kcal.

Happy coding.

0
On

So now there is actually an online guide showing how to do calorie calculation:

http://web.archive.org/web/20160325214936/https://developer.sony.com/develop/services/lifelog-api/guides/how-to-calculate-calories/ (available until May 2017)