Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion packtools/sps/formats/pubmed.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,18 @@ def xml_pubmed_publisher_name_pipe(xml_pubmed, xml_tree):


def get_journal_title(xml_tree):
journal_title = journal_meta.Title(xml_tree)
"""
JournalTitle deve ser a abreviação do periódico registrada no PubMed
(journal-id[@journal-id-type="nlm-ta"]), presente apenas quando o
periódico é indexado no PubMed. Cai para a abreviação genérica da
SciELO quando nlm-ta está ausente, já que JournalTitle é obrigatório
na DTD do PubMed.
"""
nlm_ta = journal_meta.JournalID(xml_tree).nlm_ta
if nlm_ta:
return nlm_ta

journal_title = journal_meta.Title(xml_tree)
return journal_title.abbreviated_journal_title


Expand Down
35 changes: 35 additions & 0 deletions tests/sps/formats/test_pubmed.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,41 @@ def test_xml_pubmed_journal_title_pipe_without_title(self):

self.assertEqual(obtained, expected)

def test_xml_pubmed_journal_title_pipe_uses_nlm_ta_over_abbrev(self):
expected = (
'<Article>'
'<Journal>'
'<JournalTitle>Rev Saude Publica</JournalTitle>'
'</Journal>'
'</Article>'
)
xml_pubmed = ET.fromstring(
'<Article>'
'<Journal/>'
'</Article>'
)
xml_tree = ET.fromstring(
'<article xmlns:mml="http://www.w3.org/1998/Math/MathML" '
'xmlns:xlink="http://www.w3.org/1999/xlink" '
'article-type="research-article" dtd-version="1.1" specific-use="sps-1.9" xml:lang="en">'
'<front>'
'<journal-meta>'
'<journal-id journal-id-type="nlm-ta">Rev Saude Publica</journal-id>'
'<journal-title-group>'
'<journal-title>Revista de Saúde Pública</journal-title>'
'<abbrev-journal-title abbrev-type="publisher">Rev. saúde pública</abbrev-journal-title>'
'</journal-title-group>'
'</journal-meta>'
'</front>'
'</article>'
)

xml_pubmed_journal_title_pipe(xml_pubmed, xml_tree)

obtained = ET.tostring(xml_pubmed, encoding="utf-8").decode("utf-8")

self.assertEqual(obtained, expected)

def test_xml_pubmed_issn_pipe(self):
expected = (
'<Article>'
Expand Down