How to use the flowmachine.flowmachine.core.server.query_schemas.custom_fields.SubscriberSubset function in flowmachine

To help you get started, we’ve selected a few flowmachine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Flowminder / FlowKit / flowmachine / flowmachine / core / server / query_schemas / event_count.py View on Github external
stop=self.stop,
            direction=self.direction,
            tables=self.event_types,
            subscriber_subset=self.subscriber_subset,
        )


class EventCountSchema(BaseQueryWithSamplingSchema):
    query_kind = fields.String(validate=OneOf(["event_count"]))
    start = ISODateTime(required=True)
    stop = ISODateTime(required=True)
    direction = fields.String(
        required=False, validate=OneOf(["in", "out", "both"]), default="both"
    )  # TODO: use a globally defined enum for this
    event_types = EventTypes()
    subscriber_subset = SubscriberSubset()

    __model__ = EventCountExposed
github Flowminder / FlowKit / flowmachine / flowmachine / core / server / query_schemas / subscriber_degree.py View on Github external
stop=self.stop,
            direction=self.direction,
            tables=self.event_types,
            subscriber_subset=self.subscriber_subset,
        )


class SubscriberDegreeSchema(BaseQueryWithSamplingSchema):
    query_kind = fields.String(validate=OneOf(["subscriber_degree"]))
    start = ISODateTime(required=True)
    stop = ISODateTime(required=True)
    direction = fields.String(
        required=False, validate=OneOf(["in", "out", "both"]), default="both"
    )  # TODO: use a globally defined enum for this
    event_types = EventTypes()
    subscriber_subset = SubscriberSubset()

    __model__ = SubscriberDegreeExposed
github Flowminder / FlowKit / flowmachine / flowmachine / core / server / query_schemas / topup_balance.py View on Github external
Query
        """
        return TopUpBalance(
            start=self.start_date,
            stop=self.end_date,
            statistic=self.statistic,
            subscriber_subset=self.subscriber_subset,
        )


class TopUpBalanceSchema(BaseQueryWithSamplingSchema):
    query_kind = fields.String(validate=OneOf(["topup_balance"]))
    start_date = ISODateTime(required=True)
    end_date = ISODateTime(required=True)
    statistic = Statistic()
    subscriber_subset = SubscriberSubset()

    __model__ = TopUpBalanceExposed
github Flowminder / FlowKit / flowmachine / flowmachine / core / server / query_schemas / pareto_interactions.py View on Github external
return ParetoInteractions(
            start=self.start,
            stop=self.stop,
            proportion=self.proportion,
            tables=self.event_types,
            subscriber_subset=self.subscriber_subset,
        )


class ParetoInteractionsSchema(BaseQueryWithSamplingSchema):
    query_kind = fields.String(validate=OneOf(["pareto_interactions"]))
    start = ISODateTime(required=True)
    stop = ISODateTime(required=True)
    proportion = fields.Float(required=True, validate=Range(min=0.0, max=1.0))
    event_types = EventTypes()
    subscriber_subset = SubscriberSubset()

    __model__ = ParetoInteractionsExposed
github Flowminder / FlowKit / flowmachine / flowmachine / core / server / query_schemas / displacement.py View on Github external
stop=self.stop,
            statistic=self.statistic,
            reference_location=self.reference_location._flowmachine_query_obj,
            table=self.event_types,
            subscriber_subset=self.subscriber_subset,
        )


class DisplacementSchema(BaseQueryWithSamplingSchema):
    query_kind = fields.String(validate=OneOf(["displacement"]))
    start = ISODateTime(required=True)
    stop = ISODateTime(required=True)
    statistic = Statistic()
    reference_location = fields.Nested(InputToDisplacementSchema, many=False)
    event_types = EventTypes()
    subscriber_subset = SubscriberSubset()

    __model__ = DisplacementExposed
github Flowminder / FlowKit / flowmachine / flowmachine / core / server / query_schemas / unique_locations.py View on Github external
self.start_date,
                self.end_date,
                spatial_unit=self.aggregation_unit,
                table=self.event_types,
                subscriber_subset=self.subscriber_subset,
            )
        )


class UniqueLocationsSchema(AggregationUnitMixin, BaseQueryWithSamplingSchema):
    # query_kind parameter is required here for claims validation
    query_kind = fields.String(validate=OneOf(["unique_locations"]))
    start_date = ISODateTime(required=True)
    end_date = ISODateTime(required=True)
    event_types = EventTypes()
    subscriber_subset = SubscriberSubset()

    __model__ = UniqueLocationsExposed
github Flowminder / FlowKit / flowmachine / flowmachine / core / server / query_schemas / unique_location_counts.py View on Github external
"""
        return UniqueLocationCounts(
            start=self.start_date,
            stop=self.end_date,
            spatial_unit=self.aggregation_unit,
            tables=self.event_types,
            subscriber_subset=self.subscriber_subset,
        )


class UniqueLocationCountsSchema(AggregationUnitMixin, BaseSchema):
    query_kind = fields.String(validate=OneOf(["unique_location_counts"]))
    start_date = ISODateTime(required=True)
    end_date = ISODateTime(required=True)
    event_types = EventTypes()
    subscriber_subset = SubscriberSubset()

    __model__ = UniqueLocationCountsExposed
github Flowminder / FlowKit / flowmachine / flowmachine / core / server / query_schemas / radius_of_gyration.py View on Github external
"""
        return RadiusOfGyration(
            start=self.start_date,
            stop=self.end_date,
            table=self.event_types,
            subscriber_subset=self.subscriber_subset,
        )


class RadiusOfGyrationSchema(BaseQueryWithSamplingSchema):
    # query_kind parameter is required here for claims validation
    query_kind = fields.String(validate=OneOf(["radius_of_gyration"]))
    start_date = ISODateTime(required=True)
    end_date = ISODateTime(required=True)
    event_types = EventTypes()
    subscriber_subset = SubscriberSubset()

    __model__ = RadiusOfGyrationExposed
github Flowminder / FlowKit / flowmachine / flowmachine / core / server / query_schemas / consecutive_trips_od_matrix.py View on Github external
self.end_date,
                    spatial_unit=self.aggregation_unit,
                    table=self.event_types,
                    subscriber_subset=self.subscriber_subset,
                )
            )
        )


class ConsecutiveTripsODMatrixSchema(AggregationUnitMixin, BaseSchema):
    # query_kind parameter is required here for claims validation
    query_kind = fields.String(validate=OneOf(["consecutive_trips_od_matrix"]))
    start_date = ISODateTime(required=True)
    end_date = ISODateTime(required=True)
    event_types = EventTypes()
    subscriber_subset = SubscriberSubset()

    __model__ = ConsecutiveTripsODMatrixExposed
github Flowminder / FlowKit / flowmachine / flowmachine / core / server / query_schemas / topup_amount.py View on Github external
Query
        """
        return TopUpAmount(
            start=self.start,
            stop=self.stop,
            statistic=self.statistic,
            subscriber_subset=self.subscriber_subset,
        )


class TopUpAmountSchema(BaseQueryWithSamplingSchema):
    query_kind = fields.String(validate=OneOf(["topup_amount"]))
    start = ISODateTime(required=True)
    stop = ISODateTime(required=True)
    statistic = Statistic()
    subscriber_subset = SubscriberSubset()

    __model__ = TopUpAmountExposed