Separate out code into functions

Code to generate BG readings dict and daily readings dict in separate
functions.