Automation of measuring a number of steps

Nationally Popular (?) A walking game!

Do you play ‘Dragon Quest Walk’? (*a smartphone app of SQUARE ENIX)

In my family, we all love Dragon Quest and not only me, but also my kids (9 years old and 7 years old ) play with the app.

The way to commute is by walking!

I walk to work every day.

So, it is an overwhelming advantage over the children. (Dad should be strong all the time)

And these days, I walk longer to earn more advantages. (Sounds like a cheat)

According to the statistics of the automatic measurement application Google Fit, I often walk since the release of the app of ‘Dragon Quest Walk’ (9/12 release). Especially after the day when my kids installed it on my old phone (9/14), the daily number of steps doubled. (See the calendar below)

*Android and iPhone are equipped with gyro-sensors, accelerometers, and GPS, so they can automatically count steps and distance traveled in quite an accurate way. The app specialized in such functions is called “Activity Tracker”.

Use in business reports?

One day, when I was walking, I could think of many ideas such as more effective usage of Fitness Data and detection of overwork.

For example,

The data of the number of steps of couriers who have been carrying their company smartphones

If there is such data today, I wonder, should it be managed by the company?

(As well as that, I considered the data of the number of steps taken by the tour conductor of a travel agency and that of the distance traveled by an outside salesperson, etc)

It is true that this includes private time data, so it is difficult to handle.

But if I extract only working hours (at any given time), I hope it’s okay to use it.

What I point to here, is that the Labor Standards Act, which relies solely on time for wages (compensation), is even more unreasonable from the viewpoint of “Productivity”. Therefore, I always think the system of paying a premium for more than 10,000 steps per day would become reasonable. (Sounds outrageous)

Implement in REST API!

Anyway, I made the system.

If you look at the super simple Workflow Diagram and the Data input screen above, you can somehow understand. What I would like to show you is,

The Task of “Picking up the step count data of arbitrary time”

is automated. (Name of the Automatic Task: Google Fit: Dataset; Aggregate Step Count via Fit REST API)

For example, the following things are possible.

  • A report of the number of steps from 9 a.m. to 17 p.m. is received automatically the next morning
  • The number of steps in the daily report is automatically added to the daily report which was submitted

Furthermore, if you set up a Task for a superior such as “Superior Approval”, it would become a great workflow (maybe?)

Walking is not relevant to my job, so there is a doubt whether it’s useful or not (this is difficult to verify). If you think the system I developed can contribute to the automation of work at the company, please let me know. If you are eager to use the system, we would like to improve the specification of the automatic processing.

P.S.

Incidentally, “Fit REST API (v1)” was a very peculiar API. (Please refer to the link for the implementation script)

The format of posting Request Json (aggregate) works the same way as the Slides API and the Sheets API (batchUpdate), however Fit REST API (v1) causes some problems below.

  • Not referring to device Raw data, regardless of the permission (OAuth2Scope)
  • A part of the ID is obfuscated so that only the data generation clients can see it
  • Recording in nanoseconds instead of milliseconds
  • The number of steps and distance crossing the time boundary are added to the total calculations

How do you like it?

In addition, I was surprised that the parameters will be designed to obtain others’ data in the future (although it obtains only my own data). While similar services to Google Fit Website are unlikely to be revived, we will continue to monitor the trends of other services.

let requestObj = {};
    requestObj.aggregateBy = [];
    requestObj.aggregateBy[0] = {};
    requestObj.aggregateBy[0].dataTypeName
                              = "com.google.step_count.delta";
    requestObj.endTimeMillis   = numEndTimeMillis;
    requestObj.startTimeMillis = numStartTimeMillis;
    requestObj.bucketByTime = {};
    requestObj.bucketByTime.durationMillis = numDurationMillis;
let apiRequest = httpClient.begin(); // HttpRequestWrapper
    apiRequest = apiRequest.bearer( token );
    apiRequest = apiRequest.body( JSON.stringify( requestObj ),
                                  "application/json" );
const apiUri 
      = "https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate";
engine.log( " AutomatedTask Trying: POST " + apiUri );
const response = apiRequest.post( apiUri );

# I personally have kept entering “blood pressure” and “bodyweight”, so I sometimes think to analyze the trend of their increase and decrease in the morning, daytime and evening.

P.P.S.

By the way, you might wonder how far I’ve played Dragon Quest Walk?

I have finished all the stories that have been released so far.

I cleared “Chapter 5.” in Lv 48, of course, there is no charge. (← I can’t cheat before my children.)

I don’t know if I can exercise or maintain my health without game apps but I will enjoy walking with my children for a while. (We are no-charge gamers!)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top
%d bloggers like this: