earthobservations / luftdatenpumpe

Acquire and process live and historical air quality data without efforts. Filter by station-id, sensor-id and sensor-type, apply reverse geocoding, store into time-series and RDBMS databases, publish to MQTT, output as JSON, or visualize in Grafana. Data sources: Sensor.Community (luftdaten.info), IRCELINE, and OpenAQ.
https://luftdatenpumpe.readthedocs.io/
GNU Affero General Public License v3.0
34 stars 3 forks source link

Importing historical data from LDI croaks #10

Closed amotl closed 4 years ago

amotl commented 4 years ago

When looking at #9, we found that luftdatenpumpe would croak when importing historical data from luftdaten.info being invoked by

luftdatenpumpe readings --network=ldi --source=file:///var/spool/archive.luftdaten.info

like

2019-09-28 22:59:12,344 [luftdatenpumpe.source.luftdaten_info] ERROR  : Could not make observation from {'timestamp': '2015-10-01T14:02:48.841131+00:00', 'location': {'id': 19, 'latitude': 48.722, 'longitude': 9.209}, 'sensor': {'id': 39, 'sensor_type': {'name': 'PPD42NS'}}}
Traceback (most recent call last):
  File "/Users/amo/dev/daq-tools/sources/luftdatenpumpe/luftdatenpumpe/source/luftdaten_info.py", line 374, in csv_reader
    reading = self.make_reading(csv_record)
  File "/Users/amo/dev/daq-tools/sources/luftdatenpumpe/luftdatenpumpe/source/luftdaten_info.py", line 144, in make_reading
    sensor_type_id = item['sensor']['sensor_type']['id']
KeyError: 'id'

@wetterfrosch also noticed this problem the other day.

amotl commented 4 years ago

This problem has probably been introduced by 4532407a.

amotl commented 4 years ago

The issue has been mitigated by 65865ec2. Enjoy.