def subjects_hierarchy_examples(request, source_id): """ Returns JSON data with examples of the subjects hierarchy """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: ps = ProcessSubjects(source_id) if ps.project_uuid is not False: cont_list = ps.get_contained_examples() json_output = json.dumps(cont_list, indent=4, ensure_ascii=False) return HttpResponse(json_output, content_type='application/json; charset=utf8') else: raise Http404
def subjects_hierarchy_examples(request, source_id): """ Returns JSON data with examples of the subjects hierarchy """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: ps = ProcessSubjects(source_id) if ps.project_uuid is not False: cont_list = ps.get_contained_examples() json_output = json.dumps(cont_list, indent=4, ensure_ascii=False) return HttpResponse(json_output, content_type='application/json; charset=utf8') else: raise Http404
def process_active_batch(self): """ Processes the current batch, determined by the row number by running the individual import processes in the proper order """ p_label = self.active_processes[self.act_process_num] p_outcome = LastUpdatedOrderedDict() p_outcome['label'] = p_label if p_label == 'subjects': p_act = ProcessSubjects(self.source_id) p_act.start_row = self.start_row p_act.batch_size = self.batch_size p_act.process_subjects_batch() p_outcome['count_active_fields'] = p_act.count_active_fields p_outcome['new_entities'] = p_act.new_entities p_outcome['reconciled_entities'] = p_act.reconciled_entities p_outcome[ 'not_reconciled_entities'] = p_act.not_reconciled_entities p_outcome['count_new_assertions'] = 0 elif p_label == 'media': p_act = ProcessMedia(self.source_id) p_act.start_row = self.start_row p_act.batch_size = self.batch_size p_act.process_media_batch() p_outcome['count_active_fields'] = p_act.count_active_fields p_outcome['new_entities'] = p_act.new_entities p_outcome['reconciled_entities'] = p_act.reconciled_entities p_outcome[ 'not_reconciled_entities'] = p_act.not_reconciled_entities p_outcome['count_new_assertions'] = 0 elif p_label == 'persons': p_act = ProcessPersons(self.source_id) p_act.start_row = self.start_row p_act.batch_size = self.batch_size p_act.process_persons_batch() p_outcome['count_active_fields'] = p_act.count_active_fields p_outcome['new_entities'] = p_act.new_entities p_outcome['reconciled_entities'] = p_act.reconciled_entities p_outcome[ 'not_reconciled_entities'] = p_act.not_reconciled_entities p_outcome['count_new_assertions'] = 0 elif p_label == 'links': p_act = ProcessLinks(self.source_id) p_act.start_row = self.start_row p_act.batch_size = self.batch_size p_act.process_link_batch() p_outcome['count_active_fields'] = p_act.count_active_fields p_outcome['new_entities'] = [] p_outcome['reconciled_entities'] = [] p_outcome['not_reconciled_entities'] = [] p_outcome['count_new_assertions'] = p_act.count_new_assertions elif p_label == 'descriptions': p_act = ProcessDescriptions(self.source_id) p_act.start_row = self.start_row p_act.batch_size = self.batch_size p_act.process_description_batch() p_outcome['count_active_fields'] = p_act.count_active_fields p_outcome['new_entities'] = [] p_outcome['reconciled_entities'] = [] p_outcome['not_reconciled_entities'] = [] p_outcome['count_new_assertions'] = p_act.count_new_assertions return p_outcome
def process_active_batch(self): """ Processes the current batch, determined by the row number by running the individual import processes in the proper order """ p_label = self.active_processes[self.act_process_num] p_outcome = LastUpdatedOrderedDict() p_outcome['label'] = p_label if p_label == 'subjects': p_act = ProcessSubjects(self.source_id) p_act.start_row = self.start_row p_act.batch_size = self.batch_size p_act.process_subjects_batch() p_outcome['count_active_fields'] = p_act.count_active_fields p_outcome['new_entities'] = p_act.new_entities p_outcome['reconciled_entities'] = p_act.reconciled_entities p_outcome['not_reconciled_entities'] = p_act.not_reconciled_entities p_outcome['count_new_assertions'] = 0 elif p_label == 'media': p_act = ProcessMedia(self.source_id) p_act.start_row = self.start_row p_act.batch_size = self.batch_size p_act.process_media_batch() p_outcome['count_active_fields'] = p_act.count_active_fields p_outcome['new_entities'] = p_act.new_entities p_outcome['reconciled_entities'] = p_act.reconciled_entities p_outcome['not_reconciled_entities'] = p_act.not_reconciled_entities p_outcome['count_new_assertions'] = 0 elif p_label == 'persons': p_act = ProcessPersons(self.source_id) p_act.start_row = self.start_row p_act.batch_size = self.batch_size p_act.process_persons_batch() p_outcome['count_active_fields'] = p_act.count_active_fields p_outcome['new_entities'] = p_act.new_entities p_outcome['reconciled_entities'] = p_act.reconciled_entities p_outcome['not_reconciled_entities'] = p_act.not_reconciled_entities p_outcome['count_new_assertions'] = 0 elif p_label == 'links': p_act = ProcessLinks(self.source_id) p_act.start_row = self.start_row p_act.batch_size = self.batch_size p_act.process_link_batch() p_outcome['count_active_fields'] = p_act.count_active_fields p_outcome['new_entities'] = [] p_outcome['reconciled_entities'] = [] p_outcome['not_reconciled_entities'] = [] p_outcome['count_new_assertions'] = p_act.count_new_assertions elif p_label == 'descriptions': p_act = ProcessDescriptions(self.source_id) p_act.start_row = self.start_row p_act.batch_size = self.batch_size p_act.process_description_batch() p_outcome['count_active_fields'] = p_act.count_active_fields p_outcome['new_entities'] = [] p_outcome['reconciled_entities'] = [] p_outcome['not_reconciled_entities'] = [] p_outcome['count_new_assertions'] = p_act.count_new_assertions return p_outcome