def test_get_annotations(): time.sleep(0.5) pmid = '30971' tree = pubmed_client.get_full_xml(pmid) results = pubmed_client.get_metadata_from_xml_tree(tree, mesh_annotations=True) assert len(results) == 1, len(results) assert 'mesh_annotations' in results[pmid], results[pmid] me_ans = results[pmid]['mesh_annotations'] assert len(me_ans) == 9, len(me_ans) assert all(d['mesh'].startswith('D') for d in me_ans) assert any(d['major_topic'] for d in me_ans)
def test_get_annotations(): pmid = '30971' tree = pubmed_client.send_request( pubmed_client.pubmed_fetch, dict(db='pubmed', retmode='xml', id=pmid)) results = pubmed_client.get_metadata_from_xml_tree(tree, mesh_annotations=True) assert len(results) == 1, len(results) assert 'mesh_annotations' in results[pmid].keys(), results[pmid].keys() me_ans = results[pmid]['mesh_annotations'] assert len(me_ans) == 9, len(me_ans) assert all(d['mesh'].startswith('D') for d in me_ans) assert any(d['major_topic'] for d in me_ans)
def get_article_info(self, xml_file, q=None): tree = self.ftp.get_xml_file(xml_file) article_info = pubmed_client.get_metadata_from_xml_tree( tree, get_abstracts=True, prepend_title=False ) if q is not None: q.put((xml_file, article_info)) return else: return article_info
def test_get_annotations(): pmid = '30971' tree = pubmed_client.send_request(pubmed_client.pubmed_fetch, dict(db='pubmed', retmode='xml', id=pmid)) results = pubmed_client.get_metadata_from_xml_tree(tree, mesh_annotations=True) assert len(results) == 1, len(results) assert 'mesh_annotations' in results[pmid].keys(), results[pmid].keys() me_ans = results[pmid]['mesh_annotations'] assert len(me_ans) == 9, len(me_ans) assert all(d['mesh'].startswith('D') for d in me_ans) assert any(d['major_topic'] for d in me_ans)