Exemplo n.º 1
0
def articles_metrics(scopus_id, metric='PublicationsInTopJournalPercentiles'):
    
    query = {'metricTypes':'%s'%(metric),
            'yearRange':'5yrsAndCurrent',
            'includeSelfCitations':'true',
            'byYear':'false',
            'includedDocs':'ArticlesOnly',
            'journalImpactType':'SJR',
            'showAsFieldWeighted':'true',
            'indexType':'hIndex',
            'authors':'%s' %(scopus_id)}
    
    if metric== 'PublicationsInTopJournalPercentiles':
       response = api_query(query)
       data = response['results'][0]['metrics'][0]['values']
       return data[-1]['value']  

    else: 
        
        query = {'metricTypes':'%s'%(metric),
            'yearRange':'5yrsAndCurrent',
            'includeSelfCitations':'true',
            'byYear':'false',
            'includedDocs':'ArticlesOnly',
            'journalImpactType':'CiteScore',
            'showAsFieldWeighted':'true',
            'indexType':'hIndex',
            'authors':'%s' %(scopus_id)}
        response = api_query(query)
        data = response['results'][0]['metrics'][0]['values']
        return data[2]['value'] 
def scival_citescore_percentile_retrive(author_id):
    ''' This function is used for SciVal matric CiteScore percentile retrive
        It takes API file, author id(SCOPUS_ID) as inputs and return
        1st,5th, and 10th percentile pulications results as list. '''

    import pandas as pd
    from scival_author_metrics import api_query
    pd.options.display.float_format = '{:.2f}'.format

    assert type(author_id) is str

    query = {
        'metricTypes':
        'FieldWeightedCitationImpact,PublicationsInTopJournalPercentiles',
        'byYear': 'false',
        'yearRange': '5yrsAndCurrent',
        'authors': '%s' % (author_id)
    }

    #HTTP request response object
    response = api_query(query)
    # Retriving only 1,5 and 10th percentile publication values
    *data, _ = response['results'][0]['metrics'][1]['values']

    #Data frame from data dictioanry and only values are return
    df = pd.DataFrame(data)
    percentile = df['percentage'].values

    return percentile
Exemplo n.º 3
0
def benchmarking_metrics(scopus_id):
    
    """Retriving SciVal publication metrics using Scival API 
    input scopus_id for which  return all metrics  defined in the query
   
    
    Parameter
    ----------
    scopus_id : str
               Author Scopus id
    
    Returns
    -------
    metrics : obj
              pandas dataframe metricType as index
              value as column"""
    
   
    query = {'metricTypes': """ScholarlyOutput,CitationCount,
             FieldWeightedCitationImpact""",
		        'byYear': 'false',
		        'yearRange': '5yrsAndCurrent',
            'includedDocs':'ArticlesOnly',
            'journalImpactType':'CiteScore',
            'authors': '%s' %(scopus_id)}  

    response = api_query(query)    
    response_data = response['results'][0]['metrics']
    metrics = {data['metricType']: data['value'] for data in response_data}
    
    
    return metrics
def scival_metrics(scopus_id):
    
    """Retriving SciVal default metrics using Scival API 
    input scopus_id for which  return all default metrics 
    displayed in Scival.https://www.scival.com/overview/summary
    
    Parameter
    ----------
    scopus_id : str
               Author Scopus id
    
    Returns
    -------
    metrics : obj
              pandas dataframe metricType as index
              value as column"""
    
    import pandas as pd
    from scival_author_metrics import api_query
    pd.set_option('display.float_format', lambda x: '%.3f' % x)

    assert isinstance(scopus_id, (str, int))
    
    #query for http request
    query = {'metricTypes': """ScholarlyOutput,CitationCount,hIndices,
             FieldWeightedCitationImpact,CitationsPerPublication,
		         OutputsInTopCitationPercentiles,PublicationsInTopJournalPercentiles""",
		        'byYear': 'false',
		        'yearRange': '5yrsAndCurrent',
            'authors': '%s' %(scopus_id) }  
    response = api_query(query)    
    response_data = response['results'][0]['metrics']
            
    #Making a pandas dataframe from data dictionary
    df = pd.DataFrame.from_records(response_data)
    
    # Publication metrics are CiteScore Percentile default of SciVal metrics
    
    metrics = df[['metricType', 'value']]
    #metrics = metrics.fillna(0.0)
    metrics = metrics.set_index('metricType')
    
    return metrics
    
