Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data issues from DKSF analysis #719

Open
matschaffer opened this issue Jul 20, 2020 · 0 comments
Open

Data issues from DKSF analysis #719

matschaffer opened this issue Jul 20, 2020 · 0 comments

Comments

@matschaffer
Copy link
Contributor

matschaffer commented Jul 20, 2020

Multiple values at a given when_captured for a single sensor

Example data

Expand the query below. Note that this shows the sensor reporting 13 different lnd_7318c values for the same when_captured.

As far as @matschaffer knows this shouldn't happen unless possibly the device had 13 physical sensors. It should only have 1, and even if it had 13 we'd expect it to report them under different keys similar to how the multiple air sensors on the solarcast are reported via different prefixes.

from 2018

safecast=> select id, device_id, created_at, payload->>'when_captured' as when_captured, payload->>'lnd_7318c' as lnd_7318c from measurements where device_id = 4249659165 and payload->>'when_captured' like '2018-04-13T10:30%' limit 20;
    id    | device_id  |         created_at         |    when_captured     | lnd_7318c
----------+------------+----------------------------+----------------------+-----------
 13251718 | 4249659165 | 2018-04-13 10:30:37.653481 | 2018-04-13T10:30:37Z | 32
 13251717 | 4249659165 | 2018-04-13 10:30:36.905438 | 2018-04-13T10:30:36Z | 30
 13251716 | 4249659165 | 2018-04-13 10:30:36.816161 | 2018-04-13T10:30:36Z | 32
 13251715 | 4249659165 | 2018-04-13 10:30:36.800559 | 2018-04-13T10:30:36Z | 36
 13251714 | 4249659165 | 2018-04-13 10:30:36.789527 | 2018-04-13T10:30:36Z | 34
 13251713 | 4249659165 | 2018-04-13 10:30:36.782341 | 2018-04-13T10:30:36Z | 28
 13251712 | 4249659165 | 2018-04-13 10:30:36.760956 | 2018-04-13T10:30:36Z | 31
 13251711 | 4249659165 | 2018-04-13 10:30:36.670409 | 2018-04-13T10:30:36Z | 35
 13251710 | 4249659165 | 2018-04-13 10:30:36.583919 | 2018-04-13T10:30:36Z | 32
 13251709 | 4249659165 | 2018-04-13 10:30:36.581415 | 2018-04-13T10:30:36Z | 28
 13251708 | 4249659165 | 2018-04-13 10:30:36.574752 | 2018-04-13T10:30:36Z | 30
 13251707 | 4249659165 | 2018-04-13 10:30:36.568817 | 2018-04-13T10:30:36Z | 34
 13251706 | 4249659165 | 2018-04-13 10:30:36.56338  | 2018-04-13T10:30:36Z | 34
(13 rows)

from 2020 (lnd_7318c field only)

safecast=> select id, device_id, created_at, payload->>'when_captured' as when_captured, payload->>'lnd_7318c' as lnd_7318c from measurements where device_id = 2152053642 and payload->>'when_captured' = '2020-04-07T15:59:56Z' order by created_at desc limit 50;
    id    | device_id  |         created_at         |    when_captured     | lnd_7318c
