コード例 #1
0
 def test_get_all_metric_names(self):
     response = ProviderFactory.get_all_metric_names(
         self.TEST_PROVIDER_CONFIG)
     expected = [
         'wikipedia:mentions', 'mendeley:country',
         'pubmed:pmc_citations_reviews', 'mendeley:discipline',
         'pubmed:f1000', 'mendeley:career_stage',
         'pubmed:pmc_citations_editorials', 'mendeley:readers',
         'pubmed:pmc_citations', 'mendeley:groups'
     ]
     assert_equals(response, expected)
コード例 #2
0
 def test_get_all_metric_names(self):
     response = ProviderFactory.get_all_metric_names(self.TEST_PROVIDER_CONFIG)
     expected = [
         "wikipedia:mentions",
         "mendeley:country",
         "pubmed:pmc_citations_reviews",
         "mendeley:discipline",
         "pubmed:f1000",
         "mendeley:career_stage",
         "pubmed:pmc_citations_editorials",
         "mendeley:readers",
         "pubmed:pmc_citations",
         "mendeley:groups",
     ]
     assert_equals(response, expected)
コード例 #3
0
def get_metric_value_lists(items):
    (ordered_fieldnames, rows) = make_csv_rows(items)
    metric_values = {}
    for metric_name in ProviderFactory.get_all_metric_names():
        if metric_name in ordered_fieldnames:
            if metric_name in ["tiid", "title", "doi"]:
                pass
            else:
                values = [row[metric_name] for row in rows]
                values = [value if value else 0 for value in values]
                # treat "Yes" as 1 for normalizaations
                values = [1 if value=="Yes" else value for value in values]
                metric_values[metric_name] = sorted(values, reverse=True)
        else:
            metric_values[metric_name] = [0 for row in rows]
    return metric_values
コード例 #4
0
def get_metric_value_lists(items):
    (ordered_fieldnames, rows) = make_csv_rows(items)
    metric_values = {}
    for metric_name in ProviderFactory.get_all_metric_names():
        if metric_name in ordered_fieldnames:
            if metric_name in ["tiid", "title", "doi"]:
                pass
            else:
                values = [row[metric_name] for row in rows]
                values = [value if value else 0 for value in values]
                # treat "Yes" as 1 for normalizaations
                values = [1 if value == "Yes" else value for value in values]
                metric_values[metric_name] = sorted(values, reverse=True)
        else:
            metric_values[metric_name] = [0 for row in rows]
    return metric_values