def serialize(self, indicator: Indicator) -> EntityRow:
     return TupleShaper.serialize_tenant_based(
         indicator, {
             'indicator_id':
             indicator.indicatorId,
             'name':
             indicator.name,
             'topic_or_subject_id':
             indicator.topicOrSubjectId,
             'factor_id':
             indicator.factorId,
             'base_on':
             indicator.baseOn,
             'category_1':
             indicator.category1,
             'category_2':
             indicator.category2,
             'category_3':
             indicator.category3,
             'value_buckets':
             indicator.valueBuckets,
             'relevants':
             ArrayHelper(
                 indicator.relevants).map(lambda x: x.to_dict()).to_list(),
             'group_ids':
             indicator.groupIds,
             'filter':
             IndicatorShaper.serialize_filter(indicator.filter),
             'description':
             indicator.description,
         })
Esempio n. 2
0
 def serialize(self, an_enum: Enum) -> EntityRow:
     return TupleShaper.serialize_tenant_based(
         an_enum, {
             'enum_id': an_enum.enumId,
             'name': an_enum.name,
             'description': an_enum.description,
             'parent_enum_id': an_enum.parentEnumId
         })
Esempio n. 3
0
 def serialize(self, external_writer: ExternalWriter) -> EntityRow:
     return TupleShaper.serialize_tenant_based(
         external_writer, {
             'writer_id': external_writer.writerId,
             'writer_code': external_writer.writerCode,
             'type': external_writer.type,
             'pat': external_writer.pat,
             'url': external_writer.url
         })
Esempio n. 4
0
 def serialize(self, space: Space) -> EntityRow:
     return TupleShaper.serialize_tenant_based(
         space, {
             'space_id': space.spaceId,
             'name': space.name,
             'description': space.description,
             'topic_ids': space.topicIds,
             'group_ids': space.groupIds,
             'filters': SpaceShaper.serialize_filters(space.filters),
         })
 def serialize(self, user_group: UserGroup) -> EntityRow:
     return TupleShaper.serialize_tenant_based(
         user_group, {
             'user_group_id': user_group.userGroupId,
             'name': user_group.name,
             'description': user_group.description,
             'user_ids': user_group.userIds,
             'space_ids': user_group.spaceIds,
             'indicator_ids': user_group.indicatorIds
         })
	def serialize(self, catalog: Catalog) -> EntityRow:
		return TupleShaper.serialize_tenant_based(catalog, {
			'catalog_id': catalog.catalogId,
			'name': catalog.name,
			'topic_ids': catalog.topicIds,
			'tech_owner_id': catalog.techOwnerId,
			'biz_owner_id': catalog.bizOwnerId,
			'tags': catalog.tags,
			'description': catalog.description
		})
Esempio n. 7
0
	def serialize(self, user: User) -> EntityRow:
		return TupleShaper.serialize_tenant_based(user, {
			'user_id': user.userId,
			'name': user.name,
			'nickname': user.nickName,
			'password': user.password,
			'is_active': user.isActive,
			'group_ids': user.groupIds,
			'role': user.role,
		})
Esempio n. 8
0
	def serialize(self, pipeline: Pipeline) -> EntityRow:
		return TupleShaper.serialize_tenant_based(pipeline, {
			'pipeline_id': pipeline.pipelineId,
			'topic_id': pipeline.topicId,
			'name': pipeline.name,
			'type': pipeline.type,
			'prerequisite_enabled': pipeline.conditional,
			'prerequisite_on': PipelineShaper.serialize_prerequisite_on(pipeline.on),
			'stages': PipelineShaper.serialize_stages(pipeline.stages),
			'enabled': pipeline.enabled,
			'validated': pipeline.validated
		})
 def serialize(self, data_source: DataSource) -> EntityRow:
     return TupleShaper.serialize_tenant_based(
         data_source, {
             'data_source_id': data_source.dataSourceId,
             'data_source_code': data_source.dataSourceCode,
             'data_source_type': data_source.dataSourceType,
             'host': data_source.host,
             'port': data_source.port,
             'username': data_source.username,
             'password': data_source.password,
             'name': data_source.name,
             'url': data_source.url,
             'params': DataSourceShaper.serialize_params(data_source.params)
         })
Esempio n. 10
0
 def serialize(self, topic: Topic) -> EntityRow:
     return TupleShaper.serialize_tenant_based(
         topic, {
             'topic_id':
             topic.topicId,
             'name':
             topic.name,
             'description':
             topic.description,
             'type':
             topic.type,
             'kind':
             topic.kind,
             'data_source_id':
             topic.dataSourceId,
             'factors':
             ArrayHelper(topic.factors).map(lambda x: x.dict()).to_list(),
         })
 def serialize(self, monitor_rule: MonitorRule) -> EntityRow:
     return TupleShaper.serialize_tenant_based(
         monitor_rule, {
             'rule_id':
             monitor_rule.ruleId,
             'code':
             monitor_rule.code,
             'grade':
             monitor_rule.grade,
             'severity':
             monitor_rule.severity,
             'topic_id':
             monitor_rule.topicId,
             'factor_id':
             monitor_rule.factorId,
             'params':
             monitor_rule.params.to_dict()
             if monitor_rule.params is not None else None,
             'enabled':
             monitor_rule.enabled
         })
Esempio n. 12
0
 def serialize(self, bucket: Bucket) -> EntityRow:
     return TupleShaper.serialize_tenant_based(
         bucket, {
             'bucket_id':
             bucket.bucketId,
             'name':
             bucket.name,
             'type':
             bucket.type,
             'include':
             self.try_get_include(bucket),
             'measure':
             self.try_get_measure(bucket),
             'enum_id':
             self.try_get_enum_id(bucket),
             'segments':
             ArrayHelper(
                 bucket.segments).map(lambda x: x.to_dict()).to_list(),
             'description':
             bucket.description,
         })