----------+------------+----------------------------+----------------------+-----------
 36620415 | 2152053642 | 2020-04-07 15:59:56.657535 | 2020-04-07T15:59:56Z | 34
 36620414 | 2152053642 | 2020-04-07 15:59:56.651048 | 2020-04-07T15:59:56Z | 38
 36620413 | 2152053642 | 2020-04-07 15:59:56.64987  | 2020-04-07T15:59:56Z | 34
 36620412 | 2152053642 | 2020-04-07 15:59:56.642266 | 2020-04-07T15:59:56Z | 34
 36620411 | 2152053642 | 2020-04-07 15:59:56.62338  | 2020-04-07T15:59:56Z | 0
 36620410 | 2152053642 | 2020-04-07 15:59:56.62049  | 2020-04-07T15:59:56Z | 0
 36620409 | 2152053642 | 2020-04-07 15:59:56.614264 | 2020-04-07T15:59:56Z | 0
 36620408 | 2152053642 | 2020-04-07 15:59:56.609942 | 2020-04-07T15:59:56Z | 0
 36620407 | 2152053642 | 2020-04-07 15:59:56.602867 | 2020-04-07T15:59:56Z | 0
 36620406 | 2152053642 | 2020-04-07 15:59:56.584008 | 2020-04-07T15:59:56Z | 0
 36620405 | 2152053642 | 2020-04-07 15:59:56.581458 | 2020-04-07T15:59:56Z | 0
 36620404 | 2152053642 | 2020-04-07 15:59:56.56349  | 2020-04-07T15:59:56Z | 0
 36620403 | 2152053642 | 2020-04-07 15:59:56.561538 | 2020-04-07T15:59:56Z | 0
 36620402 | 2152053642 | 2020-04-07 15:59:56.558078 | 2020-04-07T15:59:56Z | 0
 36620401 | 2152053642 | 2020-04-07 15:59:56.535442 | 2020-04-07T15:59:56Z | 0
 36620400 | 2152053642 | 2020-04-07 15:59:56.524072 | 2020-04-07T15:59:56Z | 32
 36620399 | 2152053642 | 2020-04-07 15:59:56.521955 | 2020-04-07T15:59:56Z | 37
 36620398 | 2152053642 | 2020-04-07 15:59:56.520349 | 2020-04-07T15:59:56Z | 37
 36620397 | 2152053642 | 2020-04-07 15:59:56.50285  | 2020-04-07T15:59:56Z | 33
 36620396 | 2152053642 | 2020-04-07 15:59:56.472944 | 2020-04-07T15:59:56Z | 35
 36620395 | 2152053642 | 2020-04-07 15:59:56.47158  | 2020-04-07T15:59:56Z | 34
 36620394 | 2152053642 | 2020-04-07 15:59:56.465361 | 2020-04-07T15:59:56Z | 31
 36620393 | 2152053642 | 2020-04-07 15:59:56.462428 | 2020-04-07T15:59:56Z | 35
 36620392 | 2152053642 | 2020-04-07 15:59:56.455782 | 2020-04-07T15:59:56Z | 29
(24 rows)

from 2020 (full payloads)

safecast=> select id, device_id, created_at, payload->>'when_captured' as when_captured, payload from measurements where device_id = 2152053642 and payload->>'when_captured' = '2020-04-07T15:59:56Z' order by created_at desc limit 20;
    id    | device_id  |         created_at         |    when_captured     |
                                                                                                                                                               payload