def get_scival_fwci(author_id):
    ''' This function is used for retriving SciVal 
        Field weighted citation impact exclude selfcitations
        input is author id (SCOPUS_ID).
        Return mean FWCI.
        
    Parameter
    ----------
    author_id : str or int
                Author Scopus Id 
    
    Return
    -------
    mean_fwci : float   
                mean FWCI for 5 years and current
    '''

    import pandas as pd
    from scival_author_metrics import api_query

    assert isinstance(author_id, (str, int))
    #FWCI for last years and 5 years and current year exclude selfcitations and journal impact type SNIP
    query = {
        'metricTypes': 'FieldWeightedCitationImpact',
        'yearRange': '5yrsAndCurrent',
        'includeSelfCitations': 'false',
        'byYear': 'true',
        'includedDocs': 'AllPublicationTypes',
        'journalImpactType': 'SNIP',
        'showAsFieldWeighted': 'false',
        'indexType': 'hIndex',
        'authors': '%s' % (author_id)
    }

    #HTTP response object from request
    response = api_query(query)
    data = response['results'][0]['metrics'][0]

    #Dataframe from the data dictionary and calculating mean from the values
    fwci = pd.DataFrame.from_dict(data)
    fwci = fwci.drop(['metricType'], axis=1)
    mean_fwci = fwci.mean()

    return mean_fwci
Exemplo n.º 6
0
def scival_SJR_percentile_retrive(author_id):
    ''' This function retrives SciVal matric SJR top ten percentile.
        input is author id(SCOPUS_ID) and return ten percentile 
        exclude selfcitations pulications in SJR journal.
        
    Parameter
    ----------
    author_id : str or int
                Author Scopus Id 
    
    Return
    -------
    top_10_percentile : float   
                ten percentile publication in SJR journal
    '''

    import pandas as pd
    from scival_author_metrics import api_query
    pd.options.display.float_format = '{:.2f}'.format

    assert isinstance(author_id, (str, int))

    query = {
        'metricTypes': 'PublicationsInTopJournalPercentiles',
        'yearRange': '5yrs',
        'includeSelfCitations': 'false',
        'byYear': 'false',
        'includedDocs': 'AllPublicationTypes',
        'journalImpactType': 'SJR',
        'showAsFieldWeighted': 'false',
        'indexType': 'hIndex',
        'authors': '%s' % (author_id)
    }
    #HTTP request response object
    response = api_query(query)
    data = response['results'][0]['metrics'][0]['values']

    #Dataframe from the SJR percentile data dictionary
    df = pd.DataFrame.from_dict(data)
    # Get the publication percentile from the data frmae
    # If the nubmer is needed change dataframe column name to value
    top_10_percentile = df.iloc[2]['percentage']

    return top_10_percentile
def get_scival_fwci_selfcite(author_id):
    
    ''' This function is used for retriving SciVal 
        Field weighted citation impact with selfcitations
        input is author id (SCOPUS_ID).
        Return FWCI Journal impact type is CiteScore.
        
    Parameter
    ----------
    author_id : str or int
                Author Scopus Id 
    
    Return
    -------
    mean_fwci : float   
                FWCI for 5 years and current
    ''' 
    
    from scival_author_metrics import api_query
        
    assert isinstance(author_id, (str, int))
    
    query = {'metricTypes' :'FieldWeightedCitationImpact',
             'yearRange' : '5yrsAndCurrent',
             'includeSelfCitations':'true',
             'byYear':'false',
             'includedDocs':'AllPublicationTypes',
             'journalImpactType':'CiteScore',
             'showAsFieldWeighted':'true',
             'indexType':'hIndex',
             'authors': '%s' %(author_id)}
    
    #HTTP request response object        
    response = api_query(query)      
    
    #FWCI data frame from data dictionary         
    fwci = response['results'][0]['metrics'][0]['value']             
       
                     
    return fwci
Exemplo n.º 8
0
def scival_top_citation_percentiles_retrive(author_id):
    ''' This function retrive SciVal matric outputs in top 
        percentile. Input is author id(SCOPUS_ID) 
        and return output in top 10th percentile cited. 
        
    Parameter
    ----------
    author_id : str or int
                Author Scopus Id 
    
    Return
    -------
    percentile : float   
                 Top 10th percentile cited
    '''

    import pandas as pd
    from scival_author_metrics import api_query
    pd.options.display.float_format = '{:.2f}'.format

    assert isinstance(author_id, (str, int))

    query = {
        'metricTypes': 'OutputsInTopCitationPercentiles',
        'showAsFieldWeighted': 'true',
        'byYear': 'false',
        'yearRange': '5yrsAndCurrent',
        'authors': '%s' % (author_id)
    }

    #HTTP response from request
    response = api_query(query)
    data = response['results'][0]['metrics'][0]['values']

    #Dataframe from the top citiation percentiles data
    df = pd.DataFrame(data)
    percentile = df['percentage'].values

    return percentile[2]