Beispiel #1
0
    def login(self):
        """
        login to the Dimensions API through their 'DSL'
        """
        if not self.api_obj:
            dimcli.login(
                username=self.parent.config["DEFAULT"]["email"],
                password=self.parent.config["DEFAULT"]["dimensions_password"])

            self.api_obj = dimcli.Dsl(verbose=False)
Beispiel #2
0
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 15 11:10:11 2020

This script is for fetching dimensions data

@author: sahand
"""
import os
import gc
from tqdm import tqdm
import dimcli
import pandas as pd
import numpy as np
import json
dimcli.login(key="CC1FEFF8637149DBBA873831FCA4471F",endpoint="https://app.dimensions.ai")
# dimcli --init
# dimcli.login()
dsl = dimcli.Dsl()

# =============================================================================
# Query - get year by year
# =============================================================================

# data = dsl.query("""search publications for "black holes" return publications""")
# data = dsl.query("""search publications for "black holes" return publications""", verbose=False)
years = list(range(2018,2021))
for year in tqdm(years):
    # year = 2016
    # data = dsl.query_iterative(r"""search publications for "\"artificial intelligence\"" where year="""+str(year)+
    #                            """ and (type="article" or type="proceeding") and times_cited > 0 
Beispiel #3
0
#
# startup file for ipython
#
# used to generate a new version of the grammar_dsl.py file
#

import json
import dimcli
dimcli.login("test")
dsl = dimcli.Dsl()

data = dsl.query("describe schema").json

with open("dimcli/core/dsl_grammar_core_NEW.py", "w") as f:
    f.write("GRAMMAR_DICT = " + str(data))
Beispiel #4
0
# Also, how to normalize the nested json data formats.
# Lastly, the script to concatenating several normalized datasets together

# import required libraries

import pandas as pd
import numpy as np
import json
import requests

!pip install dimcli -U

# I have created a local credential. Otherwise, can try log in with user name and password. Details in the Dimensions API lab: https://docs.dimensions.ai/dsl

import dimcli
dimcli.login()
dsl = dimcli.Dsl()
dimcli.login()

# create a list for researchers' ids

researcher_id = ['ur.01215450000.22','ur.011725645715.40','ur.01244272356.36','ur.01105074143.21','ur.01033403276.88',
                'ur.015324333431.33','ur.0720260005.12','ur.0665714166.39']
  
# Use iterative to query all researchers within UR
                
data = dsl.query_iterative("""search researchers 
where research_orgs in ["grid.461628.f", "grid.412750.5", "grid.414078.e", "grid.416663.0"] 
and obsolete=0 return researchers""")

# There is a column called "id" which is the Dimensions id of the researchers.
Beispiel #5
0
import descartes
import networkx as nx
import plotly.express as px
import itertools

from tqdm.notebook import tqdm as pbar
if not 'google.colab' in sys.modules:
  # make js dependecies local / needed by html exports
  from plotly.offline import init_notebook_mode
  init_notebook_mode(connected=True)


  import getpass
  USERNAME = getpass.getpass(prompt='*****@*****.**' )
  PASSWORD = getpass.getpass(prompt='')
  dimcli.login(username ="******" , password = "" )
else:
  dimcli.login(username ="******" , password = "" )
dsl = dimcli.Dsl()


#------------------------------------------------------------

KEYWORD = "10.1080/20013078.2018.1535750"

q = f"""search publications 
          where research_orgs="grid.117476.2"
            for "\\"{KEYWORD}\\"" 
        return publications[id+title+times_cited+altmetric+concepts_scores] 
        """