Extract Health Data From Your Samsung Device | by Anuradha Wickramarachchi | Towards Data Science

Health data is collected every time you have your phone in your pocket. Apple or Android, the phones are equipped with a pedometer that counts your steps. Hence, health data is recorded. This data could be your one free data mart for a simple Machine Learning or some other project related to Health data. It’s yours and free to use!. Let’s see how we can export data from the Samsung S-Health App.
The data download feature is available in your Samsung health app.
Open health app
Open the left side panel — click on the settings wheel
Find “Download personal data” button
Follow instructions (you’ll need to login) and click Download
You’ll be shown with the location to find your health data
This probably is the easiest thing to do. However, understanding the data is a bit complicated. Let’s go through each of the file and its content to understand how Samsung health app stores data.
You will see the following set of files with data. In place of T you’ll see the export timestamp. In the files folder, you’ll see the profile picture image. In the folder named jsons, you can find the JSON objects for data referred in the CSV files (I’ll not talk about JSONS in this article). Please note that the data columns of CSV files will also contain the package extension com.samsung.health. However, for the simplicity of the text, I will ignore when I explain the content of the CSV files.
com.samsung.health.device_profile.T.csv  com.samsung.shealth.preferences.T.csv  com.samsung.health.floors_climbed.T.csv  com.samsung.shealth.report.T.csv  com.samsung.health.food_info.T.csv  com.samsung.shealth.rewards.T.csv  com.samsung.health.height.T.csv  com.samsung.shealth.sleep.T.csv  com.samsung.health.sleep_stage.T.csv  com.samsung.shealth.social.leaderboard.T.csv  com.samsung.health.user_profile.T.csv  com.samsung.shealth.social.public_challenge.T.csv  com.samsung.health.water_intake.T.csv  com.samsung.shealth.social.public_challenge.detail.T.csv  com.samsung.health.weight.T.csv  com.samsung.shealth.social.public_challenge.extra.T.csv  com.samsung.shealth.activity.day_summary.T.csv  com.samsung.shealth.social.public_challenge.history.T.csv  com.samsung.shealth.activity.goal.T.csv  com.samsung.shealth.social.public_challenge.leaderboard.T.csv  com.samsung.shealth.activity_level.T.csv  com.samsung.shealth.social.service_status.T.csv  com.samsung.shealth.best_records.T.csv  com.samsung.shealth.stand_day_summary.T.csv  com.samsung.shealth.breathing.T.csv  com.samsung.shealth.step_daily_trend.T.csv  com.samsung.shealth.caloric_balance_goal.T.csv  com.samsung.shealth.stress.T.csv  com.samsung.shealth.calories_burned.details.T.csv  com.samsung.shealth.stress.histogram.T.csv  com.samsung.shealth.exercise.T.csv  com.samsung.shealth.tracker.heart_rate.T.csv  com.samsung.shealth.exercise.weather.T.csv  com.samsung.shealth.tracker.pedometer_day_summary.T.csv  com.samsung.shealth.food_frequent.T.csv  com.samsung.shealth.tracker.pedometer_event.T.csv  com.samsung.shealth.food_goal.T.csv  com.samsung.shealth.tracker.pedometer_recommendation.T.csv  com.samsung.shealth.goal.T.csv  com.samsung.shealth.tracker.pedometer_step_count.T.csv  com.samsung.shealth.goal_history.T.csv  com.samsung.shealth.insight.milestones.T.csv  com.samsung.shealth.permission.T.csv  jsonsfiles
These are the files that contain data from the sensors including heart rate data and steps from the Galaxy Watch and the Phone itself. Step counts are collected from pedometer and accelerometer sensors. Heart rate is measured through the PPG (Photoplethysmogram) sensor in your watch. For these data, you have to look into the following files.
Heart rate data are included in the following file.
com.samsung.shealth.tracker.heart_rate.T.csv
The important information in this file is the update_time and heart_rate columns. You will also find the min and max values along with end_time, which shows the end of the recording.
Out of curiosity, I plotted a histogram of my heart rates to see how my heart behaves. It seems I have a heart rate in the range 65–80bps. Googling resulted in “A normal resting heart rate for adults ranges from 60 to 100 beats per minute”. I guess the histogram makes sense. One of the main concerns, when I bought the watch, was to keep a note of my heart rate. Because, usually at the doctors, I have an above-average heart rate with a panicked person’s blood pressure. Read here if you want to know more about that scenario at Doctors.
Step tracker data are available in the following files;
com.samsung.shealth.step_daily_trend.202008162231.csvcom.samsung.shealth.tracker.pedometer_step_count.202008162231.csvcom.samsung.shealth.tracker.pedometer_day_summary.202008162231.csv
In the step_daily_trend you will see the daily values with step count, calories burnt, distance walked and the speed. However, in the pedometer_step_count you will find all the step information including running steps, walking steps. Basically this file contains the pedometer tracking information. In the last file (pedometer_day_summary), you can find the daily step summaries. Which might be enough for most of the tasks.
Let’s try to do some simple analysis of these data.
The above observation sort of aligns with the seasonal changes here in Australia. During the time June to December, we have cold temperatures. From December to June, we have much better running weather. However, COVID-19 came into play here in Canberra during the April and May, hence the low activity. However, in June my wife and I walked and tried to get back on the shape so we can eat out a lot during our anniversary period.
Step count isn’t quite a generic measure of activity. One might workout in a gym without any step count yet burning a lot of fat. Such activities are usually measured by calories using the heart rate sensor. However, as you can see below, my calorie counts are somewhat correlated with the step counts (There is a slight deviation of the X-axis, but they are close). This is because the only workout I prefer is running or jogging.
Something interesting is visible. On days I have run, I haven’t made many steps. In contrast, on walking days I have made it over 10000 steps. I wonder, whether I get tired on days I walk or the running steps aren’t counted for daily step count. Something I shall investigate in another article though.
There is more information including, weight and carb intakes. For that, you’ll have to have them recorded manually. However, there are some insightful data in the following file.
com.samsung.shealth.exercise.weather.T.csv
However, in order to use this file, you’ll have to combine this with the exercise file. That is for another article!
I hope this article would make a useful outcome of the data that you most often get rid of. Happy reading!