def test_store(self): warn("\n") pmid=18297132 pubmed=Pubmed(pmid) self.assertIsInstance(pubmed, Pubmed) self.assertEqual(pubmed.pubmed_id, pmid) pubmed.remove() pubmed.store() self.assertTrue(os.access(pubmed.path(), os.R_OK)) cursor=Pubmed.mongo().find({'pubmed_id':pmid}) self.assertEqual(cursor.count(), len(Pubmed.text_tags)) tag2count={'MeshHeading':22, 'AbstractText':247, 'ArticleTitle':15} for record in cursor: tag=record['tag'] self.assertEqual(len(record['words']), tag2count[tag])
def main(options): warn("getting pmid list..." % ()) idlist=get_pmidlist(options) warn("processing %d ids: %s" % (len(idlist), idlist)) if options.dry_run: exit(0) fuse=options.fuse for pmid in idlist: pubmed=Pubmed(pmid) warn("pmid is %s" % (pmid)) continue try: pubmed.store() # does the fetching automatically except Exception as e: warn("%d: caught %s" % (pmid, e)) fuse-=1 if (fuse==0): break exit(0)
def main(options): warn("getting pmid list..." % ()) idlist = get_pmidlist(options) warn("processing %d ids: %s" % (len(idlist), idlist)) if options.dry_run: exit(0) fuse = options.fuse for pmid in idlist: pubmed = Pubmed(pmid) warn("pmid is %s" % (pmid)) continue try: pubmed.store() # does the fetching automatically except Exception as e: warn("%d: caught %s" % (pmid, e)) fuse -= 1 if (fuse == 0): break exit(0)
def test_store(self): warn("\n") pmid = 18297132 pubmed = Pubmed(pmid) self.assertIsInstance(pubmed, Pubmed) self.assertEqual(pubmed.pubmed_id, pmid) pubmed.remove() pubmed.store() self.assertTrue(os.access(pubmed.path(), os.R_OK)) cursor = Pubmed.mongo().find({'pubmed_id': pmid}) self.assertEqual(cursor.count(), len(Pubmed.text_tags)) tag2count = { 'MeshHeading': 22, 'AbstractText': 247, 'ArticleTitle': 15 } for record in cursor: tag = record['tag'] self.assertEqual(len(record['words']), tag2count[tag])