----------+------------+----------------------------+----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 36620415 | 2152053642 | 2020-04-07 15:59:56.657535 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "device_sn": "Solarcast #30025", "lnd_7318c": 34, "lnd_7318u": 46, "device_urn": "safecast:2152053642", "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_
uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620414 | 2152053642 | 2020-04-07 15:59:56.651048 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "env_temp": 11.795080184936523, "device_sn": "Solarcast #30025", "env_humid": 84.25422668457031, "env_press": 1004.2040405273438, "lnd_7318c": 38, "lnd_7318u": 48, "opc_csecs": 120, "pms_csecs": 119, "bat_charge": 0, "device
_urn": "safecast:2152053642", "opc_c00_38": 1726, "opc_c00_54": 463, "opc_c01_00": 166, "opc_c02_10": 32, "opc_c05_00": 2, "opc_c10_00": 0, "opc_pm01_0": 2.3786752223968506, "opc_pm02_5": 3.0886943340301514, "opc_pm10_0": 3.8514506816864014, "pms_c00_30": 177465, "pms_c00_50": 32292, "pms_c01_00": 1851, "pms_c02_50": 118, "pms_c05_00": 31, "pms_c10_00": 10, "pms_pm01_0": 8, "pms_pm02_5": 11, "pms_pm10_0": 11, "bat_current":
-64.5, "bat_voltage": 2.676500082015991, "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620413 | 2152053642 | 2020-04-07 15:59:56.64987  | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "device_sn": "Solarcast #30025", "lnd_7318c": 34, "lnd_7318u": 33, "device_urn": "safecast:2152053642", "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_
uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620412 | 2152053642 | 2020-04-07 15:59:56.642266 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "env_temp": 10.328882217407227, "device_sn": "Solarcast #30025", "env_humid": 83.0650634765625, "env_press": 1004.3187866210938, "lnd_7318c": 34, "lnd_7318u": 37, "opc_csecs": 120, "pms_csecs": 118, "bat_charge": 0.0234375,
"device_urn": "safecast:2152053642", "opc_c00_38": 988, "opc_c00_54": 216, "opc_c01_00": 51, "opc_c02_10": 14, "opc_c05_00": 1, "opc_c10_00": 0, "opc_pm01_0": 1.8855983018875122, "opc_pm02_5": 2.2977805137634277, "opc_pm10_0": 2.751224994659424, "pms_c00_30": 26307, "pms_c00_50": 6332, "pms_c01_00": 1112, "pms_c02_50": 89, "pms_c05_00": 46, "pms_c10_00": 45, "pms_pm01_0": 3, "pms_pm02_5": 6, "pms_pm10_0": 7, "bat_current": -
106.109375, "bat_voltage": 2.8498125076293945, "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620411 | 2152053642 | 2020-04-07 15:59:56.62338  | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "env_temp": 9.21906852722168, "device_sn": "Solarcast #30025", "env_humid": 80.314208984375, "env_press": 1004.2243041992188, "lnd_7318c": 0, "lnd_7318u": 0, "bat_charge": 0, "device_urn": "safecast:2152053642", "bat_current
": -10.53125, "bat_voltage": 2.618405818939209, "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620410 | 2152053642 | 2020-04-07 15:59:56.62049  | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "device_sn": "Solarcast #30025", "lnd_7318c": 0, "lnd_7318u": 0, "device_urn": "safecast:2152053642", "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_up
loaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620409 | 2152053642 | 2020-04-07 15:59:56.614264 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "env_temp": 8.87289047241211, "device_sn": "Solarcast #30025", "env_humid": 81.84925842285156, "env_press": 1003.7578735351562, "lnd_7318c": 0, "lnd_7318u": 0, "bat_charge": 0, "device_urn": "safecast:2152053642", "bat_curre
nt": 3.375, "bat_voltage": 2.5622503757476807, "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620408 | 2152053642 | 2020-04-07 15:59:56.609942 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "env_temp": 8.750711441040039, "device_sn": "Solarcast #30025", "env_humid": 81.9976806640625, "env_press": 1003.2144165039062, "lnd_7318c": 0, "lnd_7318u": 0, "bat_charge": 0, "device_urn": "safecast:2152053642", "bat_curre
nt": 1.21875, "bat_voltage": 2.607109308242798, "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620407 | 2152053642 | 2020-04-07 15:59:56.602867 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "device_sn": "Solarcast #30025", "lnd_7318c": 0, "lnd_7318u": 0, "device_urn": "safecast:2152053642", "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_up
loaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620406 | 2152053642 | 2020-04-07 15:59:56.584008 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "env_temp": 8.679438591003418, "device_sn": "Solarcast #30025", "env_humid": 82.28104400634766, "env_press": 1003.0180053710938, "lnd_7318c": 0, "lnd_7318u": 0, "bat_charge": 0, "device_urn": "safecast:2152053642", "bat_curr
ent": 0.6875, "bat_voltage": 2.62654709815979, "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620405 | 2152053642 | 2020-04-07 15:59:56.581458 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "device_sn": "Solarcast #30025", "lnd_7318c": 0, "lnd_7318u": 0, "device_urn": "safecast:2152053642", "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_up
loaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620404 | 2152053642 | 2020-04-07 15:59:56.56349  | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "env_temp": 8.531805038452148, "device_sn": "Solarcast #30025", "env_humid": 82.92155456542969, "env_press": 1002.8268432617188, "lnd_7318c": 0, "lnd_7318u": 0, "bat_charge": 0, "device_urn": "safecast:2152053642", "bat_curr
ent": 4.078125, "bat_voltage": 2.675922393798828, "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620403 | 2152053642 | 2020-04-07 15:59:56.561538 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "device_sn": "Solarcast #30025", "lnd_7318c": 0, "lnd_7318u": 0, "device_urn": "safecast:2152053642", "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_up
loaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620402 | 2152053642 | 2020-04-07 15:59:56.558078 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "dev_temp": 8.760400772094727, "env_temp": 8.20599365234375, "dev_humid": 65.52760314941406, "dev_press": 1002.9585571289062, "device_sn": "Solarcast #30025", "env_humid": 84.17557525634766, "env_press": 1002.7620239257812,
"lnd_7318c": 0, "lnd_7318u": 0, "bat_charge": 0, "device_urn": "safecast:2152053642", "bat_current": 1.84375, "bat_voltage": 2.6645309925079346, "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620401 | 2152053642 | 2020-04-07 15:59:56.535442 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "env_temp": 7.870001316070557, "device_sn": "Solarcast #30025", "env_humid": 86.02291107177734, "env_press": 1002.784912109375, "lnd_7318c": 0, "lnd_7318u": 0, "bat_charge": 0, "device_urn": "safecast:2152053642", "bat_curre
nt": 1.234375, "bat_voltage": 2.6659998893737793, "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620400 | 2152053642 | 2020-04-07 15:59:56.524072 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "env_temp": 8.022725105285645, "device_sn": "Solarcast #30025", "env_humid": 87.09256744384766, "env_press": 1002.9321899414062, "lnd_7318c": 32, "lnd_7318u": 27, "bat_charge": 0, "device_urn": "safecast:2152053642", "bat_cu
rrent": 2.234375, "bat_voltage": 2.662875175476074, "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620399 | 2152053642 | 2020-04-07 15:59:56.521955 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "device_sn": "Solarcast #30025", "lnd_7318c": 37, "lnd_7318u": 41, "device_urn": "safecast:2152053642", "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_
uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620398 | 2152053642 | 2020-04-07 15:59:56.520349 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "env_temp": 8.46562385559082, "device_sn": "Solarcast #30025", "env_humid": 88.4491195678711, "env_press": 1003.0328979492188, "lnd_7318c": 37, "lnd_7318u": 34, "bat_charge": 0, "device_urn": "safecast:2152053642", "bat_curr
ent": 0.671875, "bat_voltage": 2.714484691619873, "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620397 | 2152053642 | 2020-04-07 15:59:56.50285  | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "device_sn": "Solarcast #30025", "lnd_7318c": 33, "lnd_7318u": 37, "device_urn": "safecast:2152053642", "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_
uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.14.80"}
 36620396 | 2152053642 | 2020-04-07 15:59:56.472944 | 2020-04-07T15:59:56Z | {"device": 2152053642, "loc_alt": 135, "loc_lat": 34.12196350097656, "loc_lon": -118.2613754272461, "loc_olc": "85634PCQ+QCQ", "env_temp": 9.458338737487793, "device_sn": "Solarcast #30025", "env_humid": 89.71832275390625, "env_press": 1003.0934448242188, "lnd_7318c": 35, "lnd_7318u": 37, "pms_csecs": 117, "bat_charge": 0, "device_urn": "safecast:21
52053642", "pms_c00_30": 7209, "pms_c00_50": 1314, "pms_c01_00": 134, "pms_c02_50": 14, "pms_c05_00": 0, "pms_c10_00": 0, "pms_pm01_0": 0, "pms_pm02_5": 1, "pms_pm10_0": 1, "bat_current": 2.734375, "bat_voltage": 2.843421459197998, "device_class": "safecast", "when_captured": "2020-04-07T15:59:56Z", "service_handler": "i-0c65ac97805549e0d", "service_uploaded": "2020-04-07T15:59:56Z", "service_transport": "device-tcp:172.31.1
4.80"}
(20 rows)

TTServe disk storage - can observe two different lnd_7318u values (33 & 48) for two payloads both captured/uploaded at 2020-04-07T15:59:56Z via device-tcp:172.31.14.80 to i-0c65ac97805549e0d

http://tt.safecast.org/device-log/2020-04-2152053642-30025.json
{"device_urn":"safecast:2152053642","device_class":"safecast","device_sn":"Solarcast #30025","device":2152053642,"when_captured":"2020-04-07T15:59:56Z","loc_lat":34.12196350097656,"loc_lon":-118.2613754272461,"loc_alt":135,"loc_olc":"85634PCQ+QCQ","lnd_7318u":33,"lnd_7318c":34,"service_uploaded":"2020-04-07T15:59:56Z","service_transport":"device-tcp:172.31.14.80","service_handler":"i-0c65ac97805549e0d"}
,
{"device_urn":"safecast:2152053642","device_class":"safecast","device_sn":"Solarcast #30025","device":2152053642,"when_captured":"2020-04-07T15:59:56Z","loc_lat":34.12196350097656,"loc_lon":-118.2613754272461,"loc_alt":135,"loc_olc":"85634PCQ+QCQ","env_temp":11.795080184936523,"env_humid":84.25422668457031,"env_press":1004.2040405273438,"bat_voltage":2.676500082015991,"bat_current":-64.5,"bat_charge":0,"lnd_7318u":48,"lnd_7318c":38,"pms_pm01_0":8,"pms_pm02_5":11,"pms_pm10_0":11,"pms_c00_30":177465,"pms_c00_50":32292,"pms_c01_00":1851,"pms_c02_50":118,"pms_c05_00":31,"pms_c10_00":10,"pms_csecs":119,"opc_pm01_0":2.3786752223968506,"opc_pm02_5":3.0886943340301514,"opc_pm10_0":3.8514506816864014,"opc_c00_38":1726,"opc_c00_54":463,"opc_c01_00":166,"opc_c02_10":32,"opc_c05_00":2,"opc_c10_00":0,"opc_csecs":120,"service_uploaded":"2020-04-07T15:59:56Z","service_transport":"device-tcp:172.31.14.80","service_handler":"i-0c65ac97805549e0d"}

Possible cause

Measurements seem to be coming in without when_captured then it's being set by ttserve https://github.com/Safecast/TTServe/blob/master/stamp.go#L264-L266 to Now()

The when_captured may be missing due to a compression glitch. https://safecast.slack.com/archives/C014YRM0E7R/p1595216845201100

"Time Traveling" data series from a given device

Example data

Expand the query below. Note how the when_captured value flips between 2020-05-15 and 2020-07-09 while service_uploaded is all 2020-07-09

safecast=> select id, device_id, payload->>'loc_lat' as loc_lat, payload->>'loc_lon' as loc_lon, created_at, payload->>'when_captured' as when_captured, payload->>'service_uploaded' as service_uploaded from measurements where device_id = 4249659165 and created_at between '2020-07-09 00:00:00' and '2020-07-09 23:00:00' order by created_at desc;
    id    | device_id  |      loc_lat      |       loc_lon       |         created_at         |    when_captured     |   service_uploaded
----------+------------+-------------------+---------------------+----------------------------+----------------------+----------------------
 39435701 | 4249659165 | 34.13214111328125 | -118.8419418334961  | 2020-07-09 19:54:22.316881 | 2020-07-09T19:54:20Z | 2020-07-09T19:54:22Z
 39435696 | 4249659165 | 34.13214111328125 | -118.8419418334961  | 2020-07-09 19:54:07.060259 | 2020-07-09T19:54:05Z | 2020-07-09T19:54:07Z
 39427687 | 4249659165 | 34.13241958618164 | -118.8419418334961  | 2020-07-09 13:54:07.350453 | 2020-07-09T13:54:07Z | 2020-07-09T13:54:07Z
 39427686 | 4249659165 | 34.13241958618164 | -118.8419418334961  | 2020-07-09 13:54:07.347436 | 2020-07-09T13:54:07Z | 2020-07-09T13:54:07Z
 39424864 | 4249659165 | 34.13241958618164 | -118.8419418334961  | 2020-07-09 11:47:34.927736 | 2020-05-15T04:28:28Z | 2020-07-09T11:47:32Z
 39424855 | 4249659165 | 34.13241958618164 | -118.8419418334961  | 2020-07-09 11:47:34.311268 | 2020-05-15T06:58:28Z | 2020-07-09T11:47:32Z
 39424854 | 4249659165 | 34.13241958618164 | -118.8419418334961  | 2020-07-09 11:47:34.310781 | 2020-05-15T06:43:12Z | 2020-07-09T11:47:32Z
 39424843 | 4249659165 | 34.13241958618164 | -118.8419418334961  | 2020-07-09 11:47:34.024617 | 2020-05-14T16:13:34Z | 2020-07-09T11:47:30Z
 39424842 | 4249659165 | 34.13241958618164 | -118.8419418334961  | 2020-07-09 11:47:34.002897 | 2020-05-15T02:28:12Z | 2020-07-09T11:47:32Z
 39424804 | 4249659165 | 34.13241958618164 | -118.8419418334961  | 2020-07-09 11:47:33.112791 | 2020-05-14T10:43:12Z | 2020-07-09T11:47:26Z
 39424786 | 4249659165 | 34.13241958618164 | -118.8419418334961  | 2020-07-09 11:47:32.108635 | 2020-05-14T07:43:28Z | 2020-07-09T11:47:26Z
 39424755 | 4249659165 | 34.13172149658203 | -118.84221649169922 | 2020-07-09 11:47:31.816383 | 2020-07-09T11:47:25Z | 2020-07-09T11:47:25Z
 39424719 | 4249659165 | 34.13241958618164 | -118.8419418334961  | 2020-07-09 11:47:30.833342 | 2020-05-14T06:58:12Z | 2020-07-09T11:47:26Z
 39424713 | 4249659165 | 34.13241958618164 | -118.8419418334961  | 2020-07-09 11:47:30.782786 | 2020-05-14T02:28:28Z | 2020-07-09T11:47:23Z
 39423439 | 4249659165 | 34.13172149658203 | -118.84221649169922 | 2020-07-09 11:47:00.45224  | 2020-05-12T07:27:30Z | 2020-07-09T11:46:59Z
 39418449 | 4249659165 | 34.13235855102539 | -118.841796875      | 2020-07-09 07:39:22.804848 | 2020-07-09T07:39:22Z | 2020-07-09T07:39:22Z

Likely cause from @rayozzie on slack

the way that the solarcast/scnano code base works is that whenever the gps or network report a new timedate, the device saves:

  • what is that timedate
  • how many seconds since boot

All of this is fine except “seconds since boot” is derived by asking the nordic firmware how many ticks since boot, and dividing it, etc.

Unfortunately, I can see now that nordic does 32768 ticks per second, which means that it isn’t going to take long for us to wrap.

What is striking to me is that the difference between the May date and the July date is approximately 65K seconds, plus or minus.

I think there is a wrap issue here.

(airnote uses in64 to hold ms; solarcast uses uint32 to hold ‘ticks’)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant