Skip to content

Instantly share code, notes, and snippets.

@vnegi10
Created October 3, 2021 14:11
Show Gist options
  • Save vnegi10/7874f41404c7e06130e90c60c33d6aa0 to your computer and use it in GitHub Desktop.
Save vnegi10/7874f41404c7e06130e90c60c33d6aa0 to your computer and use it in GitHub Desktop.
# GitHub link
const URL = "https://raw.githubusercontent.com/vnegi10/Health_data_analysis/master/data"
# CSV files from Samsung Health app
files = ["com.samsung.shealth.tracker.pedometer_day_summary.202110031456.csv",
"com.samsung.shealth.tracker.heart_rate.202110031456.csv",
"com.samsung.health.floors_climbed.202110031456.csv"]
# Function to generate url
gen_url(file::String, url::String=URL) = joinpath(url, file)
# Function to convert url to DataFrame
url_to_df(url::String) = CSV.File(HTTP.get(url, require_ssl_verification = false).body, header = 2) |> DataFrame
df_pedometer_raw, df_heart_raw, df_floors_raw = [url_to_df(gen_url(file)) for file in files]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment