예제 #1
0
 def serialize(self, inspection: Inspection) -> EntityRow:
     row = {
         'inspection_id':
         inspection.inspectionId,
         'name':
         inspection.name,
         'indicator_id':
         inspection.indicatorId,
         'aggregate_arithmetics':
         inspection.aggregateArithmetics,
         'measure_on':
         inspection.measureOn,
         'measure_on_factor_id':
         inspection.measureOnFactorId,
         'measure_on_bucket_id':
         inspection.measureOnBucketId,
         'time_range_measure':
         inspection.timeRangeMeasure,
         'time_range_factor_id':
         inspection.timeRangeFactorId,
         'time_ranges':
         ArrayHelper(
             inspection.timeRanges).map(lambda x: x.to_dict()).to_list(),
         'measure_on_time':
         inspection.measureOnTime,
         'measure_on_time_factor_id':
         inspection.measureOnTimeFactorId
     }
     row = UserBasedTupleShaper.serialize(inspection, row)
     return row
 def serialize(self, favorite: Favorite) -> EntityRow:
     row = {
         'connected_space_ids': favorite.connectedSpaceIds,
         'dashboard_ids': favorite.dashboardIds
     }
     row = UserBasedTupleShaper.serialize(favorite, row)
     row = LastVisitShaper.serialize(favorite, row)
     return row
예제 #3
0
 def serialize(self, last_snapshot: LastSnapshot) -> EntityRow:
     row = {
         'language': last_snapshot.language,
         'last_dashboard_id': last_snapshot.lastDashboardId,
         'admin_dashboard_id': last_snapshot.adminDashboardId,
         'favorite_pin': last_snapshot.favoritePin
     }
     row = UserBasedTupleShaper.serialize(last_snapshot, row)
     row = LastVisitShaper.serialize(last_snapshot, row)
     return row
예제 #4
0
 def serialize(self, connected_space: ConnectedSpace) -> EntityRow:
     row = {
         'connect_id': connected_space.connectId,
         'space_id': connected_space.spaceId,
         'name': connected_space.name,
         'is_template': connected_space.isTemplate
     }
     row = AuditableShaper.serialize(connected_space, row)
     row = UserBasedTupleShaper.serialize(connected_space, row)
     row = LastVisitShaper.serialize(connected_space, row)
     return row
 def serialize(self, subject: Subject) -> EntityRow:
     row = {
         'subject_id': subject.subjectId,
         'name': subject.name,
         'connect_id': subject.connectId,
         'auto_refresh_interval': subject.autoRefreshInterval,
         'dataset': SubjectShaper.serialize_dataset(subject.dataset)
     }
     row = AuditableShaper.serialize(subject, row)
     row = UserBasedTupleShaper.serialize(subject, row)
     row = LastVisitShaper.serialize(subject, row)
     return row
예제 #6
0
	def serialize(self, achievement: Achievement) -> EntityRow:
		row = {
			'achievement_id': achievement.achievementId,
			'name': achievement.name,
			'description': achievement.description,
			'time_range_type': achievement.timeRangeType,
			'time_range_year': achievement.timeRangeYear,
			'time_range_month': achievement.timeRangeMonth,
			'compare_with_prev_time_range': achievement.compareWithPreviousTimeRange,
			'indicators': ArrayHelper(achievement.indicators).map(lambda x: x.to_dict()).to_list()
		}
		row = UserBasedTupleShaper.serialize(achievement, row)
		return row
 def serialize(self,
               connected_space_graphic: ConnectedSpaceGraphic) -> EntityRow:
     row = {
         'connect_id':
         connected_space_graphic.connectId,
         'topics':
         ArrayHelper(connected_space_graphic.topics).map(
             lambda x: self.serialize_to_dict(x)).to_list(),
         'subjects':
         ArrayHelper(connected_space_graphic.subjects).map(
             lambda x: self.serialize_to_dict(x)).to_list()
     }
     row = UserBasedTupleShaper.serialize(connected_space_graphic, row)
     return row
 def serialize(self, analysis: ObjectiveAnalysis) -> EntityRow:
     row = {
         'analysis_id':
         analysis.analysisId,
         'title':
         analysis.title,
         'description':
         analysis.description,
         'perspectives':
         ArrayHelper(
             analysis.perspectives).map(lambda x: x.to_dict()).to_list()
     }
     row = UserBasedTupleShaper.serialize(analysis, row)
     row = LastVisitShaper.serialize(analysis, row)
     return row
예제 #9
0
 def serialize(self, pipeline_graphic: PipelineGraphic) -> EntityRow:
     row = {
         'pipeline_graphic_id':
         pipeline_graphic.pipelineGraphId,
         'name':
         pipeline_graphic.name,
         'topics':
         ArrayHelper(pipeline_graphic.topics).map(
             lambda x: self.serialize_to_dict(x)).to_list(),
         'created_at':
         pipeline_graphic.createdAt,
         'last_modified_at':
         pipeline_graphic.lastModifiedAt
     }
     row = UserBasedTupleShaper.serialize(pipeline_graphic, row)
     return row
 def serialize(self, dashboard: Dashboard) -> EntityRow:
     row = {
         'dashboard_id':
         dashboard.dashboardId,
         'name':
         dashboard.name,
         'reports':
         ArrayHelper(dashboard.reports).map(
             lambda x: self.serialize_to_dict(x)).to_list(),
         'paragraphs':
         ArrayHelper(dashboard.paragraphs).map(
             lambda x: self.serialize_to_dict(x)).to_list(),
         'auto_refresh_interval':
         dashboard.autoRefreshInterval
     }
     row = AuditableShaper.serialize(dashboard, row)
     row = UserBasedTupleShaper.serialize(dashboard, row)
     row = LastVisitShaper.serialize(dashboard, row)
     return row
예제 #11
0
 def serialize(self, report: Report) -> EntityRow:
     row = {
         'report_id':
         report.reportId,
         'name':
         report.name,
         'subject_id':
         report.subjectId,
         'connect_id':
         report.connectId,
         'filters':
         self.serialize_to_dict(report.filters),
         'funnels':
         ArrayHelper(report.funnels).map(
             lambda x: self.serialize_to_dict(x)).to_list(),
         'indicators':
         ArrayHelper(report.indicators).map(
             lambda x: self.serialize_to_dict(x)).to_list(),
         'dimensions':
         ArrayHelper(report.dimensions).map(
             lambda x: self.serialize_to_dict(x)).to_list(),
         'description':
         report.description,
         'rect':
         self.serialize_to_dict(report.rect),
         'chart':
         self.serialize_to_dict(report.chart),
         'simulating':
         False if report.simulating is None else report.simulating,
         'simulate_data':
         report.simulateData,
         'simulate_thumbnail':
         report.simulateThumbnail
     }
     row = AuditableShaper.serialize(report, row)
     row = UserBasedTupleShaper.serialize(report, row)
     row = LastVisitShaper.serialize(report, row)
     return row