Ejemplo n.º 1
0
 def test_report_searcher (self):
     try:
         searcher = RecordSearcher(self.context)
         records = searcher.search('connecticut')
     except Exception, e:
         self.fail('Error searching: %s' % e)
Ejemplo n.º 2
0
from canary.stats import *
from canary.study import Study


if __name__ == "__main__":
    cmdline = CommandLine()
    cmdline.parse_args()
    context = cmdline.context()

    collector = StatCollector(context)
    collector.add_handlers(
        CuratorHandler(),
        ArticleTypeHandler(),
        ExposureHandler(),
        OutcomeHandler(),
        RiskFactorHandler(),
        SpeciesHandler(),
        LocationHandler(),
        MethodologyTypeHandler(),
    )

    searcher = RecordSearcher(context)
    records = searcher.search("record-status:%i" % QueuedRecord.STATUS_CURATED)

    today = datetime.now()
    one_weeks_records = [rec for rec in records if today - Study(context, rec.study_id).date_modified <= timedelta(7)]
    collector.process(one_weeks_records)

    for handler in collector.handlers:
        print handler.__class__, handler.stats
Ejemplo n.º 3
0
 def setUp (self):
     # each test gets a new collector
     self.collector = StatCollector(self.context)
     # get some records for statistics generation once
     searcher = RecordSearcher(self.context)
     self.records = searcher.search('environment')
Ejemplo n.º 4
0
 def setUp(self):
     # each test gets a new collector
     self.collector = StatCollector(self.context)
     # get some records for statistics generation once
     searcher = RecordSearcher(self.context)
     self.records = searcher.search("environment")
Ejemplo n.º 5
0
 def test_report_searcher(self):
     try:
         searcher = RecordSearcher(self.context)
         records = searcher.search('connecticut')
     except Exception, e:
         self.fail('Error searching: %s' % e)
Ejemplo n.º 6
0
if __name__ == '__main__':
    cmdline = CommandLine()
    cmdline.parse_args()
    context = cmdline.context()

    collector = StatCollector(context)
    collector.add_handlers(
        CuratorHandler(),
        ArticleTypeHandler(),
        ExposureHandler(),
        OutcomeHandler(),
        RiskFactorHandler(),
        SpeciesHandler(),
        LocationHandler(),
        MethodologyTypeHandler(),
    )

    searcher = RecordSearcher(context)
    records = searcher.search('record-status:%i' % QueuedRecord.STATUS_CURATED)

    today = datetime.now()
    one_weeks_records = [
        rec for rec in records
        if today - Study(context, rec.study_id).date_modified <= timedelta(7)
    ]
    collector.process(one_weeks_records)

    for handler in collector.handlers:
        print handler.__class__, handler.stats