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

ScienceDirect: SubjectClassifications API #356

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nils-herrmann
Copy link
Collaborator

This API works exactly the same as the one of Scopus. To avoid code redundancy and increase maintainability this class simply inherits the one from Scopus

@Michael-E-Rose
Copy link
Contributor

But it does return different data, does it?

@nils-herrmann
Copy link
Collaborator Author

nils-herrmann commented Oct 16, 2024

@Michael-E-Rose:

But it does return different data, does it?

Yes it returns different data (with the same structure). Here is an example:

scopus_sc = SubjectClassifications({'description': 'Chemistry'}, refresh=True)
scdir_sc = ScDirSubjectClassifications({'description': 'Chemistry'}, refresh=True)

Scopus

[Subject(code='1300', description='Biochemistry, Genetics and Molecular Biology', detail='Biochemistry, Genetics and Molecular Biology (all)', abbrev='BIOC'),
Subject(code='1301', description='Biochemistry, Genetics and Molecular Biology', detail='Biochemistry, Genetics and Molecular Biology (miscellaneous)', abbrev='BIOC'), ...}

ScienceDirect Results

[Subject(code='18', description='Biochemistry, Genetics and Molecular Biology', detail='Biochemistry, Genetics and Molecular Biology', abbrev='biochemgenmolbiol'),
Subject(code='399', description='Biochemistry', detail='Biochemistry, Genetics and Molecular Biology::Biochemistry', abbrev='biochem'), ...]

Comment on lines +93 to +94
self._api = 'SubjectClassifications' if 'scopus' in self.__module__ else 'ScienceDirectSubjectClassifications'
Search.__init__(self, query=query, api=self._api, **kwds)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the api is passed as a parameter, it is not needed as underscore property. If it is needed elsewhere, it can stay underscore property but need not be passed as parameter.

So, is it used somewhere else? If not, let's just make pass a simple parameter.

the md5-hashed version of `query` dict turned into string in format
of `'key=value'` delimited by `'&'`.
"""
SubjectClassifications.__init__(self, query=query, refresh=refresh, fields=fields, **kwds)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add newline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants