#!/bin/bash

# Author: Ben West @bewest
# Maintainer: @tghoward

# Written for decocare v0.0.18. Will need updating the the decocare json format changes.
HISTORY=${1-glucosehistory.json}
OUTPUT=${2-/dev/fd/1}
#TZ=${3-$(date +%z)}

cat $HISTORY | \
  json -e "this.medtronic = this._type;" | \
  json -e "this.dateString = this.date + '$(date +%z)'" | \
  json -e "this.date = new Date(this.dateString).getTime();" | \
  json -e "this.type = (this.name == 'GlucoseSensorData') ? 'sgv' : 'pumpdata'" | \
  json -e "this.device = 'openaps://medtronic/pump/cgm'" \
  > $OUTPUT


Format mm glucose for oref0 tools
Format mm glucose for oref0 tools

Add tool with @tghoward, to format mm style glucose records to what the oref0
tools expect.
