class AnalysisParams(PaginatedMixin, SortableMixin, Model): class Options: serialize_when_none = False id = StringType(required=True) date = ModelType(DateTimeRange) initiated = ModelType(DateTimeRange) completed = ModelType(DateTimeRange) within = StringListType(StringModelType(Area), separator="+") significance = FloatType(min_value=0, max_value=100) place = ModelType(Place)
class Event(Model): class Options: serialize_when_none = True id = StringType() title = StringType() description = StringType() start = DateTimeType() end = DateTimeType() timezone = StringType() duration = IntType() category = StringType() labels = ListType(StringType()) country = StringType() rank = IntType() # `local_rank`, `aviation_rank`, and `phq_attendance` are paid features. # They will only show up in your response body if you # have subscribed to them. local_rank = IntType() aviation_rank = IntType() phq_attendance = IntType() entities = ListType(ModelType(Entities)) location = GeoJSONPointType() place_hierarchies = ListType(ListType(StringType())) scope = StringType() relevance = FloatType() state = StringType() first_seen = DateTimeType() updated = DateTimeType() deleted_reason = StringType() duplicate_of_id = StringType()
class Event(Model): class Options: serialize_when_none = True id = StringType() title = StringType() description = StringType() start = DateTimeType() end = DateTimeType() timezone = StringType() duration = IntType() category = StringType() labels = ListType(StringType()) country = StringType() rank = IntType() local_rank = IntType() entities = ListType(ModelType(Entities)) location = GeoJSONPointType() place_hierarchies = ListType(ListType(StringType())) scope = StringType() relevance = FloatType() state = StringType() first_seen = DateTimeType() updated = DateTimeType() deleted_reason = StringType() duplicate_of_id = StringType()
class Account(Model): id = StringType() name = StringType() description = StringType() industry = ModelType(Industry) created_at = DateTimeType() updated_at = DateTimeType()
class CalendarDay(Model): date = DateType() count = IntType() top_rank = FloatType() rank_levels = DictType(IntType) categories = DictType(IntType) labels = DictType(IntType) top_events = ModelType(EventResultSet)
class Signal(Model): class Options: serialize_when_none = True roles = { "create": whitelist("name", "country", "dimensions"), "update": blacklist("created_at", "updated_at") } id = StringType() name = StringType(required=True) country = StringType(max_length=2, min_length=2, required=True) dimensions = ListType(ModelType(Dimension), default=[]) created_at = DateTimeType() updated_at = DateTimeType() def add_dimension(self, dimension_name, dimension_type): self.dimensions.append( Dimension({ "name": dimension_name, "type": dimension_type })) def remove_dimension(self, dimension_name): self.dimensions = [ dimension for dimension in self.dimensions if dimension.name != dimension_name ] def save(self, endpoint=None): if endpoint is not None: self._endpoint = endpoint if self.id: return self._endpoint.update(self) else: return self._endpoint.create(self) def delete(self): self._endpoint.delete(id=self.id) def sink(self, data_points, chunk_size=1000): return self._endpoint.sink(id=self.id, data_points=data_points, chunk_size=chunk_size) def summary(self): return self._endpoint.dimensions(id=self.id) def analysis(self, **params): return self._endpoint.analysis(id=self.id, **params)
class ImpactParams(SearchParams): top_events = ModelType(TopEventsSearchParams) impact_rank = StringType(choices=('rank', 'aviation_rank'))
class CalendarParams(SearchParams): top_events = ModelType(TopEventsSearchParams)
class SearchParams(PaginatedMixin, SortableMixin, Model): class Options: serialize_when_none = False id = ListType(StringType) q = StringType() label = ListType(StringType) category = ListType(StringType) start = ModelType(DateTimeRange) start_around = ModelType(DateAround) end = ModelType(DateTimeRange) end_around = ModelType(DateAround) active = ModelType(DateTimeRange) updated = ModelType(DateTimeRange) state = StringType(choices=('active', 'deleted')) deleted_reason = StringType(choices=('cancelled', 'duplicate', 'invalid', 'postponed')) rank = ModelType(IntRange) rank_level = ListType(IntType(min_value=1, max_value=5)) # `local_rank`, `aviation_rank`, and `phq_attendance` are paid features. # If you haven't subscribed to a paid feature, using it as a # search param will have no effect on your search results. local_rank = ModelType(IntRange) local_rank_level = ListType(IntType(min_value=1, max_value=5)) aviation_rank = ModelType(IntRange) aviation_rank_level = ListType(IntType(min_value=1, max_value=5)) phq_attendance = ModelType(IntRange) country = ListType(StringType) location_around = ModelType(LocationAround) within = StringListType(StringModelType(Area), separator="+") place = ModelType(Place) relevance = ListType(StringType) brand_unsafe = ModelType(BrandUnsafe) entity = ModelType(Entity)
class SearchParams(PaginatedMixin, SortableMixin, Model): class Options: serialize_when_none = False id = ListType(StringType) q = StringType() label = ListType(StringType) category = ListType(StringType) start = ModelType(DateTimeRange) start_around = ModelType(DateAround) end = ModelType(DateTimeRange) end_around = ModelType(DateAround) active = ModelType(DateTimeRange) updated = ModelType(DateTimeRange) state = StringType(choices=('active', 'deleted')) local_rank_level = ListType(IntType(min_value=1, max_value=5)) local_rank = ModelType(IntRange) rank_level = ListType(IntType(min_value=1, max_value=5)) rank = ModelType(IntRange) country = ListType(StringType) location_around = ModelType(LocationAround) within = StringListType(StringModelType(Area), separator="+") place = ModelType(Place) signal = ModelType(Signal) relevance = ListType(StringType)
class CalendarParams(SearchParams): top_events = ModelType(TopEventsSearchParams) view = StringType(choices=('active', 'start'))
class DailyAnalysis(Model): date = DateType() demand = ModelType(CountAnalysisComponent) lead = ModelType(MeanAnalysisComponent) span = ModelType(MeanAnalysisComponent)
class Dimensions(Model): date = ModelType(DateDimension) initiated = ModelType(DateDimension) completed = ModelType(DateDimension) location = ModelType(GeoDimension)
class CategoryDimension(Model): type = StringType() options = ListType(ModelType(CategoryDimensionComponent))
class SignalDataPoints(Model): id = StringType(required=True) data_points = ListType(ModelType(DataPoint), required=True) chunk_size = IntType(default=1000, max_value=5000, required=True)