def construct_from_jdict(cls, jdict): if not jdict: return None serial_number = jdict.get('serial_number') afe_type = jdict.get('type') calibrated_on = Datum.date(jdict.get('calibrated_on')) dispatched_on = Datum.date(jdict.get('dispatched_on')) pt1000_v20 = jdict.get('pt1000_v20') pt100_calib = Pt1000Calib(calibrated_on, pt1000_v20) if pt1000_v20 is not None else None sensor_calibs = [] for key in sorted(jdict.keys()): if key[:2] == "sn": if jdict[key] is None: sensor_calibs.append(None) continue sensor_type = jdict[key]['sensor_type'] if sensor_type[-2:] == 'A4' or sensor_type[:2] == 'SN': sensor_calibs.append(A4Calib.construct_from_jdict(jdict[key])) elif sensor_type[:3] == 'PID': sensor_calibs.append(PIDCalib.construct_from_jdict(jdict[key])) return AFECalib(serial_number, afe_type, calibrated_on, dispatched_on, pt100_calib, sensor_calibs)
def construct_from_jdict(cls, jdict): if not jdict: return None serial_number = jdict.get('serial_number') afe_type = jdict.get('type') calibrated_on = Datum.date(jdict.get('calibrated_on')) dispatched_on = Datum.date(jdict.get('dispatched_on')) pt1000_v20 = jdict.get('pt1000_v20') pt100_calib = None if pt1000_v20 is None else Pt1000Calib( calibrated_on, pt1000_v20) sensor_calibs = [] for key in sorted(jdict.keys()): if key[:2] == "sn": if jdict[key] is None: sensor_calibs.append(None) continue sensor_calibs.append( SensorCalib.construct_from_jdict(jdict[key])) return AFECalib(serial_number, afe_type, calibrated_on, dispatched_on, pt100_calib, sensor_calibs)
def construct_from_jdict(cls, jdict): if not jdict: return None if 'calibrated_on' in jdict: # TODO: deprecated date = Datum.date(jdict.get('calibrated_on')) calibrated_on = LocalizedDatetime.construct_from_date(date) else: calibrated_on = Datum.datetime(jdict.get('calibrated-on')) v20 = jdict.get('v20') return Pt1000Calib(calibrated_on, v20)
def construct_from_jdict(cls, jdict): if not jdict: return SensorBaseline(None, 0) if 'calibrated_on' in jdict: # TODO: deprecated date = Datum.date(jdict.get('calibrated_on')) calibrated_on = LocalizedDatetime.construct_from_date(date) else: calibrated_on = Datum.datetime(jdict.get('calibrated-on')) offset = Datum.int(jdict.get('offset')) return SensorBaseline(calibrated_on, offset)