Beispiel #1
0
    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 = {}