pybliometrics-dev / pybliometrics

Python-based API-Wrapper to access Scopus
https://pybliometrics.readthedocs.io/en/stable/
Other
407 stars 127 forks source link

Calling AuthorRetrieval with refresh=True fails to update method calls #260

Closed astrochun closed 2 years ago

astrochun commented 2 years ago

pybliometrics version: 3.3.0

This problem occurs when attempting to update the Author record based on an AuthorRetrieval with refresh=True. The use of the .get_documents() does not trigger a new ScopusSearch. Thus, records can be outdated.

Code to reproduce the bug:

ar = AuthorRetrieval('9-s2.0-36621004800', view='ENHANCED', refresh=true)
ar.document_count  # 219
len(ar.get_documents()) #218

The difference is due to one new paper that appeared after the first caching. Currently, the API requires providing refresh=True, which is not so obvious - took me a while to realize that the document search query did not update accordingly.

Expected behavior: If certain arguments are set at the class level, they should be reflected in method calls to ensure that everything is in sync.

Michael-E-Rose commented 2 years ago

This is not a bug, this is at most unclear documentation. The documentation for AuthorRetrieval().get_documents() states:

Parameters args (str) – Parameters to be passed on to ScopusSearch().

kwds (str) – Parameters to be passed on to ScopusSearch().

Why is that not obvious?

astrochun commented 2 years ago

Hi @Michael-E-Rose, thanks for the response. The reason why it wasn't obvious is because I had thought refresh from the AuthorRetrieval was an instance variable, such that if I say refresh=3, any get methods would have those settings by default.

I suppose this is more of a feature than a bug for the default settings in the get methods to be consistent with input arguments when the object was created.

Michael-E-Rose commented 2 years ago

What about we add a note Note: The class' `refresh` parameter is not used here.?

astrochun commented 2 years ago

What about we add a note Note: The class' `refresh` parameter is not used here.?

That would suffice.