Skip to content

Commit

Permalink
Add function to get publication types per PubmedArticle
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaris committed Dec 14, 2023
1 parent 10a7f68 commit 0440f23
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion indra/literature/pubmed_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,4 +934,21 @@ def get_all_ids(search_term):
# If there are more than 10k IDs, the CLI outputs a . for each
# iteration, these have to be filtered out
pmids = [e for e in elements if '.' not in e]
return pmids
return pmids


def get_publication_types(article: ET.Element):
"""Return the set of PublicationType for the article
Parameters
----------
article :
The XML element for the article. Typically, this is a PubmedArticle
node.
Returns
-------
: set[str]
A set of publication type
"""
return {pt.text for pt in article.find('.//PublicationTypeList')}

0 comments on commit 0440f23

Please sign in to comment.