Giter Site home page Giter Site logo

Comments (6)

Michael-E-Rose avatar Michael-E-Rose commented on May 29, 2024 1

Alright, now I finally get the error as well:

>>> from pybliometrics.scopus import CitationOverview
>>> 
>>> identifier = ["10.1016/j.suc.2023.06.004"]
>>> co = CitationOverview(identifier, start="2023", id_type="doi")
>>> co.cc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/panther/.local/lib/python3.10/site-packages/pybliometrics/scopus/abstract_citation.py", line 44, in cc
    cites = [int(d['$']) for d in doc['cc']]
  File "/home/panther/.local/lib/python3.10/site-packages/pybliometrics/scopus/abstract_citation.py", line 44, in <listcomp>
    cites = [int(d['$']) for d in doc['cc']]
TypeError: string indices must be integers

Give me a little time to think about your proposed solution.

from pybliometrics.

Michael-E-Rose avatar Michael-E-Rose commented on May 29, 2024

I really wonder how you get that result. The CitationOverview() class needs the Scopus IDs (not even EIDs work). So try this please:

identifier = ["84861986826"]
co = CitationOverview(identifier, start=2012)
print(co.cc)
# [[(2012, 2), (2013, 11), (2014, 15), (2015, 15), (2016, 25), (2017, 41), (2018, 56), (2019, 53), (2020, 46), (2021, 63), # (2022, 56), (2023, 51)]]

If you only have DOIs, use the AbstractRetrieval() first. Will also deliver the publication year, for the start parameter.

Interestingly, when I use your DOI, I get a pybliometrics.scopus.exception.Scopus404Error: The resource specified cannot be found.

from pybliometrics.

kosh-jp avatar kosh-jp commented on May 29, 2024

Thanks for your reply!!

Behavior of CitationOverview class.

First, we can use DOIs on Scopus CitationOverview API.

And, I think I can use DOIs params on pybliometrics code.
Because, you implement that id_type parameter on the code.
I can select doi by id_type param.
https://github.com/pybliometrics-dev/pybliometrics/blob/master/pybliometrics/scopus/abstract_citation.py#L192-L212

    def __init__(
        ...
        id_type: str = "scopus_id",
        ....
    ) -> None:
        """Interaction witht the Citation Overview API.
        ...
        :param id_type: The type of the IDs provided in `identifier`.  Must be
                        one of "scopus_id", "doi", "pii", "pubmed_id".
        ...

https://github.com/pybliometrics-dev/pybliometrics/blob/master/pybliometrics/scopus/abstract_citation.py#L271-L276

        # Get file content
        ...
        kwds.update({id_type: identifier})
        ...
        Retrieval.__init__(
            self, stem, api="CitationOverview", date=date, citation=citation, **kwds
        )

Scopus404Error

Interestingly, when I use your DOI, I get a pybliometrics.scopus.exception.Scopus404Error: The resource specified cannot be found.

Thanks for checking it out.
I guess that new articles in less well-known journals may experience periods of unregistration...

Code change request

If my code change request is not accepted, no problem, don't worry about it.
In that case, I will include the code to handle this specific error in my code.

Your wonderful library has helped me a lot and I am very grateful!!

regards.
Thank you.

from pybliometrics.

Michael-E-Rose avatar Michael-E-Rose commented on May 29, 2024

Hi again! I'm always happy for code changes by the pybliometics community, but I still fail to see the very problem your proposal wants to solve.

With

from pybliometrics.scopus import CitationOverview

identifier = ["10.1016/j.suc.2023.06.004"]
co = CitationOverview(identifier, start="2023")

I get the pybliometrics.scopus.exception.Scopus404Error: The resource specified cannot be found. I already mentioned above. So I don't see how handling a TypeError, in addition to an AttributeError in CitationOverview().cc deals with this.

And sorry for the confusion with the DOIs, you're of course right that CitationOverview() accepts DOIs.

from pybliometrics.

kosh-jp avatar kosh-jp commented on May 29, 2024

Thanks for discuss!

I misunderstood your Scopus404Error comment, sorry.

When I use doi as dentifier, I specify doi as id_type.

from pybliometrics.scopus import CitationOverview

identifier = ["10.1016/j.suc.2023.06.004"]
co = CitationOverview(identifier, start="2023", id_type="doi")

from pybliometrics.

kosh-jp avatar kosh-jp commented on May 29, 2024

Thank you very much for code change!

from pybliometrics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.