def getTemplateData(self, topics): if 'id' in topics[len(topics) - 1]: kind = topics[len(topics) - 1]['kind'] topicid = topics[len(topics) - 1]['id'] context_filter = ContextFilter(topicid, kind) personality = self._event_stream.get_projection( self._projection.id, context_filter) if len(personality) > 0: return {"persoonlijkheid": personality} return {}
def getTemplateData(self, topics): kind = topics[len(topics) - 1]['kind'] id = topics[len(topics) - 1]['_id'] print kind, id context_filter = ContextFilter(id, kind) # query all events with (kind, id) as context (in any role....) # events = self.eventStream.get_events(); events = reversed( self.eventStream.get_events(context_filters=[context_filter])) return {'details': self._details, 'events': events}
def getTemplateData(self, topics): if '_id' in topics[len(topics) - 1]: kind = topics[len(topics) - 1]['kind'] topicid = topics[len(topics) - 1]['_id'] context_filter = ContextFilter(topicid, kind) prediction = self._event_stream.get_projection( self._projection.id, context_filter) if len(prediction) > 0: return prediction return {}
def getTemplateData(self, topics): topic = topics[len(topics) - 1]['topic'] attrbitute_filter = AttributeFilter("team", topic) medewerkers = self._event_stream.get_contexts( attribute_filters=[attrbitute_filter]) joined_mdw = [] for medewerker in medewerkers: context_filter = ContextFilter(medewerker.context_id, 'user') personality = self._event_stream.get_projection( self._projection.id, context_filter) if len(personality) > 0: medewerker.attributes.update(personality) joined_mdw.append(medewerker) return {'medewerkers': joined_mdw}
def getTemplateData(self, topics): kind = topics[len(topics) - 1]['kind'] topicid = topics[len(topics) - 1]['_id'] data = [] for projection in self.projections: context_filter = ContextFilter(topicid, kind) data.append({ 'id': projection, 'value': self.event_stream.get_projection(projection, context_filter) }) sys.stderr.write(str({'projections': data}) + '\n') return {'projections': data}
def get_contexts_with_projections(self, context_types=[], attribute_filters=[], projections=[]): contexts = self._context_store.query(context_types, attribute_filters) for context in contexts: if 'projections' not in context: context['projections'] = {} for projection in projections: context_filter = ContextFilter(context.context_id, context.context_type) value = self.get_projection(projection, context_filter) context['projections'][projection] = value return contexts
def getTemplateData(self, topics): kind = topics[len(topics) - 1]['kind'] topicid = None if 'id' in topics[len(topics) - 1]: topicid = topics[len(topics) - 1]['_id'] if kind == 'user': context_filter = ContextFilter(topicid, kind) data = { 'sankey': self.event_stream.get_projection(self.projection, context_filter) } else: data = { 'sankey': self.event_stream.get_projection(self.projection) } return data
def renderResource(self, uri, topics=[]): kind = topics[len(topics) - 1]['kind'] topicid = None if '_id' in topics[len(topics) - 1]: topicid = topics[len(topics) - 1]['_id'] if kind == 'user': context_filter = ContextFilter(topicid, kind) json_data = json.dumps( self.event_stream.get_projection(self.projection, context_filter)) else: json_data = json.dumps( self.event_stream.get_projection(self.projection)) response = make_response(json_data) response.headers['Content-Type'] = 'application/json' response.headers[ 'Cache-Control'] = "no-cache, no-store, must-revalidate" response.headers["Pragma"] = "no-cache" response.headers["Expires"] = "0" return response
def getTemplateData(self, topics): objects = self._data.getAll() if self._projections is not None: for obj in objects: if 'projections' not in obj: obj['projections'] = {} for projection in self._projections: context_filter = ContextFilter(obj[self._keycolumn], self._icon) value = self._event_stream.get_projection( projection, context_filter) obj['projections'][projection] = value return { 'id': self._id, 'label': self._label, 'keycol': self._keycolumn, 'labelcol': self._labelcolumn, 'objects': objects, 'icon': self._icon }