pybliometrics.sciencedirect.ArticleMetadata¶
ArticleMetadata() implements the ScienceDirect Article Metadata API.
The Article Metadata API allows users to search for documents using a Boolean syntax. It offers two views: ‘STANDARD’ and ‘COMPLETE’, with the ‘COMPLETE’ view providing more detailed data.
For a guide on how to query, check the ScienceDirect Article Metadata Guide.
Documentation¶
- class pybliometrics.sciencedirect.ArticleMetadata(query, refresh=False, view=None, verbose=False, download=True, integrity_fields=None, integrity_action='raise', subscriber=True, **kwds)[source]¶
Interaction with the ScienceDirect Article Metadata API.
- Parameters:
query (
str) – A string of the query as used in the Advanced Search.refresh (
bool|int, optional) – Whether to refresh the cached file if it exists or not. If int is passed, cached file will be refreshed if the number of days since last modification exceeds that value.Default:Falseview (
str|None, optional) – Which view to use for the query, see the documentation. Allowed values: STANDARD, COMPLETE. If None, defaults to COMPLETE if subscriber=True and to STANDARD if subscriber=False.Default:Noneverbose (
bool, optional) – Whether to print a download progress bar.Default:Falsedownload (
bool, optional) – Whether to download results (if they have not been cached).Default:Trueintegrity_fields (
list[str] |tuple[str,...] |None, optional) – A list or tuple with the names of fields whose completeness should be checked. ArticleMetadata will perform the action specified in integrity_action if elements in these fields are missing. This helps to avoid idiosynchratically missing elements that should always be present (e.g., EID or source ID).Default:Noneintegrity_action (
str, optional) – What to do in case integrity of provided fields cannot be verified. Possible actions: - “raise”: Raise an AttributeError - “warn”: Raise a UserWarningDefault:'raise'subscriber (
bool, optional) – Whether you access ScienceDirect with a subscription or not. For subscribers, ScienceDirect’s cursor navigation will be used. Sets the number of entries in each query iteration to the maximum number allowed by the corresponding view.Default:Trueunescape – Convert named and numeric characters in the results to their corresponding Unicode characters.
kwds (
str) – Keywords passed on as query parameters. Must contain fields and values mentioned in the API specification.- Raises:
ScopusQueryError – For non-subscribers, if the number of search results exceeds 5000.
ValueError – If any of the parameters integrity_action, refresh or view is not one of the allowed values.
Notes
The directory for cached results is {path}/{view}/{fname}, where path is specified in your configuration file and fname is the md5-hashed version of query.
- property results: list[Document] | None¶
A list of namedtuples in the form (authorKeywords authors available_online_date first_author abstract_text doi title eid link openArchiveArticle openaccess_status openaccessArticle openaccessUserLicense pii aggregationType copyright coverDate coverDisplayDate edition endingPage isbn publicationName startingPage teaser api_link publicationType vor_available_online_date).
Field definitions correspond to the Article Metadata Views and return the values as-is, except for authors which are joined on “;”.
- Raises:
ValueError – If the elements provided in integrity_fields do not match the actual field names (listed above).
Notes
The list of authors and the list of affiliations per author are deduplicated.
- get_cache_file_age()¶
Return the age of the cached file in days.
- Return type:
int
- get_cache_file_mdate()¶
Return the modification date of the cached file.
- Return type:
str
- get_key_remaining_quota()¶
Return number of remaining requests for the current key and the current API (relative on last actual request).
- Return type:
str | None
- get_key_reset_time()¶
Return time when current key is reset (relative on last actual request).
- Return type:
str | None
- get_results_size()¶
Return the number of results (works even if download=False).
- Return type:
int
Examples¶
To use the class provide a query. An invalid search query will result in an error.
>>> import pandas as pd >>> from pybliometrics.sciencedirect import ArticleMetadata, init >>> init() >>> am = ArticleMetadata('TITLE("Bayesian Network") AND YEAR(2015)')
The results property contains a list of the metadata of the documents found. The available fields and a description can be found in the Article Metadata Views.
>>> am.results [Document(authorKeywords='Flight control system ...', authors='Zhong, Lu;Haijun, Zeng', ...), Document(authorKeywords='Bayesian network infer...', authors='Kissinger, Jessica ...', ...), Document(authorKeywords='Bayesian networks | Pa...', authors='Druzdzel, Marek J.', ...), ...]
The field teaser from the first document can be accessed as follows:
>>> am_first_document = am.results[0] >>> am_first_document.teaser 'Traditional probabilistic safety analysis methods are not suitable for modern flight control system with multi-state probability. In this papera Bayesian Network based probabilistic safety model is...'
The results can be casted to a pandas DataFrame:
>>> df = pd.DataFrame(am.results) >>> # Print retrieved fields >>> df.columns Index(['authorKeywords', 'authors', 'available_online_date', 'first_author', 'abstract_text', 'doi', 'title', 'eid', 'link', 'openArchiveArticle', 'openaccess_status', 'openaccessArticle', 'openaccessUserLicense', 'pii', 'aggregationType', 'copyright', 'coverDate', 'coverDisplayDate', 'edition', 'endingPage', 'isbn', 'publicationName', 'startingPage', 'teaser', 'api_link', 'publicationType', 'vor_available_online_date'], dtype='object') >>> # Print shape of the dataframe (rows x columns) >>> df.shape (71, 27) >>> # Print first 5 rows >>> df.head()
authorKeywords authors available_online_date first_author abstract_text doi title eid link openArchiveArticle ... coverDisplayDate edition endingPage isbn publicationName startingPage teaser api_link publicationType vor_available_online_date 0 Flight control system | Bayesian network | Uni... Zhong, Lu;Haijun, Zeng 2015-02-14 Kang, Chen Traditional probabilistic safety analysis meth... 10.1016/j.proeng.2014.12.523 Research on Probabilistic Safety Analysis Appr... 1-s2.0-S1877705814036376 https://www.sciencedirect.com/science/article/... False ... 2015 None 184 None Procedia Engineering 180 Traditional probabilistic safety analysis meth... https://api.elsevier.com/content/article/pii/S... fla None 1 Bayesian network inference | Large-scale data ... Kissinger, Jessica C.;Moreno, Alberto;Galinski... 2015-06-17 Yin, Weiwei High-throughput, genome-scale data present a u... 10.1016/j.mbs.2015.06.006 From genome-scale data to models of infectious... 1-s2.0-S0025556415001248 https://www.sciencedirect.com/science/article/... False ... December 2015 None 168 None Mathematical Biosciences 156 •A generalized workflow for driving model deve... https://api.elsevier.com/content/article/pii/S... fla 2015-12-02 2 Bayesian networks | Parameter learning | EM al... Druzdzel, Marek J. 2015-03-18 Ratnapinda, Parot We compare three approaches to learning numeri... 10.1016/j.jal.2015.03.007 Learning discrete Bayesian network parameters ... 1-s2.0-S1570868315000464 https://www.sciencedirect.com/science/article/... True ... December 2015 None 642 None Journal of Applied Logic 628 We compare three approaches to learning numeri... https://api.elsevier.com/content/article/pii/S... fla 2015-11-14 3 None Xie, Ashleigh;Tsai, Yi-Chin;Black, Deborah;Di ... 2015-05-01 Phan, Kevin None 10.1016/j.hlc.2014.12.097 Ministernotomy or minithoracotomy for minimall... 1-s2.0-S1443950614009111 https://www.sciencedirect.com/science/article/... False ... 2015 None e47 None Heart, Lung and Circulation e46 None https://api.elsevier.com/content/article/pii/S... abs None 4 Bayesian Network | Structural Learning Algorit... HENRY, Sébastien;OUZROUT, Yacine 2015-08-31 DIALLO, Thierno M.L. This paper presents the CBNB (Causal Bayesian ... 10.1016/j.ifacol.2015.06.449 Bayesian Network Building for Diagnosis in Ind... 1-s2.0-S2405896315006886 https://www.sciencedirect.com/science/article/... False ... 2015 None 2416 None IFAC-PapersOnLine 2411 This paper presents the CBNB (Causal Bayesian ... https://api.elsevier.com/content/article/pii/S... fla 2015-08-31 5 rows × 27 columns