From f9568a3d5a1cd52546b8bf051069bf9b6d212942 Mon Sep 17 00:00:00 2001 From: Maxime Sainte-Marie Date: Sun, 15 Dec 2019 01:17:45 +0100 Subject: [PATCH 1/3] try/catch equal contribution info --- allofplos/elements/article_elements.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/allofplos/elements/article_elements.py b/allofplos/elements/article_elements.py index d805f363..59f611d2 100644 --- a/allofplos/elements/article_elements.py +++ b/allofplos/elements/article_elements.py @@ -248,6 +248,12 @@ def get_contrib_info(contrib_element): except KeyError: # invalid contributor field; shouldn't count as contributor return None + + # get equal contribution status + try: + contrib_dict['equal_contrib'] = contrib_element.attrib['equal-contrib'] + except KeyError: + contrib_dict['equal_contrib'] = 'No' # get author type if contrib_dict.get('contrib_type') == 'author': From 0e169d747eccbde475187a6644afc6e342714491 Mon Sep 17 00:00:00 2001 From: Maxime Sainte-Marie Date: Sun, 15 Dec 2019 01:22:10 +0100 Subject: [PATCH 2/3] add key for equal contribution --- allofplos/article.py | 1 + 1 file changed, 1 insertion(+) diff --git a/allofplos/article.py b/allofplos/article.py index 590b2c3a..99e5c939 100644 --- a/allofplos/article.py +++ b/allofplos/article.py @@ -623,6 +623,7 @@ def get_contributors_info(self): 'ids', 'rid_dict', 'contrib_type', + 'equal_contrib', 'author_type', 'editor_type', 'email', From fe31460ef31847e208b5debb50a336f1ee696563 Mon Sep 17 00:00:00 2001 From: Maxime Sainte-Marie Date: Mon, 23 Dec 2019 09:40:36 -0500 Subject: [PATCH 3/3] remove try/catch for equal_contrib attribute --- allofplos/elements/article_elements.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/allofplos/elements/article_elements.py b/allofplos/elements/article_elements.py index 59f611d2..4b807a8a 100644 --- a/allofplos/elements/article_elements.py +++ b/allofplos/elements/article_elements.py @@ -250,10 +250,7 @@ def get_contrib_info(contrib_element): return None # get equal contribution status - try: - contrib_dict['equal_contrib'] = contrib_element.attrib['equal-contrib'] - except KeyError: - contrib_dict['equal_contrib'] = 'No' + contrib_dict['equal_contrib'] = contrib_element.attrib.get('equal-contrib', None) # get author type if contrib_dict.get('contrib_type') == 'author':