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 deserialize(self, row: EntityRow) -> Favorite: favorite = Favorite(connectedSpaceIds=row.get('connected_space_ids'), dashboardIds=row.get('dashboard_ids')) # noinspection PyTypeChecker favorite: Favorite = UserBasedTupleShaper.deserialize(row, favorite) # noinspection PyTypeChecker favorite: Favorite = LastVisitShaper.deserialize(row, favorite) return favorite
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
def deserialize(self, row: EntityRow) -> ConnectedSpaceGraphic: connected_space_graphic = ConnectedSpaceGraphic( connectId=row.get('connect_id'), topics=row.get('topics'), subjects=row.get('subjects')) # noinspection PyTypeChecker connected_space_graphic: ConnectedSpaceGraphic = UserBasedTupleShaper.deserialize( row, connected_space_graphic) return connected_space_graphic
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
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 deserialize(self, row: EntityRow) -> PipelineGraphic: pipeline_graphic = PipelineGraphic( pipelineGraphId=row.get('pipeline_graphic_id'), name=row.get('name'), topics=row.get('topics'), createdAt=row.get('created_at'), lastModifiedAt=row.get('last_modified_at')) # noinspection PyTypeChecker pipeline_graphic: PipelineGraphic = UserBasedTupleShaper.deserialize( row, pipeline_graphic) return pipeline_graphic
def deserialize(self, row: EntityRow) -> ObjectiveAnalysis: analysis = ObjectiveAnalysis(analysisId=row.get('analysis_id'), title=row.get('title'), description=row.get('description'), perspectives=row.get('perspectives')) # noinspection PyTypeChecker analysis: ObjectiveAnalysis = UserBasedTupleShaper.deserialize( row, analysis) # noinspection PyTypeChecker analysis: ObjectiveAnalysis = LastVisitShaper.deserialize( row, analysis) return analysis
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
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 deserialize(self, row: EntityRow) -> Subject: subject = Subject(subjectId=row.get('subject_id'), name=row.get('name'), connectId=row.get('connect_id'), autoRefreshInterval=row.get('auto_refresh_interval'), dataset=row.get('dataset')) # noinspection PyTypeChecker subject: Subject = AuditableShaper.deserialize(row, subject) # noinspection PyTypeChecker subject: Subject = UserBasedTupleShaper.deserialize(row, subject) # noinspection PyTypeChecker subject: Subject = LastVisitShaper.deserialize(row, subject) return subject
def deserialize(self, row: EntityRow) -> LastSnapshot: last_snapshot = LastSnapshot( language=row.get('language'), lastDashboardId=row.get('last_dashboard_id'), adminDashboardId=row.get('admin_dashboard_id'), favoritePin=row.get('favorite_pin')) # noinspection PyTypeChecker last_snapshot: LastSnapshot = UserBasedTupleShaper.deserialize( row, last_snapshot) # noinspection PyTypeChecker last_snapshot: LastSnapshot = LastVisitShaper.deserialize( row, last_snapshot) return last_snapshot
def deserialize(self, row: EntityRow) -> Dashboard: dashboard = Dashboard( dashboardId=row.get('dashboard_id'), name=row.get('name'), reports=row.get('reports'), paragraphs=row.get('paragraphs'), autoRefreshInterval=row.get('auto_refresh_interval')) # noinspection PyTypeChecker dashboard: Dashboard = AuditableShaper.deserialize(row, dashboard) # noinspection PyTypeChecker dashboard: Dashboard = UserBasedTupleShaper.deserialize(row, dashboard) # noinspection PyTypeChecker dashboard: Dashboard = LastVisitShaper.deserialize(row, dashboard) return dashboard
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 deserialize(self, row: EntityRow) -> Achievement: achievement = Achievement( achievementId=row.get('achievement_id'), name=row.get('name'), description=row.get('description'), timeRangeType=row.get('time_range_type'), timeRangeYear=row.get('time_range_year'), timeRangeMonth=row.get('time_range_month'), compareWithPreviousTimeRange=row.get('compare_with_prev_time_range'), indicators=row.get('indicators') ) # noinspection PyTypeChecker achievement: Achievement = UserBasedTupleShaper.deserialize(row, achievement) return achievement
def deserialize(self, row: EntityRow) -> ConnectedSpace: connected_space = ConnectedSpace(connectId=row.get('connect_id'), spaceId=row.get('space_id'), name=row.get('name'), isTemplate=row.get('is_template')) # noinspection PyTypeChecker connected_space: ConnectedSpace = AuditableShaper.deserialize( row, connected_space) # noinspection PyTypeChecker connected_space: ConnectedSpace = UserBasedTupleShaper.deserialize( row, connected_space) # noinspection PyTypeChecker connected_space: ConnectedSpace = LastVisitShaper.deserialize( row, connected_space) return connected_space
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
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 deserialize(self, row: EntityRow) -> Inspection: inspection = Inspection( inspectionId=row.get('inspection_id'), name=row.get('name'), indicatorId=row.get('indicator_id'), aggregateArithmetics=row.get('aggregate_arithmetics'), measureOn=row.get('measure_on'), measureOnFactorId=row.get('measure_on_factor_id'), measureOnBucketId=row.get('measure_on_bucket_id'), timeRangeMeasure=row.get('time_range_measure'), timeRangeFactorId=row.get('time_range_factor_id'), timeRanges=row.get('time_ranges'), measureOnTime=row.get('measure_on_time'), measureOnTimeFactorId=row.get('measure_on_time_factor_id')) # noinspection PyTypeChecker inspection: Inspection = UserBasedTupleShaper.deserialize( row, inspection) return inspection
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
def deserialize(self, row: EntityRow) -> Report: report = Report(reportId=row.get('report_id'), name=row.get('name'), subjectId=row.get('subject_id'), connectId=row.get('connect_id'), filters=row.get('filters'), funnels=row.get('funnels'), indicators=row.get('indicators'), dimensions=row.get('dimensions'), description=row.get('description'), rect=row.get('rect'), chart=row.get('chart'), simulating=row.get('simulating'), simulateData=row.get('simulate_data'), simulateThumbnail=row.get('simulate_thumbnail')) # noinspection PyTypeChecker report: Report = AuditableShaper.deserialize(row, report) # noinspection PyTypeChecker report: Report = UserBasedTupleShaper.deserialize(row, report) # noinspection PyTypeChecker report: Report = LastVisitShaper.deserialize(row, report) return report
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