From 09caf968e288c3ac07d41e6869b8865006aa09ab Mon Sep 17 00:00:00 2001 From: Chris Durbin Date: Thu, 10 Oct 2024 16:22:34 -0400 Subject: [PATCH] HARMONY-1912: Add support for the average parameter which specifies the averaging method to use for averaging services. --- example/example_message.json | 5 +++-- harmony_service_lib/message.py | 3 +++ tests/example_messages.py | 7 ++++--- tests/test_message.py | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/example/example_message.json b/example/example_message.json index 0c76f87..7a194ef 100644 --- a/example/example_message.json +++ b/example/example_message.json @@ -1,6 +1,6 @@ { - "$schema": "../../harmony/app/schemas/data-operation/0.19.0/data-operation-v0.19.0.json", - "version": "0.19.0", + "$schema": "../../harmony/app/schemas/data-operation/0.20.0/data-operation-v0.20.0.json", + "version": "0.20.0", "callback": "http://localhost/some-path", "stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/", "user": "jdoe", @@ -65,6 +65,7 @@ }] }, "concatenate": false, + "average": "time", "extendDimensions": [ "lat", "lon" diff --git a/harmony_service_lib/message.py b/harmony_service_lib/message.py index bcc77fe..a1e308f 100644 --- a/harmony_service_lib/message.py +++ b/harmony_service_lib/message.py @@ -617,6 +617,8 @@ class Message(JsonObject): concatenate: bool True if the service should concatenate multiple input files into a single output file and false otherwise. + average: string + The averaging method to use extendDimensions: list A list of dimensions to extend. extraArgs: object @@ -657,6 +659,7 @@ def __init__(self, json_str_or_dict, decrypter=lambda x: x): 'subset', 'temporal', 'concatenate', + 'average', 'extendDimensions', 'extraArgs' ], diff --git a/tests/example_messages.py b/tests/example_messages.py index 3fc888e..9251845 100644 --- a/tests/example_messages.py +++ b/tests/example_messages.py @@ -1,7 +1,7 @@ minimal_message = """ { "$schema": "../../harmony/app/schemas/data-operation/0.19.0/data-operation-v0.19.0.json", - "version": "0.19.0", + "version": "0.20.0", "callback": "http://localhost/some-path", "stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/", "user": "jdoe", @@ -20,7 +20,7 @@ minimal_source_message = """ { "$schema": "../../harmony/app/schemas/data-operation/0.19.0/data-operation-v0.19.0.json", - "version": "0.19.0", + "version": "0.20.0", "callback": "http://localhost/some-path", "stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/", "user": "jdoe", @@ -47,7 +47,7 @@ full_message = """ { "$schema": "../../harmony/app/schemas/data-operation/0.19.0/data-operation-v0.19.0.json", - "version": "0.19.0", + "version": "0.20.0", "callback": "http://localhost/some-path", "stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/", "user": "jdoe", @@ -180,6 +180,7 @@ }] }, "concatenate": true, + "average": "time", "extendDimensions": ["lat", "lon"], "extraArgs": { "cut": false, diff --git a/tests/test_message.py b/tests/test_message.py index f19d6e8..64e1412 100644 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -22,6 +22,7 @@ def test_when_provided_a_full_message_it_parses_it_into_objects(self): self.assertEqual(message.isSynchronous, True) self.assertEqual(message.accessToken, 'ABCD1234567890') self.assertEqual(message.concatenate, True) + self.assertEqual(message.average, 'time') self.assertEqual(message.sources[0].collection, 'C0001-EXAMPLE') self.assertEqual(message.sources[0].shortName, 'example_1_data') self.assertEqual(message.sources[0].versionId, '1')