Convert Nightscout profiles to OpenAPS format
(so you can run Autotune on them)
const nsProfileConvert = require("nightscout-profile-convert")
const fetchProfile = nsProfileConvert.fetchProfile
const convertProfile = nsProfileConvert.convertProfile
const my_nightscout_url = "https://my.ns.site"
// Load the default Profile from a Nightscout site
let profile_default = await fetchProfile(my_nightscout_url)
// Load a profile by name
let profile_autotune = await fetchProfile(my_nightscout_url, "autotune")
// Convert a profile to OpenAPS format
// (!) You have to provide min_5m_carbimpact yourself,
// (!) since Nightscout profiles don't contain this value.
let openaps_profile = convertProfile(profile_default, /*min_5m_carbimpact*/ 3)