def run(request): """ This executes the Annotate feature. """ if request.method == "POST": rform = RunForm(data = request.POST) if rform.is_valid(): dataset = rform.cleaned_data['dataset'] category = rform.cleaned_data['category'] limit = rform.cleaned_data['limit'] parser = getParser() (options, args) = parser.parse_args() options.dataset = dataset if(category == ''): options.category = 'all' else: options.category = category options.number=limit probableNegations = itemData('PROBABLE_NEGATED_EXISTENCE') definiteNegations = itemData('DEFINITE_NEGATED_EXISTENCE') pseudoNegations = itemData('PSEUDONEG') indications = itemData('INDICATION') historicals = itemData('HISTORICAL') conjugates = itemData('CONJ') probables = itemData('PROBABLE_EXISTENCE') definites = itemData('DEFINITE_EXISTENCE') future = itemData('FUTURE') critItems = itemData('CRIT_ITEMS') pec = criticalFinder(options) pec.processReports() return HttpResponseRedirect(reverse('pyConTextKit.views.complete')) else: print rform.errors else: rform=RunForm() return render_to_response('pyConTextKit/run.html', {'form': rform,},context_instance=RequestContext(request))
def __init__(self, options):#dbname, outfile, save_dir, table, idcolumn, txtcolumn, doGraphs): """create an instance of a criticalFinder object associated with the SQLite database. dbname: name of SQLite database """ t = time.localtime() self.doGraphs = options.doGraphs self.allow_uncertainty = options.allow_uncertainty self.proc_category = options.category self.reports = Report.objects.filter(dataset=options.dataset)[:options.number] #print "number of reports to process",len(self.reports) #raw_input('continue') # create context objects for each of the questions we want to be answering self.context = {"disease":pyConText.pyConText()} rsltsDB = options.odbname alerts=Alert.objects.all() alerts.delete() rslts=Result.objects.all() rslts.delete() # Create the itemData object to store the modifiers for the analysis # starts with definitions defined in pyConText and then adds # definitions specific for peFinder probableNegations = itemData('PROBABLE_NEGATED_EXISTENCE') definiteNegations = itemData('DEFINITE_NEGATED_EXISTENCE') pseudoNegations = itemData('PSEUDONEG') indications = itemData('INDICATION') historicals = itemData('HISTORICAL') conjugates = itemData('CONJ') probables = itemData('PROBABLE_EXISTENCE') definites = itemData('DEFINITE_EXISTENCE') future = itemData('FUTURE') critItems = itemData('CRIT_ITEMS') self.modifiers = {"disease":itemData('')} self.modifiers["disease"].prepend(pseudoNegations) self.modifiers["disease"].prepend(definiteNegations) self.modifiers["disease"].prepend(probableNegations) self.modifiers["disease"].prepend(probables) self.modifiers["disease"].prepend(definites) self.modifiers["disease"].prepend(indications) self.modifiers["disease"].prepend(conjugates) self.modifiers["disease"].prepend(future) self.modifiers["disease"].prepend(historicals) # Quality targets (generated from category parameter set by parser) if( options.category.lower() == 'all'): targetItems = critItems else: targetItems = itemData(options.category) self.targets = {"disease":targetItems} self.models = {}