def prepare(self, data_set): data = super(DataSetIndex, self).prepare(data_set) investigation = data_set.get_investigation() nodes = [] # TODO: optimize this query if investigation is not None: studies = investigation.study_set.all() for study in studies: assays = study.assay_set.all() for assay in assays: node_types = get_node_types(study.uuid, assay.uuid, files_only=True, filter_set=Node.FILES) for node_type in node_types: nodes = nodes + list( AnnotatedNode.objects.filter( node_type=node_type, study=study, assay=assay ).values() ) #for node in nodes: # print node["node_name"] + " " + node["attribute_type"] + " " + node["attribute_value"] # perform the template processing to render the # text field with *all* of our node data visible for indexing t = loader.select_template(('search/indexes/core/dataset_text.txt', )) data['text'] = t.render(Context({'object': data_set, 'nodes': nodes})) return data
def annotate_nodes(investigation_uuid): """ Adds all nodes in this investigation to the annotated nodes table for faster lookup. """ investigation = Investigation.objects.get(uuid=investigation_uuid) studies = investigation.study_set.all() for study in studies: assays = study.assay_set.all() for assay in assays: node_types = get_node_types(study.uuid, assay.uuid, files_only=True, filter_set=Node.FILES) for node_type in node_types: update_annotated_nodes(node_type, study.uuid, assay.uuid, update=True) index_annotated_nodes(node_type, study.uuid, assay.uuid) # initialize attribute order for this assay attribute_count = initialize_attribute_order(study, assay) logger.info( "Initialized attribute order with %d attributes for study = %s and assay = %s" % (attribute_count, study, assay))
def annotate_nodes(investigation_uuid): """ Adds all nodes in this investigation to the annotated nodes table for faster lookup. """ investigation = Investigation.objects.get(uuid=investigation_uuid) studies = investigation.study_set.all() for study in studies: assays = study.assay_set.all() for assay in assays: node_types = get_node_types(study.uuid, assay.uuid, files_only=True, filter_set=Node.FILES) for node_type in node_types: update_annotated_nodes( node_type, study.uuid, assay.uuid, update=True ) index_annotated_nodes( node_type, study.uuid, assay.uuid ) # initialize attribute order for this assay attribute_count = initialize_attribute_order( study, assay ) logger.info( "Initialized attribute order with %d attributes for study = %s and assay = %s" % ( attribute_count, study, assay ) )
def prepare(self, data_set): data = super(DataSetIndex, self).prepare(data_set) investigation = data_set.get_investigation() nodes = [] # TODO: optimize this query if investigation is not None: studies = investigation.study_set.all() for study in studies: assays = study.assay_set.all() for assay in assays: node_types = get_node_types(study.uuid, assay.uuid, files_only=True, filter_set=Node.FILES) for node_type in node_types: nodes = nodes + list( AnnotatedNode.objects.filter(node_type=node_type, study=study, assay=assay).values()) #for node in nodes: # print node["node_name"] + " " + node["attribute_type"] + " " + node["attribute_value"] # perform the template processing to render the # text field with *all* of our node data visible for indexing t = loader.select_template( ('search/indexes/core/dataset_text.txt', )) data['text'] = t.render( Context({ 'object': data_set, 'nodes': nodes })) return data