diff --git a/code/download_csv.py b/code/download_csv.py index cb6f194..6a9be60 100644 --- a/code/download_csv.py +++ b/code/download_csv.py @@ -121,6 +121,8 @@ def main(): # files that have already been downloaded cur_files = set(os.listdir(DOWNLOAD_FOLDER)) + + # filter for location rather then device_id db = next(get_db()) stations = set(str(s.device) for s in db.query(Station).all()) diff --git a/code/services/data_service.py b/code/services/data_service.py index cb660ce..bab5955 100644 --- a/code/services/data_service.py +++ b/code/services/data_service.py @@ -77,11 +77,13 @@ def sensor_community_import_grouped_by_location(db: Session, data: dict, source: # only add values if the measurement is not yet present for val in row['sensordatavalues']: - if not float_default(val['value']): + d = Dimension.get_dimension_from_sensor_community_name_import(val['value_type']) + v = float_default(val['value']) + if d is None or v is None: continue value = Values( - dimension = Dimension.get_dimension_from_sensor_community_name_import(val['value_type']), - value = float_default(val['value']), + dimension = d, + value = v, measurement_id = measurement.id ) db.add(value)