Skip to content

Commit

Permalink
Merge pull request #100 from seasidesparrow/wiley_fix.20240329
Browse files Browse the repository at this point in the history
fixed eLocator bug
  • Loading branch information
seasidesparrow committed Apr 4, 2024
2 parents f2b8dad + e88a2b1 commit ca0a121
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions adsingestp/parsers/wiley.py
Expand Up @@ -53,17 +53,17 @@ def _parse_page(self):
elif n["type"] == "pageLast":
if n.get_text() not in ["n/a", "no"]:
self.base_metadata["page_last"] = n.get_text()
if not page_first:
for i in self.pubmeta_unit.find_all("id"):
if i["type"] == "society":
page_first = i.get_text()
if i["type"] == "eLocator":
# TODO check w/ curators - the last 5 is what the perl was doing, but should we keep the whole thing?
self.base_metadata["electronic_id"] = i.get_text()[-5:]

if page_first in ["n/a", "no"]:
page_first = None

for i in self.pubmeta_unit.find_all("id"):
if i["type"] == "eLocator":
self.base_metadata["electronic_id"] = i["value"]
elif i["type"] == "society":
if not page_first:
page_first = i["value"]

if page_first:
self.base_metadata["page_first"] = page_first

Expand Down
2 changes: 1 addition & 1 deletion tests/stubdata/output/wiley_jgra_57392.json
Expand Up @@ -2,7 +2,7 @@
"authors": [{"affiliation": [{"affPubID": "jgra57392-aff-0001", "affPubRaw": "Astronomy Department, University of Maryland, College Park, MD, USA"}, {"affPubID": "jgra57392-aff-0002", "affPubRaw": "NASA Goddard Space Flight Center, Greenbelt, MD, USA"}], "attrib": {"email": "swang90@umd.edu", "orcid": "0000-0002-6783-7759"}, "name": {"given_name": "Shan", "surname": "Wang"}}, {"affiliation": [{"affPubID": "jgra57392-aff-0001", "affPubRaw": "Astronomy Department, University of Maryland, College Park, MD, USA"}, {"affPubID": "jgra57392-aff-0002", "affPubRaw": "NASA Goddard Space Flight Center, Greenbelt, MD, USA"}], "attrib": {"orcid": "0000-0002-5431-174X"}, "name": {"given_name": "Naoki", "surname": "Bessho"}}, {"affiliation": [{"affPubID": "jgra57392-aff-0003", "affPubRaw": "Swedish Institute of Space Physics, Uppsala, Sweden"}], "attrib": {"orcid": "0000-0002-1046-746X"}, "name": {"given_name": "Daniel B.", "surname": "Graham"}}, {"affiliation": [{"affPubID": "jgra57392-aff-0004", "affPubRaw": "Laboratoire de Physique des Plasmas, CNRS/Sorbonne Université/Université Paris‐Saclay/Observatoire de Paris/ Ecole Polytechnique Institut Polytechnique de Paris, Paris, France"}], "attrib": {"orcid": "0000-0003-2713-7966"}, "name": {"given_name": "Olivier", "surname": "Le Contel"}}, {"affiliation": [{"affPubID": "jgra57392-aff-0005", "affPubRaw": "Department of Physics, University of Texas at Arlington, Arlington, TX, USA"}], "name": {"given_name": "Frederick D.", "surname": "Wilder"}}, {"affiliation": [{"affPubID": "jgra57392-aff-0003", "affPubRaw": "Swedish Institute of Space Physics, Uppsala, Sweden"}], "attrib": {"orcid": "0000-0001-5550-3113"}, "name": {"given_name": "Yuri V.", "surname": "Khotyaintsev"}}, {"affiliation": [{"affPubID": "jgra57392-aff-0006", "affPubRaw": "Earth, Oceans, and Space Science, Southwest Research Institute, Durham, NH, USA"}], "attrib": {"orcid": "0000-0001-6890-2973"}, "name": {"given_name": "Kevin J.", "surname": "Genestreti"}}, {"affiliation": [{"affPubID": "jgra57392-aff-0007", "affPubRaw": "Institut de Recherche en Astrophysique et Planétologie, Université de Toulouse, Toulouse, France"}, {"affPubID": "jgra57392-aff-0008", "affPubRaw": "Centre National de la Recherche Scientifique, Toulouse, France"}], "attrib": {"orcid": "0000-0001-6807-8494"}, "name": {"given_name": "Benoit", "surname": "Lavraud"}}, {"affiliation": [{"affPubID": "jgra57392-aff-0001", "affPubRaw": "Astronomy Department, University of Maryland, College Park, MD, USA"}, {"affPubID": "jgra57392-aff-0002", "affPubRaw": "NASA Goddard Space Flight Center, Greenbelt, MD, USA"}], "name": {"given_name": "Seung", "surname": "Choi"}}, {"affiliation": [{"affPubID": "jgra57392-aff-0009", "affPubRaw": "Southwest Research Institute San Antonio, San Antonio, TX, USA"}], "attrib": {"orcid": "0000-0003-0452-8403"}, "name": {"given_name": "James L.", "surname": "Burch"}}],
"copyright": {"statement": "©2022. The Authors.", "status": true},
"editorialHistory": {"acceptedDate": "2022-09-01", "receivedDates": ["2022-07-28"], "revisedDates": ["2022-08-26"]},
"pagination": {"pageCount": "21"},
"pagination": {"electronicID": "e2022JA030882", "firstPage": "2022JA030882", "pageCount": "21"},
"persistentIDs": [{"DOI": "10.1029/2022JA030882"}],
"pubDate": {"electrDate": "2022-09-21", "printDate": "2022-09-00"},
"publication": {"ISSN": [{"issnString": "2169-9380", "pubtype": "print"}, {"issnString": "2169-9402", "pubtype": "electronic"}], "issueNum": "9", "pubName": "Journal of Geophysical Research: Space Physics", "pubYear": "2022", "volumeNum": "127"},
Expand Down
2 changes: 1 addition & 1 deletion tests/stubdata/output/wiley_swe_21103.json
Expand Up @@ -2,7 +2,7 @@
"authors": [{"affiliation": [{"affPubID": "swe21103-aff-0001", "affPubRaw": "Space Research Institute, Austrian Academy of Sciences, Graz, Austria"}, {"affPubID": "swe21103-aff-0002", "affPubRaw": "Institute of Physics, University of Graz, Graz, Austria"}], "attrib": {"email": "juergen.hinterreiter@oeaw.ac.at", "orcid": "0000-0002-1222-8243"}, "name": {"given_name": "Jürgen", "surname": "Hinterreiter"}}, {"affiliation": [{"affPubID": "swe21103-aff-0001", "affPubRaw": "Space Research Institute, Austrian Academy of Sciences, Graz, Austria"}], "attrib": {"orcid": "0000-0001-9024-6706"}, "name": {"given_name": "Tanja", "surname": "Amerstorfer"}}, {"affiliation": [{"affPubID": "swe21103-aff-0001", "affPubRaw": "Space Research Institute, Austrian Academy of Sciences, Graz, Austria"}, {"affPubID": "swe21103-aff-0003", "affPubRaw": "Institute of Geodesy, Graz University of Technology, Graz, Austria"}], "attrib": {"orcid": "0000-0002-6362-5054"}, "name": {"given_name": "Martin A.", "surname": "Reiss"}}, {"affiliation": [{"affPubID": "swe21103-aff-0001", "affPubRaw": "Space Research Institute, Austrian Academy of Sciences, Graz, Austria"}, {"affPubID": "swe21103-aff-0003", "affPubRaw": "Institute of Geodesy, Graz University of Technology, Graz, Austria"}], "attrib": {"orcid": "0000-0001-6868-4152"}, "name": {"given_name": "Christian", "surname": "Möstl"}}, {"affiliation": [{"affPubID": "swe21103-aff-0002", "affPubRaw": "Institute of Physics, University of Graz, Graz, Austria"}], "attrib": {"orcid": "0000-0003-4867-7558"}, "name": {"given_name": "Manuela", "surname": "Temmer"}}, {"affiliation": [{"affPubID": "swe21103-aff-0001", "affPubRaw": "Space Research Institute, Austrian Academy of Sciences, Graz, Austria"}, {"affPubID": "swe21103-aff-0002", "affPubRaw": "Institute of Physics, University of Graz, Graz, Austria"}], "attrib": {"orcid": "0000-0002-2507-7616"}, "name": {"given_name": "Maike", "surname": "Bauer"}}, {"affiliation": [{"affPubID": "swe21103-aff-0001", "affPubRaw": "Space Research Institute, Austrian Academy of Sciences, Graz, Austria"}], "attrib": {"orcid": "0000-0003-1516-5441"}, "name": {"given_name": "Ute V.", "surname": "Amerstorfer"}}, {"affiliation": [{"affPubID": "swe21103-aff-0004", "affPubRaw": "Conrad Observatory, Zentralanstalt für Meteorologie und Geodynamik, Vienna, Austria"}], "attrib": {"orcid": "0000-0003-2021-6557"}, "name": {"given_name": "Rachel L.", "surname": "Bailey"}}, {"affiliation": [{"affPubID": "swe21103-aff-0001", "affPubRaw": "Space Research Institute, Austrian Academy of Sciences, Graz, Austria"}, {"affPubID": "swe21103-aff-0002", "affPubRaw": "Institute of Physics, University of Graz, Graz, Austria"}, {"affPubID": "swe21103-aff-0003", "affPubRaw": "Institute of Geodesy, Graz University of Technology, Graz, Austria"}], "attrib": {"orcid": "0000-0002-6273-4320"}, "name": {"given_name": "Andreas J.", "surname": "Weiss"}}, {"affiliation": [{"affPubID": "swe21103-aff-0005", "affPubRaw": "RAL Space, Rutherford Appleton Laboratory, Didcot, UK"}], "attrib": {"orcid": "0000-0001-9865-9281"}, "name": {"given_name": "Jackie A.", "surname": "Davies"}}, {"affiliation": [{"affPubID": "swe21103-aff-0006", "affPubRaw": "Department of Meteorology, University of Reading, Reading, UK"}], "attrib": {"orcid": "0000-0001-9876-4612"}, "name": {"given_name": "Luke A.", "surname": "Barnard"}}, {"affiliation": [{"affPubID": "swe21103-aff-0006", "affPubRaw": "Department of Meteorology, University of Reading, Reading, UK"}], "attrib": {"orcid": "0000-0003-2061-2453"}, "name": {"given_name": "Mathew J.", "surname": "Owens"}}],
"copyright": {"statement": "© 2021. The Authors.", "status": true},
"editorialHistory": {"acceptedDate": "2021-01-29", "receivedDates": ["2020-10-30"], "revisedDates": ["2020-12-23"]},
"pagination": {"pageCount": "18"},
"pagination": {"electronicID": "e2020SW002674", "firstPage": "2020SW002674", "pageCount": "18"},
"persistentIDs": [{"DOI": "10.1029/2020SW002674"}],
"pubDate": {"electrDate": "2021-03-26", "printDate": "2021-03-00"},
"publication": {"ISSN": [{"issnString": "1542-7390", "pubtype": "print"}, {"issnString": "1542-7390", "pubtype": "electronic"}], "issueNum": "3", "pubName": "Space Weather", "pubYear": "2021", "volumeNum": "19"},
Expand Down
2 changes: 1 addition & 1 deletion tests/stubdata/output/wiley_swe_461.json
@@ -1 +1 @@
{"abstract": {"textEnglish": "Geomagnetically induced currents (GICs) from solar storms pose a risk to the operation of power transmission grids in Europe and across the globe. The European Risk from Geomagnetically Induced Currents (EURISGIC) project, which began in March 2011 and is supported by the Seventh Framework Programme of the European Union, seeks to mitigate this natural hazard by developing European capabilities for GIC forecasting and warning. Recent well‐recognized GIC events were the province‐wide blackout in Quebec, Canada, in March 1989 and the blackout in the city of Malmö, in southern Sweden, during the Halloween storm of October 2003. The progressive integration of interconnected and geographically wide power transmission grids is obviously increasing the GIC risk. Hence, there is a need for greater scientific understanding of phenomena in the solar‐terrestrial environment that lead to GICs and for the development of systems that facilitate GIC modeling, forecasting, and mitigation."}, "authors": [{"affiliation": [{"affPubID": "swe461-aff-0001", "affPubRaw": "Senior scientist at the Finnish Meteorological Institute, in Helsinki, Finland. E‐mail: ari.viljanen@fmi.fi"}], "name": {"given_name": "Ari", "surname": "Viljanen"}}], "copyright": {"statement": "Copyright 2011 by the American Geophysical Union.", "status": true}, "pagination": {"pageCount": "2"}, "persistentIDs": [{"DOI": "10.1029/2011SW000680"}], "pubDate": {"electrDate": "2011-07-28", "printDate": "2011-07-00"}, "publication": {"ISSN": [{"issnString": "1542-7390", "pubtype": "print"}, {"issnString": "1542-7390", "pubtype": "electronic"}], "issueNum": "7", "pubName": "Space Weather", "pubYear": "2011", "volumeNum": "9"}, "publisherIDs": [{"Identifier": "2011SW000680", "attribute": "editorialOffice"}, {"Identifier": "SWE461", "attribute": "unit"}], "recordData": {"createdTime": "", "loadFormat": "OtherXML", "loadLocation": "", "loadType": "fromFile", "parsedTime": "", "recordOrigin": ""}, "title": {"textEnglish": "European Project to Improve Models of Geomagnetically Induced Currents"}}
{"abstract": {"textEnglish": "Geomagnetically induced currents (GICs) from solar storms pose a risk to the operation of power transmission grids in Europe and across the globe. The European Risk from Geomagnetically Induced Currents (EURISGIC) project, which began in March 2011 and is supported by the Seventh Framework Programme of the European Union, seeks to mitigate this natural hazard by developing European capabilities for GIC forecasting and warning. Recent well‐recognized GIC events were the province‐wide blackout in Quebec, Canada, in March 1989 and the blackout in the city of Malmö, in southern Sweden, during the Halloween storm of October 2003. The progressive integration of interconnected and geographically wide power transmission grids is obviously increasing the GIC risk. Hence, there is a need for greater scientific understanding of phenomena in the solar‐terrestrial environment that lead to GICs and for the development of systems that facilitate GIC modeling, forecasting, and mitigation."}, "authors": [{"affiliation": [{"affPubID": "swe461-aff-0001", "affPubRaw": "Senior scientist at the Finnish Meteorological Institute, in Helsinki, Finland. E‐mail: ari.viljanen@fmi.fi"}], "name": {"given_name": "Ari", "surname": "Viljanen"}}], "copyright": {"statement": "Copyright 2011 by the American Geophysical Union.", "status": true}, "pagination": {"firstPage": "S07007", "pageCount": "2"}, "persistentIDs": [{"DOI": "10.1029/2011SW000680"}], "pubDate": {"electrDate": "2011-07-28", "printDate": "2011-07-00"}, "publication": {"ISSN": [{"issnString": "1542-7390", "pubtype": "print"}, {"issnString": "1542-7390", "pubtype": "electronic"}], "issueNum": "7", "pubName": "Space Weather", "pubYear": "2011", "volumeNum": "9"}, "publisherIDs": [{"Identifier": "2011SW000680", "attribute": "editorialOffice"}, {"Identifier": "SWE461", "attribute": "unit"}], "recordData": {"createdTime": "", "loadFormat": "OtherXML", "loadLocation": "", "loadType": "fromFile", "parsedTime": "", "recordOrigin": ""}, "title": {"textEnglish": "European Project to Improve Models of Geomagnetically Induced Currents"}}
2 changes: 1 addition & 1 deletion tests/stubdata/output/wiley_swe_539.json
@@ -1 +1 @@
{"abstract": {"textEnglish": "Delores Knipp's textbook Understanding Space Weather and the Physics Behind It provides a comprehensive resource for space physicists teaching in a variety of academic departments to introduce space weather to advanced undergraduates. The book benefits from Knipp's extensive experience teaching introductory and advanced undergraduate physics courses at the U.S. Air Force Academy. The fundamental physics concepts are clearly explained and are connected directly to the space physics concepts being discussed. To expand upon the relevant basic physics, current research areas and new observations are highlighted, with many of the chapters including contributions from a number of leading space physicists."}, "authors": [{"affiliation": [{"affPubID": "swe539-aff-0001", "affPubRaw": "University of Michigan USA"}], "name": {"given_name": "Mark", "surname": "Moldwin"}}], "copyright": {"statement": "©2012. American Geophysical Union. All Rights Reserved.", "status": true}, "pagination": {"pageCount": "2"}, "persistentIDs": [{"DOI": "10.1029/2012SW000823"}], "pubDate": {"electrDate": "2012-08-03", "printDate": "2012-08-00"}, "publication": {"ISSN": [{"issnString": "1542-7390", "pubtype": "print"}, {"issnString": "1542-7390", "pubtype": "electronic"}], "issueNum": "8", "pubName": "Space Weather", "pubYear": "2012", "volumeNum": "10"}, "publisherIDs": [{"Identifier": "2012SW000823", "attribute": "editorialOffice"}, {"Identifier": "SWE539", "attribute": "unit"}], "recordData": {"createdTime": "", "loadFormat": "OtherXML", "loadLocation": "", "loadType": "fromFile", "parsedTime": "", "recordOrigin": ""}, "title": {"textEnglish": "Book Review: Dolores Knipp's Understanding Space Weather and the Physics Behind It"}}
{"abstract": {"textEnglish": "Delores Knipp's textbook Understanding Space Weather and the Physics Behind It provides a comprehensive resource for space physicists teaching in a variety of academic departments to introduce space weather to advanced undergraduates. The book benefits from Knipp's extensive experience teaching introductory and advanced undergraduate physics courses at the U.S. Air Force Academy. The fundamental physics concepts are clearly explained and are connected directly to the space physics concepts being discussed. To expand upon the relevant basic physics, current research areas and new observations are highlighted, with many of the chapters including contributions from a number of leading space physicists."}, "authors": [{"affiliation": [{"affPubID": "swe539-aff-0001", "affPubRaw": "University of Michigan USA"}], "name": {"given_name": "Mark", "surname": "Moldwin"}}], "copyright": {"statement": "©2012. American Geophysical Union. All Rights Reserved.", "status": true}, "pagination": {"firstPage": "S08004", "pageCount": "2"}, "persistentIDs": [{"DOI": "10.1029/2012SW000823"}], "pubDate": {"electrDate": "2012-08-03", "printDate": "2012-08-00"}, "publication": {"ISSN": [{"issnString": "1542-7390", "pubtype": "print"}, {"issnString": "1542-7390", "pubtype": "electronic"}], "issueNum": "8", "pubName": "Space Weather", "pubYear": "2012", "volumeNum": "10"}, "publisherIDs": [{"Identifier": "2012SW000823", "attribute": "editorialOffice"}, {"Identifier": "SWE539", "attribute": "unit"}], "recordData": {"createdTime": "", "loadFormat": "OtherXML", "loadLocation": "", "loadType": "fromFile", "parsedTime": "", "recordOrigin": ""}, "title": {"textEnglish": "Book Review: Dolores Knipp's Understanding Space Weather and the Physics Behind It"}}
2 changes: 1 addition & 1 deletion tests/test_wiley.py
Expand Up @@ -27,7 +27,7 @@ def setUp(self):
self.inputdir = os.path.join(stubdata_dir, "input")
self.outputdir = os.path.join(stubdata_dir, "output")

def test_elsevier(self):
def test_wiley(self):
filenames = [
"wiley_jgra_12057",
"wiley_jgra_57392",
Expand Down

0 comments on commit ca0a121

Please sign in to comment.