Fetching more than 25 artilces now work.
This commit is contained in:
parent
5cf9c1759a
commit
84cf0d5fd6
README.mdconfig.json
data
https%3A%2F%2Fapi.elsevier.com%2Fcontent%2Fabstract%2Fscopus_id%2F84872135457.jsonhttps%3A%2F%2Fapi.elsevier.com%2Fcontent%2Farticle%2Fdoi%2F10.1016%2FS1525-1578%2810%2960571-5.jsonhttps%3A%2F%2Fapi.elsevier.com%2Fcontent%2Farticle%2Fpii%2FS1674927814000082.json
elsa.pylogs
slr_helper.py
77
README.md
77
README.md
@ -0,0 +1,77 @@
|
||||
# SLR Helper
|
||||
A command-line IEEExplore and Scopus query, fetch and analysis tool.
|
||||
|
||||
**Demo**: Benchmarking [`fd`](https://github.com/sharkdp/fd) and
|
||||
[`find`](https://www.gnu.org/software/findutils/):
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
* Statistical analysis across multiple runs.
|
||||
* Support for arbitrary shell commands.
|
||||
* Constant feedback about the benchmark progress and current estimates.
|
||||
|
||||
## Usage
|
||||
|
||||
### Basic benchmarks
|
||||
|
||||
To run a benchmark, you can simply call `hyperfine <command>...`. The argument(s) can be any
|
||||
shell command. For example:
|
||||
``` bash
|
||||
hyperfine 'sleep 0.3'
|
||||
```
|
||||
|
||||
### Shell functions and aliases
|
||||
|
||||
If you are using bash, you can export shell functions to directly benchmark them with hyperfine:
|
||||
|
||||
```
|
||||
$ slr_helper.py my_function() { sleep 1; }
|
||||
$ slr_helper.py export -f my_function
|
||||
$ slr_helper.py my_function
|
||||
|
||||
|
||||
```
|
||||
|
||||
If you are using a different shell, or if you want to benchmark shell aliases, you may try to put
|
||||
them in a separate file:
|
||||
|
||||
```bash
|
||||
echo 'my_function() { sleep 1 }' > /tmp/my_function.sh
|
||||
echo 'alias my_alias="sleep 1"' > /tmp/my_alias.sh
|
||||
hyperfine 'source /tmp/my_function.sh; eval my_function'
|
||||
hyperfine 'source /tmp/my_alias.sh; eval my_alias'
|
||||
```
|
||||
|
||||
### Exporting results
|
||||
|
||||
Hyperfine has multiple options for exporting benchmark results to CSV, JSON, Markdown and other
|
||||
formats (see `--help` text for details).
|
||||
|
||||
## Installation
|
||||
|
||||
[](https://repology.org/project/hyperfine/versions)
|
||||
|
||||
### On Ubuntu
|
||||
|
||||
Download the appropriate `.deb` package from the [Release page](https://github.com/sharkdp/hyperfine/releases)
|
||||
and install it via `dpkg`:
|
||||
```
|
||||
wget https://github.com/sharkdp/hyperfine/releases/download/v1.13.0/hyperfine_1.13.0_amd64.deb
|
||||
sudo dpkg -i hyperfine_1.13.0_amd64.deb
|
||||
```
|
||||
|
||||
### On Fedora
|
||||
|
||||
On Fedora, hyperfine can be installed from the official repositories:
|
||||
|
||||
```sh
|
||||
dnf install hyperfine
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
|
||||
On Alpine Linux, hyperfine can be installed [from the official repositories](https://pkgs.alpinelinux.org/packages?name=hyperfine):
|
||||
```
|
||||
apk add hyperfine
|
||||
```
|
4
config.json
Normal file
4
config.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"apikey": "6343a7f454021ecd8c7c43a5a7feb62d",
|
||||
"insttoken":""
|
||||
}
|
1
data/https%3A%2F%2Fapi.elsevier.com%2Fcontent%2Fabstract%2Fscopus_id%2F84872135457.json
Normal file
1
data/https%3A%2F%2Fapi.elsevier.com%2Fcontent%2Fabstract%2Fscopus_id%2F84872135457.json
Normal file
@ -0,0 +1 @@
|
||||
{"affiliation": [{"affiliation-city": "Stanford", "affilname": "Stanford University School of Medicine", "affiliation-country": "United States"}, {"affiliation-city": "Palo Alto", "affilname": "VA Palo Alto Health Care System", "affiliation-country": "United States"}, {"affiliation-city": "Cambridge", "affilname": "Harvard University", "affiliation-country": "United States"}, {"affiliation-city": "Chevy Chase", "affilname": "Howard Hughes Medical Institute", "affiliation-country": "United States"}, {"affiliation-city": "Philadelphia", "affilname": "University of Pennsylvania", "affiliation-country": "United States"}], "coredata": {"srctype": "j", "eid": "2-s2.0-84872135457", "pubmed-id": "23201690", "prism:coverDate": "2013-01-10", "prism:aggregationType": "Journal", "prism:url": "https://api.elsevier.com/content/abstract/scopus_id/84872135457", "dc:creator": {"author": [{"ce:given-name": "Markus", "preferred-name": {"ce:given-name": "Markus", "ce:initials": "M.", "ce:surname": "Kretz", "ce:indexed-name": "Kretz M."}, "@seq": "1", "ce:initials": "M.", "@_fa": "true", "affiliation": {"@id": "60032838", "@href": "https://api.elsevier.com/content/affiliation/affiliation_id/60032838"}, "ce:surname": "Kretz", "@auid": "6701538998", "author-url": "https://api.elsevier.com/content/author/author_id/6701538998", "ce:indexed-name": "Kretz M."}]}, "link": [{"@_fa": "true", "@rel": "self", "@href": "https://api.elsevier.com/content/abstract/scopus_id/84872135457"}, {"@_fa": "true", "@rel": "scopus", "@href": "https://www.scopus.com/inward/record.uri?partnerID=HzOxMe3b&scp=84872135457&origin=inward"}, {"@_fa": "true", "@rel": "scopus-citedby", "@href": "https://www.scopus.com/inward/citedby.uri?partnerID=HzOxMe3b&scp=84872135457&origin=inward"}], "source-id": "21206", "pii": "NATURE11661", "citedby-count": "642", "prism:volume": "493", "subtype": "ar", "dc:title": "Control of somatic tissue differentiation by the long non-coding RNA TINCR", "openaccess": "2", "prism:issn": "00280836 14764687", "prism:issueIdentifier": "7431", "subtypeDescription": "Article", "prism:publicationName": "Nature", "prism:pageRange": "231-235", "prism:endingPage": "235", "openaccessFlag": null, "prism:doi": "10.1038/nature11661", "prism:startingPage": "231", "dc:identifier": "SCOPUS_ID:84872135457"}}
|
1
data/https%3A%2F%2Fapi.elsevier.com%2Fcontent%2Farticle%2Fdoi%2F10.1016%2FS1525-1578%2810%2960571-5.json
Normal file
1
data/https%3A%2F%2Fapi.elsevier.com%2Fcontent%2Farticle%2Fdoi%2F10.1016%2FS1525-1578%2810%2960571-5.json
Normal file
@ -0,0 +1 @@
|
||||
{"coredata": {"prism:url": "https://api.elsevier.com/content/article/pii/S1525157810605715", "dc:identifier": "doi:10.1016/S1525-1578(10)60571-5", "eid": "1-s2.0-S1525157810605715", "prism:doi": "10.1016/S1525-1578(10)60571-5", "pii": "S1525-1578(10)60571-5", "dc:title": "Sensitive Sequencing Method for KRAS Mutation Detection by Pyrosequencing ", "prism:publicationName": "The Journal of Molecular Diagnostics", "prism:aggregationType": "Journal", "pubType": "fla", "prism:issn": "15251578", "prism:volume": "7", "prism:issueIdentifier": "3", "prism:startingPage": "413", "prism:endingPage": "421", "prism:pageRange": "413-421", "prism:number": "3", "dc:format": "application/json", "prism:coverDate": "2005-08-31", "prism:coverDisplayDate": "August 2005", "prism:copyright": "Copyright \u00a9 2005 American Society for Investigative Pathology and Association for Molecular Pathology. Published by Elsevier Inc. All rights reserved.", "prism:publisher": "American Society for Investigative Pathology and Association for Molecular Pathology. Published by Elsevier Inc.", "dc:creator": [{"@_fa": "true", "$": "Ogino, Shuji"}, {"@_fa": "true", "$": "Kawasaki, Takako"}, {"@_fa": "true", "$": "Brahmandam, Mohan"}, {"@_fa": "true", "$": "Yan, Liying"}, {"@_fa": "true", "$": "Cantor, Mami"}, {"@_fa": "true", "$": "Namgyal, Chungdak"}, {"@_fa": "true", "$": "Mino-Kenudson, Mari"}, {"@_fa": "true", "$": "Lauwers, Gregory Y."}, {"@_fa": "true", "$": "Loda, Massimo"}, {"@_fa": "true", "$": "Fuchs, Charles S."}], "dc:description": "\n Both benign and malignant tumors represent heterogenous tissue containing tumor cells and non-neoplastic mesenchymal and inflammatory cells. To detect a minority of mutant KRAS alleles among abundant wild-type alleles, we developed a sensitive DNA sequencing assay using Pyrosequencing, ie, nucleotide extension sequencing with an allele quantification capability. We designed our Pyrosequencing assay for use with whole-genome-amplified DNA from paraffin-embedded tissue. Assessing various mixtures of DNA from mutant KRAS cell lines and DNA from a wild-type KRAS cell line, we found that mutation detection rates for Pyrosequencing were superior to dideoxy sequencing. In addition, Pyrosequencing proved superior to dideoxy sequencing in the detection of KRAS mutations from DNA mixtures of paraffin-embedded colon cancer and normal tissue as well as from paraffin-embedded pancreatic cancers. Quantification of mutant alleles by Pyrosequencing was precise and useful for assay validation, monitoring, and quality assurance. Our Pyrosequencing method is simple, robust, and sensitive, with a detection limit of approximately 5% mutant alleles. It is particularly useful for tumors containing abundant non-neoplastic cells. In addition, the applicability of this assay for DNA amplified by whole-genome amplification technique provides an expanded source of DNA for large-scale studies.\n ", "openaccess": "0", "openaccessArticle": false, "openaccessType": null, "openArchiveArticle": false, "openaccessSponsorName": null, "openaccessSponsorType": null, "openaccessUserLicense": null, "link": [{"@href": "https://api.elsevier.com/content/article/pii/S1525157810605715", "@rel": "self", "@_fa": "true"}, {"@href": "https://www.sciencedirect.com/science/article/pii/S1525157810605715", "@rel": "scidir", "@_fa": "true"}]}, "scopus-id": "23844497341", "scopus-eid": "2-s2.0-23844497341", "pubmed-id": "16049314", "link": {"@href": "https://api.elsevier.com/content/abstract/scopus_id/23844497341", "@rel": "abstract"}, "originalText": {"xocs:doc": {"xocs:meta": {"xocs:open-access": {"xocs:oa-article-status": {"@is-open-access": "0", "@is-open-archive": "0"}}, "xocs:available-online-date": {"@yyyymmdd": "20101231", "$": "2010-12-31"}}}}}
|
1
data/https%3A%2F%2Fapi.elsevier.com%2Fcontent%2Farticle%2Fpii%2FS1674927814000082.json
Normal file
1
data/https%3A%2F%2Fapi.elsevier.com%2Fcontent%2Farticle%2Fpii%2FS1674927814000082.json
Normal file
File diff suppressed because one or more lines are too long
106
elsa.py
Normal file
106
elsa.py
Normal file
@ -0,0 +1,106 @@
|
||||
"""An example program that uses the elsapy module"""
|
||||
|
||||
from elsapy.elsclient import ElsClient
|
||||
from elsapy.elsprofile import ElsAuthor, ElsAffil
|
||||
from elsapy.elsdoc import FullDoc, AbsDoc
|
||||
from elsapy.elssearch import ElsSearch
|
||||
import json
|
||||
|
||||
## Load configuration
|
||||
con_file = open("config.json")
|
||||
config = json.load(con_file)
|
||||
con_file.close()
|
||||
|
||||
## Initialize client
|
||||
client = ElsClient(config['apikey'])
|
||||
client.inst_token = config['insttoken']
|
||||
|
||||
## Author example
|
||||
# Initialize author with uri
|
||||
my_auth = ElsAuthor(
|
||||
uri = 'https://api.elsevier.com/content/author/author_id/7004367821')
|
||||
# Read author data, then write to disk
|
||||
if my_auth.read(client):
|
||||
print ("my_auth.full_name: ", my_auth.full_name)
|
||||
my_auth.write()
|
||||
else:
|
||||
print ("Read author failed.")
|
||||
|
||||
## Affiliation example
|
||||
# Initialize affiliation with ID as string
|
||||
my_aff = ElsAffil(affil_id = '60101411')
|
||||
if my_aff.read(client):
|
||||
print ("my_aff.name: ", my_aff.name)
|
||||
my_aff.write()
|
||||
else:
|
||||
print ("Read affiliation failed.")
|
||||
|
||||
## Scopus (Abtract) document example
|
||||
# Initialize document with ID as integer
|
||||
scp_doc = AbsDoc(scp_id = 84872135457)
|
||||
if scp_doc.read(client):
|
||||
print ("scp_doc.title: ", scp_doc.title)
|
||||
scp_doc.write()
|
||||
else:
|
||||
print ("Read document failed.")
|
||||
|
||||
## ScienceDirect (full-text) document example using PII
|
||||
pii_doc = FullDoc(sd_pii = 'S1674927814000082')
|
||||
if pii_doc.read(client):
|
||||
print ("pii_doc.title: ", pii_doc.title)
|
||||
pii_doc.write()
|
||||
else:
|
||||
print ("Read document failed.")
|
||||
|
||||
## ScienceDirect (full-text) document example using DOI
|
||||
doi_doc = FullDoc(doi = '10.1016/S1525-1578(10)60571-5')
|
||||
if doi_doc.read(client):
|
||||
print ("doi_doc.title: ", doi_doc.title)
|
||||
doi_doc.write()
|
||||
else:
|
||||
print ("Read document failed.")
|
||||
|
||||
|
||||
## Load list of documents from the API into affilation and author objects.
|
||||
# Since a document list is retrieved for 25 entries at a time, this is
|
||||
# a potentially lenghty operation - hence the prompt.
|
||||
print ("Load documents (Y/N)?")
|
||||
s = input('--> ')
|
||||
|
||||
if (s == "y" or s == "Y"):
|
||||
|
||||
## Read all documents for example author, then write to disk
|
||||
if my_auth.read_docs(client):
|
||||
print ("my_auth.doc_list has " + str(len(my_auth.doc_list)) + " items.")
|
||||
my_auth.write_docs()
|
||||
else:
|
||||
print ("Read docs for author failed.")
|
||||
|
||||
## Read all documents for example affiliation, then write to disk
|
||||
if my_aff.read_docs(client):
|
||||
print ("my_aff.doc_list has " + str(len(my_aff.doc_list)) + " items.")
|
||||
my_aff.write_docs()
|
||||
else:
|
||||
print ("Read docs for affiliation failed.")
|
||||
|
||||
## Initialize author search object and execute search
|
||||
auth_srch = ElsSearch('authlast(keuskamp)','author')
|
||||
auth_srch.execute(client)
|
||||
print ("auth_srch has", len(auth_srch.results), "results.")
|
||||
|
||||
## Initialize affiliation search object and execute search
|
||||
aff_srch = ElsSearch('affil(amsterdam)','affiliation')
|
||||
aff_srch.execute(client)
|
||||
print ("aff_srch has", len(aff_srch.results), "results.")
|
||||
|
||||
## Initialize doc search object using Scopus and execute search, retrieving
|
||||
# all results
|
||||
doc_srch = ElsSearch("AFFIL(dartmouth) AND AUTHOR-NAME(lewis) AND PUBYEAR > 2011",'scopus')
|
||||
doc_srch.execute(client, get_all = True)
|
||||
print ("doc_srch has", len(doc_srch.results), "results.")
|
||||
|
||||
## Initialize doc search object using ScienceDirect and execute search,
|
||||
# retrieving all results
|
||||
doc_srch = ElsSearch("star trek vs star wars",'sciencedirect')
|
||||
doc_srch.execute(client, get_all = False)
|
||||
print ("doc_srch has", len(doc_srch.results), "results.")
|
76
logs/elsapy-20220329.log
Normal file
76
logs/elsapy-20220329.log
Normal file
@ -0,0 +1,76 @@
|
||||
2022-03-29 22:16:39,446 - elsapy.elsclient - INFO - Module loaded.
|
||||
2022-03-29 22:16:46,879 - elsapy.elsentity - INFO - Module loaded.
|
||||
2022-03-29 22:16:46,880 - elsapy.utils - INFO - Module loaded.
|
||||
2022-03-29 22:16:46,881 - elsapy.elsprofile - INFO - Module loaded.
|
||||
2022-03-29 22:16:46,882 - elsapy.elsdoc - INFO - Module loaded.
|
||||
2022-03-29 22:16:46,883 - elsapy.elssearch - INFO - Module loaded.
|
||||
2022-03-29 22:20:25,727 - elsapy.elsclient - INFO - Module loaded.
|
||||
2022-03-29 22:20:26,121 - elsapy.elsentity - INFO - Module loaded.
|
||||
2022-03-29 22:20:26,121 - elsapy.utils - INFO - Module loaded.
|
||||
2022-03-29 22:20:26,122 - elsapy.elsprofile - INFO - Module loaded.
|
||||
2022-03-29 22:20:26,122 - elsapy.elsdoc - INFO - Module loaded.
|
||||
2022-03-29 22:20:26,123 - elsapy.elssearch - INFO - Module loaded.
|
||||
2022-03-29 22:20:28,068 - elsapy.elsclient - INFO - Module loaded.
|
||||
2022-03-29 22:20:28,393 - elsapy.elsentity - INFO - Module loaded.
|
||||
2022-03-29 22:20:28,393 - elsapy.utils - INFO - Module loaded.
|
||||
2022-03-29 22:20:28,393 - elsapy.elsprofile - INFO - Module loaded.
|
||||
2022-03-29 22:20:28,394 - elsapy.elsdoc - INFO - Module loaded.
|
||||
2022-03-29 22:20:28,395 - elsapy.elssearch - INFO - Module loaded.
|
||||
2022-03-29 22:21:11,698 - elsapy.elsclient - INFO - Module loaded.
|
||||
2022-03-29 22:21:12,049 - elsapy.elsentity - INFO - Module loaded.
|
||||
2022-03-29 22:21:12,050 - elsapy.utils - INFO - Module loaded.
|
||||
2022-03-29 22:21:12,050 - elsapy.elsprofile - INFO - Module loaded.
|
||||
2022-03-29 22:21:12,051 - elsapy.elsdoc - INFO - Module loaded.
|
||||
2022-03-29 22:21:12,051 - elsapy.elssearch - INFO - Module loaded.
|
||||
2022-03-29 22:21:23,004 - elsapy.elsclient - INFO - Module loaded.
|
||||
2022-03-29 22:21:23,346 - elsapy.elsentity - INFO - Module loaded.
|
||||
2022-03-29 22:21:23,347 - elsapy.utils - INFO - Module loaded.
|
||||
2022-03-29 22:21:23,347 - elsapy.elsprofile - INFO - Module loaded.
|
||||
2022-03-29 22:21:23,348 - elsapy.elsdoc - INFO - Module loaded.
|
||||
2022-03-29 22:21:23,349 - elsapy.elssearch - INFO - Module loaded.
|
||||
2022-03-29 22:21:44,998 - elsapy.elsclient - INFO - Module loaded.
|
||||
2022-03-29 22:21:45,345 - elsapy.elsentity - INFO - Module loaded.
|
||||
2022-03-29 22:21:45,345 - elsapy.utils - INFO - Module loaded.
|
||||
2022-03-29 22:21:45,345 - elsapy.elsprofile - INFO - Module loaded.
|
||||
2022-03-29 22:21:45,346 - elsapy.elsdoc - INFO - Module loaded.
|
||||
2022-03-29 22:21:45,347 - elsapy.elssearch - INFO - Module loaded.
|
||||
2022-03-29 22:23:40,687 - elsapy.elsclient - INFO - Module loaded.
|
||||
2022-03-29 22:23:41,000 - elsapy.elsentity - INFO - Module loaded.
|
||||
2022-03-29 22:23:41,000 - elsapy.utils - INFO - Module loaded.
|
||||
2022-03-29 22:23:41,000 - elsapy.elsprofile - INFO - Module loaded.
|
||||
2022-03-29 22:23:41,001 - elsapy.elsdoc - INFO - Module loaded.
|
||||
2022-03-29 22:23:41,001 - elsapy.elssearch - INFO - Module loaded.
|
||||
2022-03-29 22:24:16,859 - elsapy.elsclient - INFO - Module loaded.
|
||||
2022-03-29 22:24:17,167 - elsapy.elsentity - INFO - Module loaded.
|
||||
2022-03-29 22:24:17,168 - elsapy.utils - INFO - Module loaded.
|
||||
2022-03-29 22:24:17,168 - elsapy.elsprofile - INFO - Module loaded.
|
||||
2022-03-29 22:24:17,168 - elsapy.elsdoc - INFO - Module loaded.
|
||||
2022-03-29 22:24:17,169 - elsapy.elssearch - INFO - Module loaded.
|
||||
2022-03-29 22:25:00,866 - elsapy.elsclient - INFO - Module loaded.
|
||||
2022-03-29 22:25:01,184 - elsapy.elsentity - INFO - Module loaded.
|
||||
2022-03-29 22:25:01,185 - elsapy.utils - INFO - Module loaded.
|
||||
2022-03-29 22:25:01,185 - elsapy.elsprofile - INFO - Module loaded.
|
||||
2022-03-29 22:25:01,186 - elsapy.elsdoc - INFO - Module loaded.
|
||||
2022-03-29 22:25:01,186 - elsapy.elssearch - INFO - Module loaded.
|
||||
2022-03-29 22:25:01,867 - elsapy.elsclient - INFO - Sending GET request to https://api.elsevier.com/content/author/author_id/7004367821
|
||||
2022-03-29 22:25:02,547 - elsapy.elsentity - WARNING - HTTP 401 Error from https://api.elsevier.com/content/author/author_id/7004367821
|
||||
and using headers {'X-ELS-APIKey': '6343a7f454021ecd8c7c43a5a7feb62d', 'User-Agent': 'elsapy-v0.5.0', 'Accept': 'application/json'}:
|
||||
{"service-error":{"status":{"statusCode":"AUTHORIZATION_ERROR","statusText":"The requestor is not authorized to access the requested view or fields of the resource"}}}
|
||||
2022-03-29 22:25:03,548 - elsapy.elsclient - INFO - Sending GET request to https://api.elsevier.com/content/affiliation/affiliation_id/60101411
|
||||
2022-03-29 22:25:03,785 - elsapy.elsentity - WARNING - HTTP 401 Error from https://api.elsevier.com/content/affiliation/affiliation_id/60101411
|
||||
and using headers {'X-ELS-APIKey': '6343a7f454021ecd8c7c43a5a7feb62d', 'User-Agent': 'elsapy-v0.5.0', 'Accept': 'application/json'}:
|
||||
{"service-error":{"status":{"statusCode":"AUTHORIZATION_ERROR","statusText":"The requestor is not authorized to access the requested view or fields of the resource"}}}
|
||||
2022-03-29 22:25:04,786 - elsapy.elsclient - INFO - Sending GET request to https://api.elsevier.com/content/abstract/scopus_id/84872135457
|
||||
2022-03-29 22:25:05,625 - elsapy.elsentity - INFO - Data loaded for https://api.elsevier.com/content/abstract/scopus_id/84872135457
|
||||
2022-03-29 22:25:05,625 - elsapy.elsentity - INFO - Wrote https://api.elsevier.com/content/abstract/scopus_id/84872135457 to file
|
||||
2022-03-29 22:25:06,624 - elsapy.elsclient - INFO - Sending GET request to https://api.elsevier.com/content/article/pii/S1674927814000082
|
||||
2022-03-29 22:25:07,195 - elsapy.elsentity - INFO - Data loaded for https://api.elsevier.com/content/article/pii/S1674927814000082
|
||||
2022-03-29 22:25:07,196 - elsapy.elsentity - INFO - Wrote https://api.elsevier.com/content/article/pii/S1674927814000082 to file
|
||||
2022-03-29 22:25:08,196 - elsapy.elsclient - INFO - Sending GET request to https://api.elsevier.com/content/article/doi/10.1016/S1525-1578(10)60571-5
|
||||
2022-03-29 22:25:09,018 - elsapy.elsentity - INFO - Data loaded for https://api.elsevier.com/content/article/doi/10.1016/S1525-1578(10)60571-5
|
||||
2022-03-29 22:25:09,019 - elsapy.elsentity - INFO - Wrote https://api.elsevier.com/content/article/doi/10.1016/S1525-1578(10)60571-5 to file
|
||||
2022-03-29 22:25:13,206 - elsapy.elsclient - INFO - Sending GET request to https://api.elsevier.com/content/author/author_id/7004367821?view=documents
|
||||
2022-03-29 22:25:13,785 - elsapy.elsprofile - WARNING - ('HTTP 400 Error from https://api.elsevier.com/content/author/author_id/7004367821?view=documents\nand using headers {\'X-ELS-APIKey\': \'6343a7f454021ecd8c7c43a5a7feb62d\', \'User-Agent\': \'elsapy-v0.5.0\', \'Accept\': \'application/json\'}:\n{"service-error":{"status":{"statusCode":"INVALID_INPUT","statusText":"View parameter entered is not valid for this service"}}}',)
|
||||
2022-03-29 22:25:14,786 - elsapy.elsclient - INFO - Sending GET request to https://api.elsevier.com/content/affiliation/affiliation_id/60101411?view=documents
|
||||
2022-03-29 22:25:15,314 - elsapy.elsprofile - WARNING - ('HTTP 400 Error from https://api.elsevier.com/content/affiliation/affiliation_id/60101411?view=documents\nand using headers {\'X-ELS-APIKey\': \'6343a7f454021ecd8c7c43a5a7feb62d\', \'User-Agent\': \'elsapy-v0.5.0\', \'Accept\': \'application/json\'}:\n{"service-error":{"status":{"statusCode":"INVALID_INPUT","statusText":"View parameter entered is not valid for this service"}}}',)
|
||||
2022-03-29 22:25:16,315 - elsapy.elsclient - INFO - Sending GET request to https://api.elsevier.com/content/search/author?query=authlast%28keuskamp%29
|
@ -14,11 +14,12 @@ inclusion/exclusion criteria.
|
||||
|
||||
Usage:
|
||||
slr_helper.py -i <input_file.json>
|
||||
slr_helper.py -a <api_key> -u <url> -k <keywords>
|
||||
slr_helper.py -a <api_key> -k <keywords>
|
||||
slr_helper.py -a <api_key> -k <keywords> -h <hits>
|
||||
|
||||
Examples:
|
||||
slr_helper.py -i -o -x
|
||||
slr_helper.py -d malware_behaviour_log.db
|
||||
slr_helper.py -a <api_key> -u <url> -k <keywords> -s <subject>
|
||||
slr_helper.py -i <input_file.json> -m <"nb", or "svm", or "lr", or "rf", or "dt", or "ALL" (default)>
|
||||
|
||||
Options:
|
||||
@ -27,8 +28,10 @@ Options:
|
||||
-k --keywords For downloading: Keywords to search for on the URL (i.e. academic database) used
|
||||
-o --operator For downloading: Search operators (OR, AND)
|
||||
-x --expression For sieving: Reg ex to filter [default: ALL]
|
||||
-s --subject Specification of subject matter [default: ALL]. E.g. "COMP" or "AGRI"
|
||||
-d --database For sieving: Database to store the results in [default: NONE]
|
||||
-u --url For downloading: Academic database (or search engine) URL. Fixed entries for Scopus, IEEEXplore
|
||||
-u --url For downloading: Academic database (or search engine) URL [default: Scopus].
|
||||
-h --hits Number of results to fetch [default: 25].
|
||||
"""
|
||||
|
||||
# Import standard libraries
|
||||
@ -42,9 +45,12 @@ def main(arguments):
|
||||
# Extract arguments of interest
|
||||
input_file = arguments['<input_file.json>']
|
||||
api_key = arguments['<api_key>']
|
||||
url = arguments['<url>']
|
||||
#url = arguments['<url>']
|
||||
#url = "https://api.elsevier.com/content/search/scopus?query="
|
||||
url = "https://api.elsevier.com/content/search/scopus?query="
|
||||
keywords = arguments['<keywords>']
|
||||
search_engine = "scopus"
|
||||
#hits = str("&cursor=*&count=" + arguments["<hits>"]) # If more than 25 hits
|
||||
|
||||
if input_file:
|
||||
with open(input_file) as json_file:
|
||||
@ -53,18 +59,32 @@ def main(arguments):
|
||||
for i in value['entry']:
|
||||
print(i, "\n\n")
|
||||
|
||||
else:
|
||||
fetch_scopus(api_key, url, keywords)
|
||||
|
||||
def fetch_scopus(api_key, url, keywords):
|
||||
|
||||
if api_key:
|
||||
query = str(url + keywords + "&apiKey=" + api_key)
|
||||
print("Query ", query)
|
||||
query_response = req.get(query)
|
||||
dta = query_response.json()
|
||||
print(dta)
|
||||
print_summary(dta)
|
||||
if query_response.status_code == 429:
|
||||
print("Error 429")
|
||||
if query_response.status_code != 200:
|
||||
print("Not 200!")
|
||||
|
||||
def fetch_next_scopus(url):
|
||||
print("Fetching next 25: ", url)
|
||||
response = req.get(url, headers ={"Accept" : "application/json"})
|
||||
data = response.json()
|
||||
print(type(data))
|
||||
print_summary(data)
|
||||
if query_response.status_code == 429:
|
||||
print("Error 429")
|
||||
if query_response.status_code != 200:
|
||||
print("Not 200!")
|
||||
|
||||
if query_response.status_code == 429:
|
||||
print("Error 429")
|
||||
if query_response.status_code != 200:
|
||||
print("Not 200!")
|
||||
|
||||
def extract_scopus_results(results_json):
|
||||
print("JSON")
|
||||
@ -73,9 +93,17 @@ def extract_ieee_results(results_xml):
|
||||
print("XML")
|
||||
|
||||
def print_summary(total_articles):
|
||||
print(type(total_articles))
|
||||
print("Summary\n------------------\nTotal hits: ", total_articles["search-results"]["opensearch:totalResults"],
|
||||
"\nSearch word:",total_articles["search-results"]["opensearch:Query"]["@searchTerms"], "\n\n")
|
||||
print("Printing summary\n------------------\nTotal hits: ", total_articles["search-results"]["opensearch:totalResults"])
|
||||
print("\nSearch word:", total_articles["search-results"]["opensearch:Query"]["@searchTerms"], "\n\n--------------------")
|
||||
total_articles_list = total_articles["search-results"]["entry"]
|
||||
|
||||
for i in total_articles_list:
|
||||
print("Title:", i["dc:title"],"\nAuthors:", i["dc:creator"],"\nPublication:", i["prism:publicationName"],"\nType:", i["prism:aggregationType"], i["subtypeDescription"], "\n\n")
|
||||
|
||||
for ln in total_articles["search-results"]["link"]:
|
||||
if ln["@ref"] == "next":
|
||||
print(ln["@href"])
|
||||
fetch_next_scopus(ln["@href"])
|
||||
|
||||
# Main menu constructor
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
x
Reference in New Issue
Block a user