def require_amount_dimension(mapping): """ Each mapping needs to have a amount dimension. """ if 'amount' not in mapping.keys(): return "Mapping does not contain an amount measure." \ "At least this measure must exist and contain " \ "the key value of this entry." # TODO: in the future, this should check 'type': if mapping['amount'].get('datatype') != 'float': return "The amount must be a numeric the datatype " \ "(i.e. 'float') to be a valid measure." return True
def require_time_dimension(mapping): """ Each mapping needs to have a time dimension. """ if 'time' not in mapping.keys(): return "Mapping does not contain a time dimension." \ "The dimension must exist and contain a date " \ "to describe the entry." # TODO: in the future, this should check 'type': if mapping['time'].get('datatype') != 'date': return "The 'time' dimension must have the datatype " \ "'date' as it will be converted to a date " \ "dimension." return True