Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract all affiliations for each author #162

Merged
merged 1 commit into from
Oct 29, 2024
Merged
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
13 changes: 8 additions & 5 deletions pubmed_parser/medline_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,14 @@ def parse_author_affiliation(medline):
else:
identifier = ""
if author.find("AffiliationInfo/Affiliation") is not None:
affiliation = author.find("AffiliationInfo/Affiliation").text or ""
affiliation = affiliation.replace(
"For a full list of the authors' affiliations please see the Acknowledgements section.",
"",
)
affiliation = list(chain(*([c.text] for c in author.findall("AffiliationInfo/Affiliation")))) or []
affiliation = [
c.replace(
"For a full list of the authors' affiliations please see the Acknowledgements section.",
"",
) for c in affiliation
]
affiliation = "|".join(affiliation)
else:
affiliation = ""
authors.append(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_medline_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_affiliations():
"""This is a test for the affiliations field."""
affiliations_36400559 = 'Department of Neurological Surgery, The Ohio State Wexner Medical Center, 410 West 10th Street, Columbus, OH 43210, USA; The Ohio State University College of Medicine, 370 West 9th street, Columbus, OH 43210, USA.;Department of Neurological Surgery, The Ohio State Wexner Medical Center, 410 West 10th Street, Columbus, OH 43210, USA.;Department of Neurological Surgery, Baylor College of Medicine, 1 Baylor Plaza, Houston, TX 77030, USA.;Department of Neurological Surgery, The Ohio State Wexner Medical Center, 410 West 10th Street, Columbus, OH 43210, USA; Department of Neurological Surgery, Baylor College of Medicine, 1 Baylor Plaza, Houston, TX 77030, USA. Electronic address: [email protected].'
assert article_36400559['affiliations'] == affiliations_36400559
affiliations_28786991 = 'Phillip R. Lee Institute for Health Policy Studies, University of California, San Francisco, San Francisco, California, United States of America.;Phillip R. Lee Institute for Health Policy Studies, University of California, San Francisco, San Francisco, California, United States of America.;Phillip R. Lee Institute for Health Policy Studies, University of California, San Francisco, San Francisco, California, United States of America.;Phillip R. Lee Institute for Health Policy Studies, University of California, San Francisco, San Francisco, California, United States of America.;Centers for Disease Control and Prevention, Division of Tuberculosis Elimination, Atlanta, Georgia, United States of America.;Phillip R. Lee Institute for Health Policy Studies, University of California, San Francisco, San Francisco, California, United States of America.'
affiliations_28786991 = 'Phillip R. Lee Institute for Health Policy Studies, University of California, San Francisco, San Francisco, California, United States of America.|Global Health Sciences, University of California, San Francisco, San Francisco, California, United States of America.|The Consortium for the Assessment of Prevention Economics (CAPE), University of California, San Francisco, San Francisco, California, United States of America.;Phillip R. Lee Institute for Health Policy Studies, University of California, San Francisco, San Francisco, California, United States of America.|The Consortium for the Assessment of Prevention Economics (CAPE), University of California, San Francisco, San Francisco, California, United States of America.;Phillip R. Lee Institute for Health Policy Studies, University of California, San Francisco, San Francisco, California, United States of America.|The Consortium for the Assessment of Prevention Economics (CAPE), University of California, San Francisco, San Francisco, California, United States of America.;Phillip R. Lee Institute for Health Policy Studies, University of California, San Francisco, San Francisco, California, United States of America.|Global Health Sciences, University of California, San Francisco, San Francisco, California, United States of America.|The Consortium for the Assessment of Prevention Economics (CAPE), University of California, San Francisco, San Francisco, California, United States of America.;Centers for Disease Control and Prevention, Division of Tuberculosis Elimination, Atlanta, Georgia, United States of America.;Phillip R. Lee Institute for Health Policy Studies, University of California, San Francisco, San Francisco, California, United States of America.|Global Health Sciences, University of California, San Francisco, San Francisco, California, United States of America.|The Consortium for the Assessment of Prevention Economics (CAPE), University of California, San Francisco, San Francisco, California, United States of America.'
assert article_28786991['affiliations'] == affiliations_28786991


Expand Down
Loading