From ae0451e5e30e5dd2d593d117fa9df794e4c3e9f9 Mon Sep 17 00:00:00 2001 From: Jono Gray Date: Tue, 7 Apr 2020 21:34:21 +0100 Subject: [PATCH] Add unmoving at reference location counts to api, and remove some sampling from top level queries --- .../active_at_reference_location.py | 12 +- .../server/query_schemas/consecutive_trips.py | 11 +- .../server/query_schemas/flowmachine_query.py | 4 + .../query_schemas/reference_location.py | 16 ++ .../query_schemas/unique_location_counts.py | 16 +- .../unmoving_at_reference_location_counts.py | 64 ++++++++ .../server/query_schemas/unmoving_counts.py | 5 +- ...t_generated_openapi_json_spec.approved.txt | 145 +++++++++++++++--- .../flowmachine_server_tests/test_server.py | 1 + ..._of_flowmachine_query_schemas.approved.txt | 45 +++--- 10 files changed, 240 insertions(+), 79 deletions(-) create mode 100644 flowmachine/flowmachine/core/server/query_schemas/reference_location.py create mode 100644 flowmachine/flowmachine/core/server/query_schemas/unmoving_at_reference_location_counts.py diff --git a/flowmachine/flowmachine/core/server/query_schemas/active_at_reference_location.py b/flowmachine/flowmachine/core/server/query_schemas/active_at_reference_location.py index f2d27e5196f..5fa2033096e 100644 --- a/flowmachine/flowmachine/core/server/query_schemas/active_at_reference_location.py +++ b/flowmachine/flowmachine/core/server/query_schemas/active_at_reference_location.py @@ -4,7 +4,6 @@ from marshmallow import fields, post_load from marshmallow.validate import OneOf -from marshmallow_oneofschema import OneOfSchema from flowmachine.features.subscriber.active_at_reference_location import ( ActiveAtReferenceLocation, @@ -16,19 +15,10 @@ __all__ = ["ActiveAtReferenceLocationSchema", "ActiveAtReferenceLocationExposed"] -from .daily_location import DailyLocationSchema -from .modal_location import ModalLocationSchema +from .reference_location import ReferenceLocationSchema from .unique_locations import UniqueLocationsSchema -class ReferenceLocationSchema(OneOfSchema): - type_field = "query_kind" - type_schemas = { - "daily_location": DailyLocationSchema, - "modal_location": ModalLocationSchema, - } - - class ActiveAtReferenceLocationSchema(BaseQueryWithSamplingSchema): # query_kind parameter is required here for claims validation query_kind = fields.String(validate=OneOf(["active_at_reference_location"])) diff --git a/flowmachine/flowmachine/core/server/query_schemas/consecutive_trips.py b/flowmachine/flowmachine/core/server/query_schemas/consecutive_trips.py index 0a0c6d29b87..37e7dc9ccb8 100644 --- a/flowmachine/flowmachine/core/server/query_schemas/consecutive_trips.py +++ b/flowmachine/flowmachine/core/server/query_schemas/consecutive_trips.py @@ -2,7 +2,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -from marshmallow import fields, post_load +from marshmallow import fields, post_load, Schema from marshmallow.validate import OneOf from flowmachine.features.location.redacted_consecutive_trips import ( @@ -10,17 +10,14 @@ ) from flowmachine.features.utilities.subscriber_locations import SubscriberLocations from flowmachine.features.location.consecutive_trips import ConsecutiveTrips +from . import BaseExposedQuery from .custom_fields import SubscriberSubset from .aggregation_unit import AggregationUnit, get_spatial_unit_obj -from .base_query_with_sampling import ( - BaseQueryWithSamplingSchema, - BaseExposedQueryWithSampling, -) __all__ = ["ConsecutiveTripsSchema", "ConsecutiveTripsExposed"] -class ConsecutiveTripsSchema(BaseQueryWithSamplingSchema): +class ConsecutiveTripsSchema(Schema): # query_kind parameter is required here for claims validation query_kind = fields.String(validate=OneOf(["consecutive_trips"])) start_date = fields.Date(required=True) @@ -33,7 +30,7 @@ def make_query_object(self, params, **kwargs): return ConsecutiveTripsExposed(**params) -class ConsecutiveTripsExposed(BaseExposedQueryWithSampling): +class ConsecutiveTripsExposed(BaseExposedQuery): def __init__( self, start_date, diff --git a/flowmachine/flowmachine/core/server/query_schemas/flowmachine_query.py b/flowmachine/flowmachine/core/server/query_schemas/flowmachine_query.py index c004c35d916..9459de24525 100644 --- a/flowmachine/flowmachine/core/server/query_schemas/flowmachine_query.py +++ b/flowmachine/flowmachine/core/server/query_schemas/flowmachine_query.py @@ -34,6 +34,9 @@ from .total_network_objects import TotalNetworkObjectsSchema from .dfs_metric_total_amount import DFSTotalMetricAmountSchema from .unique_visitor_counts import UniqueVisitorCountsSchema +from .unmoving_at_reference_location_counts import ( + UnmovingAtReferenceLocationCountsSchema, +) from .unmoving_counts import UnmovingCountsSchema @@ -59,6 +62,7 @@ class FlowmachineQuerySchema(OneOfSchema): "unique_visitor_counts": UniqueVisitorCountsSchema, "consecutive_trips": ConsecutiveTripsSchema, "unmoving_counts": UnmovingCountsSchema, + "unmoving_at_reference_location_counts": UnmovingAtReferenceLocationCountsSchema, } diff --git a/flowmachine/flowmachine/core/server/query_schemas/reference_location.py b/flowmachine/flowmachine/core/server/query_schemas/reference_location.py new file mode 100644 index 00000000000..51bd4e9b948 --- /dev/null +++ b/flowmachine/flowmachine/core/server/query_schemas/reference_location.py @@ -0,0 +1,16 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from marshmallow_oneofschema import OneOfSchema + +from flowmachine.core.server.query_schemas.daily_location import DailyLocationSchema +from flowmachine.core.server.query_schemas.modal_location import ModalLocationSchema + + +class ReferenceLocationSchema(OneOfSchema): + type_field = "query_kind" + type_schemas = { + "daily_location": DailyLocationSchema, + "modal_location": ModalLocationSchema, + } diff --git a/flowmachine/flowmachine/core/server/query_schemas/unique_location_counts.py b/flowmachine/flowmachine/core/server/query_schemas/unique_location_counts.py index 793850b5470..d83b2684739 100644 --- a/flowmachine/flowmachine/core/server/query_schemas/unique_location_counts.py +++ b/flowmachine/flowmachine/core/server/query_schemas/unique_location_counts.py @@ -2,21 +2,18 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -from marshmallow import fields, post_load -from marshmallow.validate import OneOf, Length +from marshmallow import fields, post_load, Schema +from marshmallow.validate import OneOf from flowmachine.features import UniqueLocationCounts +from . import BaseExposedQuery from .custom_fields import SubscriberSubset from .aggregation_unit import AggregationUnit, get_spatial_unit_obj -from .base_query_with_sampling import ( - BaseQueryWithSamplingSchema, - BaseExposedQueryWithSampling, -) __all__ = ["UniqueLocationCountsSchema", "UniqueLocationCountsExposed"] -class UniqueLocationCountsSchema(BaseQueryWithSamplingSchema): +class UniqueLocationCountsSchema(Schema): query_kind = fields.String(validate=OneOf(["unique_location_counts"])) start_date = fields.Date(required=True) end_date = fields.Date(required=True) @@ -28,7 +25,7 @@ def make_query_object(self, params, **kwargs): return UniqueLocationCountsExposed(**params) -class UniqueLocationCountsExposed(BaseExposedQueryWithSampling): +class UniqueLocationCountsExposed(BaseExposedQuery): def __init__( self, *, @@ -44,10 +41,9 @@ def __init__( self.end_date = end_date self.aggregation_unit = aggregation_unit self.subscriber_subset = subscriber_subset - self.sampling = sampling @property - def _unsampled_query_obj(self): + def _flowmachine_query_obj(self): """ Return the underlying flowmachine unique_location_counts object. diff --git a/flowmachine/flowmachine/core/server/query_schemas/unmoving_at_reference_location_counts.py b/flowmachine/flowmachine/core/server/query_schemas/unmoving_at_reference_location_counts.py new file mode 100644 index 00000000000..bfdcee36bab --- /dev/null +++ b/flowmachine/flowmachine/core/server/query_schemas/unmoving_at_reference_location_counts.py @@ -0,0 +1,64 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from marshmallow import fields, post_load, Schema +from marshmallow.validate import OneOf + +from flowmachine.features.location.redacted_unmoving_at_reference_location_counts import ( + RedactedUnmovingAtReferenceLocationCounts, +) +from flowmachine.features.location.unmoving_at_reference_location_counts import ( + UnmovingAtReferenceLocationCounts, +) +from flowmachine.features.subscriber.unmoving_at_reference_location import ( + UnmovingAtReferenceLocation, +) +from . import BaseExposedQuery +from .reference_location import ReferenceLocationSchema +from .base_query_with_sampling import BaseQueryWithSamplingSchema +from .unique_locations import UniqueLocationsSchema + +__all__ = [ + "UnmovingAtReferenceLocationCountsSchema", + "UnmovingAtReferenceLocationCountsExposed", +] + + +class UnmovingAtReferenceLocationCountsSchema(Schema): + # query_kind parameter is required here for claims validation + query_kind = fields.String( + validate=OneOf(["unmoving_at_reference_location_counts"]) + ) + locations = fields.Nested(UniqueLocationsSchema) + reference_locations = fields.Nested(ReferenceLocationSchema) + + @post_load + def make_query_object(self, params, **kwargs): + return UnmovingAtReferenceLocationCountsExposed(**params) + + +class UnmovingAtReferenceLocationCountsExposed(BaseExposedQuery): + def __init__(self, locations, reference_locations): + # Note: all input parameters need to be defined as attributes on `self` + # so that marshmallow can serialise the object correctly. + self.locations = locations + self.reference_locations = reference_locations + + @property + def _flowmachine_query_obj(self): + """ + Return the underlying flowmachine object. + + Returns + ------- + Query + """ + return RedactedUnmovingAtReferenceLocationCounts( + unmoving_at_reference_location_counts=UnmovingAtReferenceLocationCounts( + UnmovingAtReferenceLocation( + locations=self.locations._flowmachine_query_obj, + reference_locations=self.reference_locations._flowmachine_query_obj, + ) + ) + ) diff --git a/flowmachine/flowmachine/core/server/query_schemas/unmoving_counts.py b/flowmachine/flowmachine/core/server/query_schemas/unmoving_counts.py index d5929f257b8..b53403a136e 100644 --- a/flowmachine/flowmachine/core/server/query_schemas/unmoving_counts.py +++ b/flowmachine/flowmachine/core/server/query_schemas/unmoving_counts.py @@ -2,7 +2,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -from marshmallow import fields, post_load +from marshmallow import fields, post_load, Schema from marshmallow.validate import OneOf from flowmachine.features.location.redacted_unmoving_counts import ( @@ -11,13 +11,12 @@ from flowmachine.features.location.unmoving_counts import UnmovingCounts from flowmachine.features.subscriber.unmoving import Unmoving from . import BaseExposedQuery -from .base_query_with_sampling import BaseQueryWithSamplingSchema from .unique_locations import UniqueLocationsSchema __all__ = ["UnmovingCountsSchema", "UnmovingCountsExposed"] -class UnmovingCountsSchema(BaseQueryWithSamplingSchema): +class UnmovingCountsSchema(Schema): # query_kind parameter is required here for claims validation query_kind = fields.String(validate=OneOf(["unmoving_counts"])) locations = fields.Nested(UniqueLocationsSchema) diff --git a/integration_tests/tests/flowapi_tests/test_api_spec.test_generated_openapi_json_spec.approved.txt b/integration_tests/tests/flowapi_tests/test_api_spec.test_generated_openapi_json_spec.approved.txt index 8517c080e57..3a6d16820d1 100644 --- a/integration_tests/tests/flowapi_tests/test_api_spec.test_generated_openapi_json_spec.approved.txt +++ b/integration_tests/tests/flowapi_tests/test_api_spec.test_generated_openapi_json_spec.approved.txt @@ -140,14 +140,6 @@ ], "type": "string" }, - "sampling": { - "allOf": [ - { - "$ref": "#/components/schemas/RandomSample" - } - ], - "nullable": true - }, "start_date": { "format": "date", "type": "string" @@ -436,6 +428,7 @@ "total_network_objects": "#/components/schemas/TotalNetworkObjects", "unique_subscriber_counts": "#/components/schemas/UniqueSubscriberCounts", "unique_visitor_counts": "#/components/schemas/UniqueVisitorCounts", + "unmoving_at_reference_location_counts": "#/components/schemas/UnmovingAtReferenceLocationCounts", "unmoving_counts": "#/components/schemas/UnmovingCounts" }, "propertyName": "query_kind" @@ -492,6 +485,9 @@ { "$ref": "#/components/schemas/UniqueVisitorCounts" }, + { + "$ref": "#/components/schemas/UnmovingAtReferenceLocationCounts" + }, { "$ref": "#/components/schemas/UnmovingCounts" } @@ -1660,14 +1656,6 @@ ], "type": "string" }, - "sampling": { - "allOf": [ - { - "$ref": "#/components/schemas/RandomSample" - } - ], - "nullable": true - }, "start_date": { "format": "date", "type": "string" @@ -1790,24 +1778,33 @@ }, "type": "object" }, - "UnmovingCounts": { + "UnmovingAtReferenceLocationCounts": { "properties": { "locations": { "$ref": "#/components/schemas/UniqueLocations" }, "query_kind": { "enum": [ - "unmoving_counts" + "unmoving_at_reference_location_counts" ], "type": "string" }, - "sampling": { - "allOf": [ - { - "$ref": "#/components/schemas/RandomSample" - } + "reference_locations": { + "$ref": "#/components/schemas/ReferenceLocation" + } + }, + "type": "object" + }, + "UnmovingCounts": { + "properties": { + "locations": { + "$ref": "#/components/schemas/UniqueLocations" + }, + "query_kind": { + "enum": [ + "unmoving_counts" ], - "nullable": true + "type": "string" } }, "type": "object" @@ -2646,6 +2643,56 @@ "get_result&unique_visitor_counts.active_at_reference_location_counts.active_at_reference_location_counts.active_at_reference_location.active_at_reference_location.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unique_visitor_counts.active_at_reference_location_counts.active_at_reference_location_counts.active_at_reference_location.active_at_reference_location.unique_locations.unique_locations.aggregation_unit.lon-lat&unique_visitor_counts.unique_subscriber_counts.unique_subscriber_counts.aggregation_unit.admin2", "get_result&unique_visitor_counts.active_at_reference_location_counts.active_at_reference_location_counts.active_at_reference_location.active_at_reference_location.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unique_visitor_counts.active_at_reference_location_counts.active_at_reference_location_counts.active_at_reference_location.active_at_reference_location.unique_locations.unique_locations.aggregation_unit.lon-lat&unique_visitor_counts.unique_subscriber_counts.unique_subscriber_counts.aggregation_unit.admin3", "get_result&unique_visitor_counts.active_at_reference_location_counts.active_at_reference_location_counts.active_at_reference_location.active_at_reference_location.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unique_visitor_counts.active_at_reference_location_counts.active_at_reference_location_counts.active_at_reference_location.active_at_reference_location.unique_locations.unique_locations.aggregation_unit.lon-lat&unique_visitor_counts.unique_subscriber_counts.unique_subscriber_counts.aggregation_unit.lon-lat", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "get_result&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "get_result&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", "get_result&unmoving_counts.locations.unique_locations.aggregation_unit.admin0", "get_result&unmoving_counts.locations.unique_locations.aggregation_unit.admin1", "get_result&unmoving_counts.locations.unique_locations.aggregation_unit.admin2", @@ -3476,6 +3523,56 @@ "run&unique_visitor_counts.active_at_reference_location_counts.active_at_reference_location_counts.active_at_reference_location.active_at_reference_location.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unique_visitor_counts.active_at_reference_location_counts.active_at_reference_location_counts.active_at_reference_location.active_at_reference_location.unique_locations.unique_locations.aggregation_unit.lon-lat&unique_visitor_counts.unique_subscriber_counts.unique_subscriber_counts.aggregation_unit.admin2", "run&unique_visitor_counts.active_at_reference_location_counts.active_at_reference_location_counts.active_at_reference_location.active_at_reference_location.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unique_visitor_counts.active_at_reference_location_counts.active_at_reference_location_counts.active_at_reference_location.active_at_reference_location.unique_locations.unique_locations.aggregation_unit.lon-lat&unique_visitor_counts.unique_subscriber_counts.unique_subscriber_counts.aggregation_unit.admin3", "run&unique_visitor_counts.active_at_reference_location_counts.active_at_reference_location_counts.active_at_reference_location.active_at_reference_location.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unique_visitor_counts.active_at_reference_location_counts.active_at_reference_location_counts.active_at_reference_location.active_at_reference_location.unique_locations.unique_locations.aggregation_unit.lon-lat&unique_visitor_counts.unique_subscriber_counts.unique_subscriber_counts.aggregation_unit.lon-lat", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "run&unmoving_at_reference_location_counts.reference_locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin0&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin1&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin2&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.admin3&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin0", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin1", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin2", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.admin3", + "run&unmoving_at_reference_location_counts.reference_locations.modal_location.locations.daily_location.aggregation_unit.lon-lat&unmoving_at_reference_location_counts.locations.unique_locations.aggregation_unit.lon-lat", "run&unmoving_counts.locations.unique_locations.aggregation_unit.admin0", "run&unmoving_counts.locations.unique_locations.aggregation_unit.admin1", "run&unmoving_counts.locations.unique_locations.aggregation_unit.admin2", diff --git a/integration_tests/tests/flowmachine_server_tests/test_server.py b/integration_tests/tests/flowmachine_server_tests/test_server.py index 2cbdddbb40d..9d8db56b951 100644 --- a/integration_tests/tests/flowmachine_server_tests/test_server.py +++ b/integration_tests/tests/flowmachine_server_tests/test_server.py @@ -76,6 +76,7 @@ def test_get_available_queries(zmq_host, zmq_port): "unique_visitor_counts", "consecutive_trips", "unmoving_counts", + "unmoving_at_reference_location_counts", ] }, } diff --git a/integration_tests/tests/flowmachine_server_tests/test_server.test_api_spec_of_flowmachine_query_schemas.approved.txt b/integration_tests/tests/flowmachine_server_tests/test_server.test_api_spec_of_flowmachine_query_schemas.approved.txt index e71cfc8b884..721c8aa4bb2 100644 --- a/integration_tests/tests/flowmachine_server_tests/test_server.test_api_spec_of_flowmachine_query_schemas.approved.txt +++ b/integration_tests/tests/flowmachine_server_tests/test_server.test_api_spec_of_flowmachine_query_schemas.approved.txt @@ -154,14 +154,6 @@ ], "type": "string" }, - "sampling": { - "allOf": [ - { - "$ref": "#/components/schemas/RandomSample" - } - ], - "nullable": true - }, "start_date": { "format": "date", "type": "string" @@ -445,6 +437,7 @@ "total_network_objects": "#/components/schemas/TotalNetworkObjects", "unique_subscriber_counts": "#/components/schemas/UniqueSubscriberCounts", "unique_visitor_counts": "#/components/schemas/UniqueVisitorCounts", + "unmoving_at_reference_location_counts": "#/components/schemas/UnmovingAtReferenceLocationCounts", "unmoving_counts": "#/components/schemas/UnmovingCounts" }, "propertyName": "query_kind" @@ -504,6 +497,9 @@ { "$ref": "#/components/schemas/UniqueVisitorCounts" }, + { + "$ref": "#/components/schemas/UnmovingAtReferenceLocationCounts" + }, { "$ref": "#/components/schemas/UnmovingCounts" } @@ -1632,14 +1628,6 @@ ], "type": "string" }, - "sampling": { - "allOf": [ - { - "$ref": "#/components/schemas/RandomSample" - } - ], - "nullable": true - }, "start_date": { "format": "date", "type": "string" @@ -1866,24 +1854,33 @@ }, "type": "object" }, - "UnmovingCounts": { + "UnmovingAtReferenceLocationCounts": { "properties": { "locations": { "$ref": "#/components/schemas/UniqueLocations" }, "query_kind": { "enum": [ - "unmoving_counts" + "unmoving_at_reference_location_counts" ], "type": "string" }, - "sampling": { - "allOf": [ - { - "$ref": "#/components/schemas/RandomSample" - } + "reference_locations": { + "$ref": "#/components/schemas/ReferenceLocation" + } + }, + "type": "object" + }, + "UnmovingCounts": { + "properties": { + "locations": { + "$ref": "#/components/schemas/UniqueLocations" + }, + "query_kind": { + "enum": [ + "unmoving_counts" ], - "nullable": true + "type": "string" } }, "type": "object"