litstudy icon indicating copy to clipboard operation
litstudy copied to clipboard

KeyError: cd:initials

Open Viet1004 opened this issue 1 year ago • 5 comments

Hello,

I'm having trouble after refining via scopus.

I got error KeyError: ce:initials

Here is the code to recreate the error:

docs_scopus, docs_notfound = litstudy.refine_scopus(docs) litstudy.plot_affiliation_histogram(docs_scopus, limit=15) I cannot share the csv here but they are any file from ieee and scopus. Could you help me with this? Thank you very much. If you need any further information, please let me know

Viet1004 avatar Oct 02 '24 23:10 Viet1004

Got the same issue running litstudy 1.0.6. on a Scopus dataset. Here is the relevant part of the Traceback:

File ~/Documents/Notebooks/.venv/lib/python3.12/site-packages/pybliometrics/scopus/abstract_retrieval.py:92, in AbstractRetrieval.authorgroup(self)
     80 # Author information
     81 for author in authors:
     82     new = auth(affiliation_id=aff_id,
     83                 organization=org,
     84                 city=aff.get('city'),
     85                 dptid=dep_id,
     86                 postalcode=aff.get('postal-code'),
     87                 addresspart=aff.get('address-part'),
     88                 country=aff.get('country'),
     89                 auid=make_int_if_possible(author.get('@auid')),
     90                 orcid=author.get('@orcid'),
     91                 surname=author.get('ce:surname'),
---> 92                 given_name=author.get('ce:given-name', author['ce:initials']),
     93                 indexed_name=chained_get(author, ['preferred-name', 'ce:indexed-name']))
     94     out.append(new)
     95 # Collaboration information

KeyError: 'ce:initials'

fzzinchemical avatar Oct 10 '24 10:10 fzzinchemical

Hello,

I'm having trouble after refining via scopus.

I got error KeyError: ce:initials

Here is the code to recreate the error:

docs_scopus, docs_notfound = litstudy.refine_scopus(docs) litstudy.plot_affiliation_histogram(docs_scopus, limit=15) I cannot share the csv here but they are any file from ieee and scopus. Could you help me with this? Thank you very much. If you need any further information, please let me know

Rereading the Stacktrace, it seems to be a pybliometrics issue. I'll investigate there.

fzzinchemical avatar Oct 10 '24 10:10 fzzinchemical

Hello,

I'm having trouble after refining via scopus.

I got error KeyError: ce:initials

Here is the code to recreate the error:

docs_scopus, docs_notfound = litstudy.refine_scopus(docs) litstudy.plot_affiliation_histogram(docs_scopus, limit=15) I cannot share the csv here but they are any file from ieee and scopus. Could you help me with this? Thank you very much. If you need any further information, please let me know

Alright, quick update and temporary fix: Downgrade the pybibliometrics to version 4.0.0 . It worked in my case, so fingers crossed it works for you as well. I looked to many hours at the code to see if anything did not make any sense, and found nothing.

Alright, the thing you should try is the following: pip install pybliometrics==4.0.0

fzzinchemical avatar Oct 10 '24 14:10 fzzinchemical

Thank you very much for looking into this! It is a difficult issue to debug, since it seems to be an issue which the Scopus API.

Great that you were able to find a temporary fix!

Do you have version numbers for which pybibliometrics does and does not work? Might also be worth it to report the issue on their repository, since it looks to be a mismatch between how the data is provded by Scopus and how it is parsed by pybibliometrics

stijnh avatar Oct 11 '24 08:10 stijnh

Thank you very much for looking into this! It is a difficult issue to debug, since it seems to be an issue which the Scopus API.

Great that you were able to find a temporary fix!

Do you have version numbers for which pybibliometrics does and does not work? Might also be worth it to report the issue on their repository, since it looks to be a mismatch between how the data is provded by Scopus and how it is parsed by pybibliometrics

Tried out a couple of things regarding the versions on a smaller batch. The results are the following:

  • could not replicate the bug on smaller batches of studies, version-independent (yeah all pybliometrics versions were tested)
  • made a simple testbench to try out a couple of versions.

Test

Version Functional?
4.0 NO
3.6 NO
3.5.2 NO
3.5.1 YES
3.5.0 YES
3.4.0 YES
3.3.0 YES
3.2.0 YES
3.1.0 NO

Now I wonder why it worked on 4.0.0... so I thinK I'll leave it there for now. Hope this helps. Also the test results were kind of inconsistent, meaning nothing can really be trusted here.

fzzinchemical avatar Oct 11 '24 15:10 fzzinchemical