From c7fb8bab3ffefbfa65a14bee1024a30757d47fdd Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Thu, 20 Jun 2024 07:59:18 +0930 Subject: [PATCH 1/2] Handle PS-15 sondes --- lambda/sonde_api_to_iot_core/__init__.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lambda/sonde_api_to_iot_core/__init__.py b/lambda/sonde_api_to_iot_core/__init__.py index 7b23255..8dea6c6 100644 --- a/lambda/sonde_api_to_iot_core/__init__.py +++ b/lambda/sonde_api_to_iot_core/__init__.py @@ -260,8 +260,8 @@ def telemetry_filter(telemetry): else: vaisala_callsign_valid = False - # Just make sure we're not getting the 'xxxxxxxx' unknown serial from the DFM decoder. - if "DFM" in telemetry["type"]: + # Just make sure we're not getting the 'xxxxxxxx' unknown serial from the DFM decoder (Which also includes PS-15 pilotsondes) + if "DFM" in telemetry["type"] or telemetry["type"] == "PS-15": dfm_callsign_valid = "x" not in _serial else: dfm_callsign_valid = False @@ -292,14 +292,9 @@ def telemetry_filter(telemetry): or ("WxR" in telemetry["type"]) ): _id_msg = "Payload ID %s from Sonde type %s is invalid." % (telemetry["serial"], telemetry["type"]) - # Add in a note about DFM sondes and their oddness... - if "DFM" in telemetry["serial"]: - _id_msg += " Note: DFM sondes may take a while to get an ID." - - if "MRZ" in telemetry["serial"]: - _id_msg += " Note: MRZ sondes may take a while to get an ID." return ("errors", _id_msg) + # https://github.com/projecthorus/sondehub-infra/issues/56 if "iMet-4" == telemetry["type"] or "iMet-1" == telemetry["type"]: if telemetry["software_name"] == "radiosonde_auto_rx": From c9af79fa0b13577e3562d4261bad0066277b5ab4 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Thu, 20 Jun 2024 08:18:33 +0930 Subject: [PATCH 2/2] Add PS-15 test --- lambda/sonde_api_to_iot_core/__main__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lambda/sonde_api_to_iot_core/__main__.py b/lambda/sonde_api_to_iot_core/__main__.py index 1e6d460..fd25bc2 100644 --- a/lambda/sonde_api_to_iot_core/__main__.py +++ b/lambda/sonde_api_to_iot_core/__main__.py @@ -233,5 +233,16 @@ class TestIngestion(unittest.TestCase): self.assertEqual(output["body"], "^v^ telm logged") self.assertEqual(output["statusCode"], 200) + def test_ps15_payload(self): + payload = copy.deepcopy(example_body) + payload[0]["datetime"] = datetime.datetime.now().isoformat() + payload[0]["type"] = "PS-15" + payload[0]["subtype"] = "PS-15" + payload[0]["serial"] = "21068595" + output = lambda_handler(compress_payload(payload), fakeContext()) + sns.publish.assert_called() + self.assertEqual(output["body"], "^v^ telm logged") + self.assertEqual(output["statusCode"], 200) + if __name__ == '__main__': unittest.main() \ No newline at end of file