def surv_data_2_ref(surv_data): # instantiate an empty reference ref = Reference() # add meta data to reference # at present just a timestamp from time import gmtime, strftime ref.set_meta({'timestamp':strftime("%Y-%m-%d %H:%M:%S", gmtime())}) for channel_code in objectives_channel_codes: # add reference objective corresponding to each model objective if channel_code == 'prevalence': #debug_p('surv_data ' + str(surv_data['prevalence'])) d_points = prevalence_surv_data_2_d_points(surv_data['prevalence']) else: msg = "Channel " + channel_code + " not implemeneted yet!\nSetting reference data to None." warn_p(msg) d_points = None #debug_p('adding objective ' + channel_code) #debug_p('num d_points ' + str(len(d_points))) ref.add_objective(channel_code, d_points) return ref