Rejected Article tracker#
This Python notebook shows how publishers can use the Dimensions Analytics API to identify whether articles they chose not to publish were published somewhere else, and if so who, when and with what citation metrics.
In this notebook we will:
Import a .csv file of required fields for a list of rejected articles
Leverage the Dimensions API’s full-text, fuzzy search capabilities to iteratively search the Dimensions API for publications like the rejected articles.
Join the rejected articles with the best-matching search results
Measure the strength of the matches and provide ideas for validation before proceeding to detailed analyses.
Note this notebook can be run either using Google Colab or standard Jupyter.
[1]:
import datetime
print("==\nCHANGELOG\nThis notebook was last run on %s\n==" % datetime.date.today().strftime('%b %d, %Y'))
==
CHANGELOG
This notebook was last run on Mar 03, 2025
==
Prerequisites#
This notebook assumes you have installed the Dimcli library and are familiar with the ‘Getting Started’ tutorial.
[2]:
!pip install dimcli nltk pandasql python-Levenshtein openpyxl -U --quiet
import dimcli
from dimcli.utils import *
import io
import json
import os
import sys
import time
import pandas as pd
import numpy as np
from pandasql import sqldf
import pandasql as ps
if 'google.colab' in sys.modules:
from google.colab import files
#
pd.set_option('display.max_columns', None)
print("==\nLogging in..")
# https://digital-science.github.io/dimcli/getting-started.html#authentication
ENDPOINT = "https://app.dimensions.ai"
if 'google.colab' in sys.modules:
import getpass
KEY = getpass.getpass(prompt='API Key: ')
dimcli.login(key=KEY, endpoint=ENDPOINT)
else:
KEY = ""
dimcli.login(key=KEY, endpoint=ENDPOINT)
dsl = dimcli.Dsl()
==
Logging in..
API Key: ··········
Dimcli - Dimensions API Client (v1.4)
Connected to: <https://app.dimensions.ai/api/dsl> - DSL v2.10
Method: manual login
1. Load Data on Rejected Articles#
For this tutorial, we are using a small sample file of made-up rejected articles, rejected-articles-sample-data.csv. If you run this notebook in Jupyter, the sample file is loaded automatically; in Google Colab you will be prompted to upload your own Excel or .csv file instead.
This list of fields with these specific, case-sensitive field names are required:
Manuscript ID: a unique identifier that will tie your search results back to a particular rejected article
Date of Rejection: Date the article was rejected
Title: The title of the rejected article
Keywords: Comma-separated keywords describing the rejected article (if these aren’t available you can build them from the Title field - see the optional keyword-extraction snippet in section 2 below).
First Author: the First Author as Last, First (only Last will be used)
Corr Author: the Corresponding Author as Last, First (only Last will be used)
Any additional fields in your file, regardless of name, will propagate through the query unchanged and remain available for subsequent analytics. Some examples of fields you might wish to include: journal submitted to, editor’s name, reviewer’s name, submission date, reject reason or the like.
The import cell below handles both Excel and .csv files.
[6]:
if 'google.colab' in sys.modules:
# In Colab: upload your own Excel or .csv file of rejected articles
uploaded = files.upload()
file_name = list(uploaded.keys())[0] # Get the uploaded file name
if file_name.lower().endswith(('.xlsx', '.xls')):
RejectedArticles = pd.read_excel(io.BytesIO(uploaded[file_name]), engine='openpyxl')
else:
RejectedArticles = pd.read_csv(io.BytesIO(uploaded[file_name]), encoding='latin1')
else:
# In Jupyter: load the sample data shipped with this notebook.
# Point this at your own file (pd.read_excel for Excel) to use real data.
SAMPLE = "rejected-articles-sample-data.csv"
SAMPLE_URL = ("https://raw.githubusercontent.com/digital-science/dimensions-api-lab/"
"master/cookbooks/2-publications/rejected-articles-sample-data.csv")
RejectedArticles = pd.read_csv(
SAMPLE if os.path.exists(SAMPLE) else SAMPLE_URL, encoding='latin1')
if 'Date of Rejection' in RejectedArticles:
RejectedArticles['Date of Rejection'] = pd.to_datetime(
RejectedArticles['Date of Rejection'], errors='coerce'
).dt.strftime('%Y-%m-%d')
RejectedArticles.head(3)
[6]:
Manuscript ID Date of Rejection Reject Reason \
0 JSS76145 2001-04-01 Reject Open
1 JSS50060 2012-06-23 Reject Open
2 JSS48881 1998-01-01 EDREJECT
Title First Author \
0 Erythrodiol-3-acetate, pentacyclic triterpenoi... Moon, Hyung-In
1 A Programmable Dual-RNA-Guided DNA Endonucleas... Jinek, Martin
2 Ileal-lymphoid-nodular hyperplasia, non-specif... Wakefield, AJ
Corr Author Co-Authors \
0 Chung, Jin Ho Moon, Hyung-In; Seo, Dong Wan; Kim, Kyu-Han; C...
1 Fonfara, I Jinek, Martin; Chylinski, Krzysztof; Fonfara, ...
2 Wakefield, AJ Wakefield, AJ; Murch, SH; Anthony, A; Linnell,...
Subject Category Editor Submitted Journal Article Type \
0 NaN Kim, Soo-jin Science Serial NaN
1 NaN Garcia, Luis Science Serial NaN
2 NaN Patel, Priya Chemistry Compendium NaN
Keywords Custom Funders
0 Humans, Enzyme Inhibitors/isolation & purifica... NaN NaN
1 Deoxyribonucleases, Type II Site-Specific/meta... NaN NaN
2 Developmental Disabilities/etiology*, Child, H... NaN NaN
2. Clean input file to prepare datapoints to work with DSL#
[7]:
import string
RejArt = RejectedArticles
"""
#Optional: If your input data does not contain a field for "Keywords" you can make one based on the
# important words in your title with this section.
import nltk
from nltk.corpus import stopwords
nltk.download('stopwords')
stop_words = set(stopwords.words('english'))
def extract_keywords(title):
return ', '.join([word.capitalize() for word in title.split() if word.lower() not in stop_words])
RejArt['Keywords'] = RejArt['Title'].apply(extract_keywords)
RejArt.head(6)
"""
cols = RejArt.select_dtypes(['object']).columns
RejArt[cols] = RejArt[cols].apply(lambda x: x.str.strip())
RejArt['Keywords_Or'] = RejArt['Keywords'].str.replace(',', 'abcdefghijkl')
RejArt['Keywords_Or'] = RejArt['Keywords_Or'].str.replace('abcdefghijkl', ' OR ')
RejArt['Keywords_Or'] = RejArt['Keywords_Or'].str.replace(' and ', ' OR ')
RejArt['Keywords_Or'] = RejArt['Keywords_Or'].str.replace(r'\b(OR\s+OR)+\b', ' OR ', regex=True)
RejArt['Keywords_Or'] = RejArt['Keywords_Or'].str.replace(r'\s+', ' ', regex=True).str.strip() # Remove extra spaces
RejArt['Keywords_And'] = RejArt['Keywords_Or'].str.replace(r'\bOR\b', 'AND', regex=True)
RejArt['Keywords_And'] = RejArt['Keywords_And'].str.replace(r'\b(AND\s+AND)+\b', ' AND ', regex=True)
#Remove punctuation (punctuation can cause errors in the DSL query):
RejArt[['Keywords_Or', 'Keywords_And', 'Title']] = RejArt[['Keywords_Or', 'Keywords_And', 'Title']].apply(
lambda x: x.str.translate(str.maketrans(string.punctuation, ' ' * len(string.punctuation))))
RejArt['FALast'] = RejArt['First Author'].str.split(',').str[0]
RejArt['CALast'] = RejArt['Corr Author'].str.split(',').str[0]
RejArt = RejArt[['FALast','CALast','Keywords_Or','Keywords_And','Article Type','Title','Date of Rejection','Manuscript ID']]
print(len(RejArt))
RejArt.head(3)
17
[7]:
| FALast | CALast | Keywords_Or | Keywords_And | Article Type | Title | Date of Rejection | Manuscript ID | |
|---|---|---|---|---|---|---|---|---|
| 0 | Moon | Chung | Humans OR Enzyme Inhibitors isolation purifi... | Humans AND Enzyme Inhibitors isolation purif... | NaN | Erythrodiol 3 acetate pentacyclic triterpenoi... | 2001-04-01 | JSS76145 |
| 1 | Jinek | Fonfara | Deoxyribonucleases OR Type II Site Specific me... | Deoxyribonucleases AND Type II Site Specific m... | NaN | A Programmable Dual RNA Guided DNA Endonucleas... | 2012-06-23 | JSS50060 |
| 2 | Wakefield | Wakefield | Developmental Disabilities etiology OR Child ... | Developmental Disabilities etiology AND Child... | NaN | Ileal lymphoid nodular hyperplasia non specif... | 1998-01-01 | JSS48881 |
3. Iteratively Query the Dimensions API for each row of the RejectedArticles sheet.#
This section iteratively populates and executes an API call (example below) for each row in the RejArt dataframe.
This leverages Dimensions’ full-text, fuzzy search to search the Publications dataset for the Rejected Title or Keywords.
Results are limited to articles that were published after the rejected date by both the first and corresponding authors together.
Since the fuzzy search will result in multiple possible matches, we keep only the most relevant match for each searched row. Finding the exact title phrase will earn a higher score than finding a match for just the keywords; the score also factors in where the terms are found - matches in the abstract or title fields will get higher scores than matches in the body of the publication.
The results of the calls are accumulated in a single dataframe and tagged with the ManuscriptID associated with the search values.
Query Example: search publications for “Microtubule-dependent and independent roles of spastin in lipid droplet dispersion and biogenesis” or for “(Cytoskeleton AND Membrane AND lipid biology AND Disease AND Metabolism AND In vitro AND Rodent)” where ((authors = “Tadepalle” and authors = “Rugarli” and date_print > “2020-03-24”) or (authors = “Tadepalle” and authors = “Rugarli” and date_print is empty)) and type = “article” return publications[id+authors+authors_count+title+date_print+journal+times_cited+altmetric+recent_citations+field_citation_ratio+relative_citation_ratio+score] sort by score limit 1
[8]:
#RejArt = RejArt.head(10) ##For Testing, limit the dataset to a few records- comment this line out to analyze the entire input file
TitlesFoundRaw = pd.DataFrame()
RejArtRecCount= len(RejArt)
RunTime = "{:.2f}".format(RejArtRecCount * 5 / 60)
LoopNo = 0
print("This should take approximately ",RunTime," minutes to complete.")
query_template = """
search publications
for "{}"
or for "({})"
where ((authors = "{}" and authors = "{}" and date_print > "{}") or (authors = "{}" and authors = "{}" and date_print is empty))
and type = "article"
return publications[id+authors+authors_count+title+date_print+journal+publisher+
times_cited+altmetric+recent_citations+field_citation_ratio+
relative_citation_ratio+score]
sort by score limit 1
"""
for index, row in RejArt.iterrows():
First_Author = row['FALast']
Corr_Author = row['CALast']
Keywords = row['Keywords_And']
Title = dsl_escape(row['Title'], True)
RejDate = row['Date of Rejection']
ManuscriptID = row['Manuscript ID']
LoopNo = (LoopNo + 1)
data = pd.DataFrame()
print("*****Loop ",LoopNo," of ",RejArtRecCount, Title, Keywords, First_Author, Corr_Author, RejDate, "***************************************")
try:
q = query_template.format(Title, Keywords, First_Author, Corr_Author, RejDate,First_Author, Corr_Author)
#print(q)
data = dsl.query(q).as_dataframe()
data['Reject_ManID'] = ManuscriptID
except Exception as e:
# Handle the error by creating the 'data' DataFrame with the 'Reject_ManID' and error flag
data = pd.DataFrame({'Reject_ManID': [ManuscriptID], 'id': ['error']})
TitlesFoundRaw = pd.concat([TitlesFoundRaw, data])
time.sleep(.33) # Seconds
#print(q)
TitlesFoundRaw.assign(authors='Suppressed/Abridged').head(1)
This should take approximately 1.42 minutes to complete.
*****Loop 1 of 17 Erythrodiol 3 acetate pentacyclic triterpenoid from Styrax japonica expressions of matrix metalloproteinase in cultured human fibroblasts Humans AND Enzyme Inhibitors isolation purification AND Skin cytology AND Gene Expression Regulation AND Enzymologic physiology AND Skin enzymology AND Acetates chemistry AND Triterpenes chemistry AND Triterpenes isolation purification AND Acetates isolation purification AND Styrax AND Cells AND Cultured AND Fibroblasts drug effects AND Plant Extracts isolation purification AND Oleanolic Acid analogs derivatives AND Male AND Enzyme Inhibitors pharmacology AND Matrix Metalloproteinase 1 biosynthesis AND Fibroblasts enzymology AND Skin drug effects AND Acetates pharmacology AND Child AND Preschool AND Child AND Gene Expression Regulation AND Enzymologic drug effects AND Matrix Metalloproteinase Inhibitors AND Oleanolic Acid pharmacology AND Triterpenes pharmacology AND Matrix Metalloproteinase 2 biosynthesis AND Oleanolic Acid chemistry AND Plant Extracts chemistry AND Plant Stems AND Oleanolic Acid isolation purification AND Enzyme Inhibitors chemistry AND Plant Extracts pharmacology Moon Chung 2001-04-01 ***************************************
Returned Publications: 1 (total = 6)
Time: 3.98s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 2 of 17 A Programmable Dual RNA Guided DNA Endonuclease in Adaptive Bacterial Immune Deoxyribonucleases AND Type II Site Specific metabolism AND Deoxyribonucleases AND Type II Site Specific genetics AND Inverted Repeat Sequences AND Streptococcus pyogenes enzymology AND Plasmids metabolism AND Deoxyribonucleases AND Type II Site Specific chemistry AND DNA Breaks AND Double Stranded AND Molecular Sequence Data AND RNA metabolism AND Streptococcus pyogenes physiology AND Nucleic Acid Conformation AND Base Sequence AND Bacteriophages immunology AND DNA Cleavage AND RNA chemistry Jinek Fonfara 2012-06-23 ***************************************
Returned Publications: 1 (total = 1)
Time: 1.77s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 3 of 17 Ileal lymphoid nodular hyperplasia non specific colitis and pervasive developmental disease in children Developmental Disabilities etiology AND Child AND Humans AND Vaccines AND Combined adverse effects AND Male AND Mumps Vaccine adverse effects AND Child AND Preschool AND Hyperplasia pathology AND Lymphoid Tissue pathology AND Female AND Measles complications AND Measles Mumps Rubella Vaccine AND Otitis Media complications AND Ileum pathology AND Rubella Vaccine adverse effects AND Measles Vaccine adverse effects AND Enterocolitis etiology Wakefield Wakefield 1998-01-01 ***************************************
Returned Publications: 1 (total = 19)
Time: 1.73s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 4 of 17 Suppression of RNA Recognition by Toll like Receptors The Impact of Nucleoside Modification and the Evolutionary Origin of RNA Dendritic Cells metabolism AND Signal Transduction physiology AND Toll Like Receptor 7 AND Humans AND Toll Like Receptor 3 AND Signal Transduction genetics AND Nucleosides metabolism AND Toll Like Receptor 8 AND RNA antagonists inhibitors AND Immunoglobulins immunology AND Cytokines metabolism AND Biomarkers AND Receptors AND Cell Surface physiology AND Evolution AND Molecular AND Dendritic Cells drug effects AND HLA DR Antigens immunology AND Toll Like Receptors AND Dendritic Cells immunology AND CD83 Antigen AND Membrane Glycoproteins immunology AND Phosphatidylethanolamines pharmacology AND RNA metabolism AND Antigens AND CD AND RNA genetics AND Cell Line AND Membrane Glycoproteins physiology Kariko Weissman 2005-07-17 ***************************************
Returned Publications: 1 (total = 12)
Time: 4.85s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 5 of 17 Tracheobronchial transplantation with a stem cell seeded bioartificial nanocomposite a proof of concept study Epoetin Alfa AND Male AND Recombinant Proteins therapeutic use AND Carcinoma AND Mucoepidermoid surgery AND Leukocytes AND Mononuclear metabolism AND Tissue Scaffolds AND Bioreactors AND Blood Vessel Prosthesis AND Bone Marrow Transplantation AND Nanocomposites chemistry AND Neovascularization AND Physiologic AND Adult AND Leukocytes AND Mononuclear transplantation AND Regeneration AND Bronchoscopy AND MicroRNAs metabolism AND Tracheal Neoplasms surgery AND Cell Proliferation AND Polyethylene Terephthalates AND Erythropoietin therapeutic use AND Humans AND Transplantation AND Autologous AND Hematopoietic Stem Cells metabolism AND Tissue Engineering methods AND Neoplasm Recurrence AND Local surgery AND Bronchial Neoplasms surgery AND Flow Cytometry AND Granulocyte Colony Stimulating Factor therapeutic use Macchiarini Jungebluth 2009-10-07 ***************************************
Returned Publications: 1 (total = 12)
Time: 5.58s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 6 of 17 Superconductivity in molecular crystals induced by charged injections molecular crystals AND charge injection AND charge transfer salts Schön Batlogg 1990-06-10 ***************************************
Returned Publications: 1 (total = 1)
Time: 0.93s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 7 of 17 New Stellar Orbits around the Galactic Center Black Hole dark mass AND black hole AND young stars AND m telescope Ghez Ghez 2005-02-06 ***************************************
Returned Publications: 1 (total = 86)
Time: 4.01s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 8 of 17 The Forever Diamond Contrast Reversals Along Thin Edges Create the Appearance of Objects in Motion luminous phase AND modulation AND temporal contrast AND thin edges Flynn Shapiro 2017-05-09 ***************************************
Returned Publications: 0
Time: 12.36s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 9 of 17 Potential Applications to Treat Cancer with Green Synthesis of Metallic Nanoparticles green synthesis AND nanoparticles AND biological entities AND metal nanoparticles Zhang Gu 2019-08-07 ***************************************
Returned Publications: 1 (total = 81)
Time: 0.41s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 10 of 17 Seasonal impact in admissions and burn profiles in a desert burn unit seasonal impact AND pavement burns AND desert climate Saquib Saquib 2020-06-01 ***************************************
Returned Publications: 1 (total = 3)
Time: 0.41s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 11 of 17 Immediate effects of treadmill walking in individuals with Lewy body dementia and Huntington’s disease Lewy Body Disease physiopathology AND Pilot Projects AND Walking physiology AND Humans AND Male AND Treatment Outcome AND Female AND Exercise Therapy AND Huntington Disease physiopathology AND Gait Disorders AND Neurologic therapy AND Middle Aged AND Aged AND 80 AND over AND Feasibility Studies AND Aged Kegelmeyer Kloos 2017-08-08 ***************************************
Returned Publications: 1 (total = 1)
Time: 6.05s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 12 of 17 Overturned abusive head trauma and shaken baby syndrome convictions in the US Prevalence legal basis and medical evidence Prevalence AND Child AND Retrospective Studies AND Craniocerebral Trauma etiology AND Humans AND Craniocerebral Trauma diagnosis AND United States epidemiology AND Shaken Baby Syndrome epidemiology AND Child Abuse diagnosis AND Craniocerebral Trauma epidemiology AND Infant Narang Narang 2021-03-03 ***************************************
Returned Publications: 1 (total = 2)
Time: 5.93s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 13 of 17 Long COVID major findings mechanisms and recommendations Biomedical Research AND Humans AND COVID 19 Testing AND Post Acute COVID 19 Syndrome AND COVID 19 AND Child AND SARS CoV 2 Davis Topol 2020-08-18 ***************************************
Returned Publications: 1 (total = 3)
Time: 0.41s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 14 of 17 Large language models identify functional protein sequences across diverse families Estrogens AND Conjugated USP AND Chorismate Mutase metabolism AND Language AND Proteins genetics AND Amino Acid Sequence Madani Naik 2022-10-31 ***************************************
Returned Publications: 1 (total = 1)
Time: 1.59s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 15 of 17 antiSMASH 7 0 new and improved predictions for detection regulation chemical structures and visualisations Bacteria genetics AND Archaea genetics AND Computers AND Bacteria metabolism AND Multigene Family AND Genome AND Microbial AND Software AND Secondary Metabolism genetics Blin nan 2023-02-25 ***************************************
Returned Publications: 0
Time: 1.74s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 16 of 17 Large language models in medicine Humans AND Technology AND Medicine AND Software AND Artificial Intelligence AND Language Thirunavukarasu Ting 2021-03-25 ***************************************
Returned Publications: 1 (total = 9)
Time: 5.61s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
*****Loop 17 of 17 The impact of omidubicel on immune reconstitution and infections in cord blood transplant patients Transplantation AND Homologous adverse effects AND Fetal Blood AND Hematopoietic Stem Cell Transplantation adverse effects AND Graft vs Host Disease etiology AND Immune Reconstitution AND Cord Blood Stem Cell Transplantation adverse effects AND Humans De Gandhi 2023-07-06 ***************************************
Returned Publications: 1 (total = 1)
Time: 0.58s
WARNINGS [1]
Field current_organization_id of the authors field is deprecated and will be removed in the next major release.
[8]:
| id | title | altmetric | authors | authors_count | date_print | field_citation_ratio | publisher | recent_citations | relative_citation_ratio | score | times_cited | journal.id | journal.title | Reject_ManID | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | pub.1035176145 | RETRACTED: Erythrodiol-3-acetate, pentacyclic ... | 3.0 | Suppressed/Abridged | 6.0 | 2005-03 | 0.57 | Elsevier | 0.0 | 0.1 | 314.91736 | 6.0 | jour.1089348 | Journal of Ethnopharmacology | JSS76145 |
3a - Optional: Pull accepted articles and Union with Search Results#
By pulling the articles you did choose to publish, you can benchmark the metrics of rejected vs. published articles.
[10]:
# pull "accepted" publications by filtering the API call on Journal title, Publisher name or the like and returning the same fields as above
# May require FOR LOOPS to pull complete results
#AcceptedRaw = dsl.query_iterative(f"""
#search publications
#where publisher = "Springer Nature"
#and journal = "jour.1018957"
#and type = "article"
#and year > 2000
#return publications[id+authors+authors_count+title+date_print+journal+publisher+
# times_cited+altmetric+recent_citations+field_citation_ratio+
# relative_citation_ratio+score]""", verbose=True).as_dataframe()
#
#Flag as Accepted instead of using the Rejected ID:
#AcceptedRaw['Reject_ManID'] = "Accepted"
#Combine datasets:
#TitlesFoundRaw = pd.concat([TitlesFoundRaw, AcceptedRaw], ignore_index=True)
#print(len(TitlesFoundRaw))
#TitlesFoundRaw.head(3)
5. Create a Dataframe that places search terms and search results on the same row#
[12]:
#Replace authors field with Authors_FLC created in prior cell:
TitlesFound = TitlesFoundRaw.drop('authors', axis=1)
TitlesFound = pd.merge(
left=TitlesFound,
right=Authors_FLC,
left_on=['id'],
right_on=['id'],
how='left'
)
TitlesFound.head(9)
#Add Prefixes to Dimensions API results and original input file for clarity:
TitlesFound = TitlesFound.add_prefix("Dim_")
RejArtJoiner = RejectedArticles.add_prefix("RA_")
#Join Dimensions results to original input file for comparison
Matched = pd.merge(
left=RejArtJoiner,
right=TitlesFound,
left_on=['RA_Manuscript ID'],
right_on=['Dim_Reject_ManID'],
how='left'
)
#Identify created fields
Matched = Matched.rename({'RA_Keywords_And':'Input_Keywords_And','RA_CALast':'Input_CALast','RA_FALast':'Input_FALast'}, axis=1)
print(len(Matched))
Matched.head(4)
17
Warning: Total number of columns (35) exceeds max_columns (20). Falling back to pandas display.
[12]:
| RA_Manuscript ID | RA_Date of Rejection | RA_Reject Reason | RA_Title | RA_First Author | RA_Corr Author | RA_Co-Authors | RA_Subject Category | RA_Editor | RA_Submitted Journal | RA_Article Type | RA_Keywords | RA_Custom | RA_Funders | RA_Keywords_Or | Input_Keywords_And | Input_FALast | Input_CALast | Dim_id | Dim_title | Dim_altmetric | Dim_authors_count | Dim_date_print | Dim_field_citation_ratio | Dim_publisher | Dim_recent_citations | Dim_relative_citation_ratio | Dim_score | Dim_times_cited | Dim_journal.id | Dim_journal.title | Dim_Reject_ManID | Dim_FirstAuthor | Dim_LastAuthor | Dim_CorrAuthor | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | JSS76145 | 2001-04-01 | Reject Open | Erythrodiol 3 acetate pentacyclic triterpenoi... | Moon, Hyung-In | Chung, Jin Ho | Moon, Hyung-In; Seo, Dong Wan; Kim, Kyu-Han; C... | NaN | Kim, Soo-jin | Science Serial | NaN | Humans, Enzyme Inhibitors/isolation & purifica... | NaN | NaN | Humans OR Enzyme Inhibitors isolation purifi... | Humans AND Enzyme Inhibitors isolation purif... | Moon | Chung | pub.1035176145 | RETRACTED: Erythrodiol-3-acetate, pentacyclic ... | 3.0 | 6.0 | 2005-03 | 0.57 | Elsevier | 0.0 | 0.10 | 314.917360 | 6.0 | jour.1089348 | Journal of Ethnopharmacology | JSS76145 | Moon | Chung | Moon,Chung |
| 1 | JSS50060 | 2012-06-23 | Reject Open | A Programmable Dual RNA Guided DNA Endonucleas... | Jinek, Martin | Fonfara, I | Jinek, Martin; Chylinski, Krzysztof; Fonfara, ... | NaN | Garcia, Luis | Science Serial | NaN | Deoxyribonucleases, Type II Site-Specific/meta... | NaN | NaN | Deoxyribonucleases OR Type II Site Specific me... | Deoxyribonucleases AND Type II Site Specific m... | Jinek | Fonfara | pub.1041850060 | A Programmable Dual-RNA–Guided DNA Endonucleas... | 4390.0 | 6.0 | 2012-08-17 | 1097.75 | American Association for the Advancement of Sc... | 3442.0 | 272.63 | 121.100395 | 14223.0 | jour.1346339 | Science | JSS50060 | Jinek | Charpentier | |
| 2 | JSS48881 | 1998-01-01 | EDREJECT | Ileal lymphoid nodular hyperplasia non specif... | Wakefield, AJ | Wakefield, AJ | Wakefield, AJ; Murch, SH; Anthony, A; Linnell,... | NaN | Patel, Priya | Chemistry Compendium | NaN | Developmental Disabilities/etiology*, Child, H... | NaN | NaN | Developmental Disabilities etiology OR Child ... | Developmental Disabilities etiology AND Child... | Wakefield | Wakefield | pub.1047248881 | RETRACTED: Ileal-lymphoid-nodular hyperplasia,... | 4690.0 | 13.0 | 1998-02 | NaN | Elsevier | 196.0 | 36.24 | 171.698400 | 2328.0 | jour.1077219 | The Lancet | JSS48881 | Wakefield | Walker-Smith | Wakefield |
| 3 | JSS76940 | 2005-07-17 | Reject Open | Suppression of RNA Recognition by Toll like Re... | Kariko, Katalin | Weissman, Drew | Karikó, Katalin; Buckstein, Michael; Ni, Houpi... | NaN | Garcia, Luis | Science Serial | NaN | Dendritic Cells/metabolism, Signal Transductio... | NaN | NaN | Dendritic Cells metabolism OR Signal Transduct... | Dendritic Cells metabolism AND Signal Transduc... | Kariko | Weissman | pub.1047376940 | Suppression of RNA Recognition by Toll-like Re... | 3388.0 | 4.0 | 2005-08 | 164.50 | Elsevier | 724.0 | 25.73 | 193.518800 | 1957.0 | jour.1112054 | Immunity | JSS76940 | Karikó | Weissman | Karikó |
6. Retrieve Journal attributes and add to Dataframe#
[13]:
##Make a second call to get Journal Attributes and join to main table:
JournalList = Matched['Dim_journal.id'].dropna().tolist()
JournalList = list(dict.fromkeys(JournalList))
print(JournalList)
ChunkNumber = 1
ChunkSize = 50 #<-- If you get an error, reduce this number. Max is 500; 200 is a great starting point.
TotalChunks = round(0.5+(len(JournalList)/ChunkSize))
# Find publications that cited the list above
q = """search source_titles where id in {}
return source_titles[id+title+snip+sjr+issn+start_year+journal_lists]"""
results = []
for chunk in (list(chunks_of(list(JournalList), ChunkSize))):
print("Working on Chunk #",(ChunkNumber)," of ",TotalChunks)
ChunkNumber = ChunkNumber+1
data = dsl.query_iterative(q.format(json.dumps(chunk)), verbose=False)
results += data.source_titles
time.sleep(1)
Journals = pd.DataFrame().from_dict(results)
print("Publications found: ", len(Journals))
Journals.drop_duplicates(subset='id', inplace=True)
print("Unique publications found: ", len(Journals))
Journals = Journals.add_prefix("Jour_")
Journals.head(5)
Matched = pd.merge(
left=Matched,
right=Journals,
left_on=['Dim_journal.id'],
right_on=['Jour_id'],
how='left'
)
Matched.head(9)
['jour.1089348', 'jour.1346339', 'jour.1077219', 'jour.1112054', 'jour.1018957', 'jour.1134140', 'jour.1049812', 'jour.1299119', 'jour.1105222', 'jour.1087229', 'jour.1032854', 'jour.1115214', 'jour.1113716', 'jour.1029779']
Working on Chunk # 1 of 1
Publications found: 14
Unique publications found: 14
Warning: Total number of columns (42) exceeds max_columns (20). Falling back to pandas display.
[13]:
| RA_Manuscript ID | RA_Date of Rejection | RA_Reject Reason | RA_Title | RA_First Author | RA_Corr Author | RA_Co-Authors | RA_Subject Category | RA_Editor | RA_Submitted Journal | RA_Article Type | RA_Keywords | RA_Custom | RA_Funders | RA_Keywords_Or | Input_Keywords_And | Input_FALast | Input_CALast | Dim_id | Dim_title | Dim_altmetric | Dim_authors_count | Dim_date_print | Dim_field_citation_ratio | Dim_publisher | Dim_recent_citations | Dim_relative_citation_ratio | Dim_score | Dim_times_cited | Dim_journal.id | Dim_journal.title | Dim_Reject_ManID | Dim_FirstAuthor | Dim_LastAuthor | Dim_CorrAuthor | Jour_id | Jour_issn | Jour_journal_lists | Jour_sjr | Jour_snip | Jour_start_year | Jour_title | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | JSS76145 | 2001-04-01 | Reject Open | Erythrodiol 3 acetate pentacyclic triterpenoi... | Moon, Hyung-In | Chung, Jin Ho | Moon, Hyung-In; Seo, Dong Wan; Kim, Kyu-Han; C... | NaN | Kim, Soo-jin | Science Serial | NaN | Humans, Enzyme Inhibitors/isolation & purifica... | NaN | NaN | Humans OR Enzyme Inhibitors isolation purifi... | Humans AND Enzyme Inhibitors isolation purif... | Moon | Chung | pub.1035176145 | RETRACTED: Erythrodiol-3-acetate, pentacyclic ... | 3.0 | 6.0 | 2005-03 | 0.57 | Elsevier | 0.0 | 0.10 | 314.917360 | 6.0 | jour.1089348 | Journal of Ethnopharmacology | JSS76145 | Moon | Chung | Moon,Chung | jour.1089348 | [0378-8741, 1872-7573] | [Norwegian register level 1, ERA 2018, UGC Jou... | 0.936 | 1.55 | 1978.0 | Journal of Ethnopharmacology |
| 1 | JSS50060 | 2012-06-23 | Reject Open | A Programmable Dual RNA Guided DNA Endonucleas... | Jinek, Martin | Fonfara, I | Jinek, Martin; Chylinski, Krzysztof; Fonfara, ... | NaN | Garcia, Luis | Science Serial | NaN | Deoxyribonucleases, Type II Site-Specific/meta... | NaN | NaN | Deoxyribonucleases OR Type II Site Specific me... | Deoxyribonucleases AND Type II Site Specific m... | Jinek | Fonfara | pub.1041850060 | A Programmable Dual-RNA–Guided DNA Endonucleas... | 4390.0 | 6.0 | 2012-08-17 | 1097.75 | American Association for the Advancement of Sc... | 3442.0 | 272.63 | 121.100395 | 14223.0 | jour.1346339 | Science | JSS50060 | Jinek | Charpentier | jour.1346339 | [0036-8075, 1095-9203] | [Nature Index journals, ERA 2018, UGC Journal ... | 11.900 | 9.28 | 1880.0 | Science | |
| 2 | JSS48881 | 1998-01-01 | EDREJECT | Ileal lymphoid nodular hyperplasia non specif... | Wakefield, AJ | Wakefield, AJ | Wakefield, AJ; Murch, SH; Anthony, A; Linnell,... | NaN | Patel, Priya | Chemistry Compendium | NaN | Developmental Disabilities/etiology*, Child, H... | NaN | NaN | Developmental Disabilities etiology OR Child ... | Developmental Disabilities etiology AND Child... | Wakefield | Wakefield | pub.1047248881 | RETRACTED: Ileal-lymphoid-nodular hyperplasia,... | 4690.0 | 13.0 | 1998-02 | NaN | Elsevier | 196.0 | 36.24 | 171.698400 | 2328.0 | jour.1077219 | The Lancet | JSS48881 | Wakefield | Walker-Smith | Wakefield | jour.1077219 | [0140-6736, 1474-547X] | [ERA 2018, UGC Journal List Group II, VABB-SHW... | 12.100 | 33.70 | 1823.0 | The Lancet |
| 3 | JSS76940 | 2005-07-17 | Reject Open | Suppression of RNA Recognition by Toll like Re... | Kariko, Katalin | Weissman, Drew | Karikó, Katalin; Buckstein, Michael; Ni, Houpi... | NaN | Garcia, Luis | Science Serial | NaN | Dendritic Cells/metabolism, Signal Transductio... | NaN | NaN | Dendritic Cells metabolism OR Signal Transduct... | Dendritic Cells metabolism AND Signal Transduc... | Kariko | Weissman | pub.1047376940 | Suppression of RNA Recognition by Toll-like Re... | 3388.0 | 4.0 | 2005-08 | 164.50 | Elsevier | 724.0 | 25.73 | 193.518800 | 1957.0 | jour.1112054 | Immunity | JSS76940 | Karikó | Weissman | Karikó | jour.1112054 | [1074-7613, 1097-4180] | [Nature Index journals, ERA 2018, UGC Journal ... | 13.600 | 6.84 | 1984.0 | Immunity |
| 4 | JSS61136 | 2009-10-07 | EDREJECT | Tracheobronchial transplantation with a stem c... | Macchiarini, Paolo | Jungebluth, P. | Jungebluth, Philipp; Alici, Evren; Baiguera, S... | NaN | Kim, Soo-jin | Chemistry Compendium | NaN | Epoetin Alfa, Male, Recombinant Proteins/thera... | NaN | NaN | Epoetin Alfa OR Male OR Recombinant Proteins t... | Epoetin Alfa AND Male AND Recombinant Proteins... | Macchiarini | Jungebluth | pub.1049161136 | RETRACTED: Tracheobronchial transplantation wi... | 243.0 | 24.0 | 2011-12 | 104.28 | Elsevier | 10.0 | 9.83 | 222.500670 | 395.0 | jour.1077219 | The Lancet | JSS61136 | Jungebluth | Macchiarini | Macchiarini | jour.1077219 | [0140-6736, 1474-547X] | [ERA 2018, UGC Journal List Group II, VABB-SHW... | 12.100 | 33.70 | 1823.0 | The Lancet |
| 5 | JSS62519 | 1990-06-10 | Reject | Superconductivity in molecular crystals induce... | Schön, J. H. | Batlogg, B. | Schön, J. H.; Kloc, Ch.; Batlogg, B. | NaN | Patel, Priya | Medical Monthly | NaN | molecular crystals, charge injection, charge-t... | NaN | NaN | molecular crystals OR charge injection OR char... | molecular crystals AND charge injection AND ch... | Schön | Batlogg | pub.1050062519 | RETRACTED ARTICLE: Superconductivity in molecu... | 9.0 | 3.0 | 2000-08-17 | 29.45 | Springer Nature | 2.0 | 0.91 | 14.369866 | 151.0 | jour.1018957 | Nature | JSS62519 | Schön | Batlogg | Batlogg | jour.1018957 | [0028-0836, 1476-4687] | [Nature Index journals, ERA 2018, UGC Journal ... | 18.500 | 11.60 | 1869.0 | Nature |
| 6 | JSS15074 | 2005-02-06 | Reject Open | New Stellar Orbits around the Galactic Center ... | Ghez, A. M. | Ghez, A. M. | Ghez, A. M.; Salim, S.; Hornstein, S. D.; Tann... | NaN | Smith, John | Medical Monthly | NaN | dark mass, black hole, young stars, m telescope | NaN | NaN | dark mass OR black hole OR young stars OR m te... | dark mass AND black hole AND young stars AND m... | Ghez | Ghez | pub.1046439810 | Stellar Dynamics at the Galactic Center with a... | 3.0 | 3.0 | 2005-04 | 18.51 | American Astronomical Society | 6.0 | NaN | 40.507088 | 110.0 | jour.1134140 | The Astrophysical Journal | JSS15074 | Weinberg | Ghez | jour.1134140 | [0004-637X, 1538-4357] | [DOAJ, ERA 2018, UGC Journal List Group II, No... | 1.910 | 1.15 | 1895.0 | The Astrophysical Journal | |
| 7 | JSS42224 | 2017-05-09 | Reject and Refer without Review | The Forever Diamond Contrast Reversals Along ... | Flynn, Oliver J. | Shapiro, Arthur | Flynn, Oliver J.; Shapiro, Arthur Gene | NaN | Garcia, Luis | Science Serial | NaN | luminous phase, modulation, temporal contrast,... | NaN | NaN | luminous phase OR modulation OR temporal contr... | luminous phase AND modulation AND temporal con... | Flynn | Shapiro | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 8 | JSS35047 | 2019-08-07 | Reject and Refer without Review | Potential Applications to Treat Cancer with Gr... | Zhang, Dan | Gu, Yan | Zhang, Dan; Ma, Xin-lei; Gu, Yan; Huang, He; Z... | NaN | Patel, Priya | Chemistry Compendium | NaN | green synthesis, nanoparticles, biological ent... | NaN | NaN | green synthesis OR nanoparticles OR biological... | green synthesis AND nanoparticles AND biologic... | Zhang | Gu | pub.1132135047 | RETRACTED: Green Synthesis of Metallic Nanopar... | 1.0 | 5.0 | NaN | NaN | Frontiers | 228.0 | 12.40 | 35.232506 | 396.0 | jour.1049812 | Frontiers in Chemistry | JSS35047 | Zhang | Zhang | Zhang | jour.1049812 | [2296-2646] | [Norwegian register level 1, DOAJ, UGC Journal... | 0.818 | 1.05 | 2012.0 | Frontiers in Chemistry |
7. Add Matching Score#
At this point we have a dataframe with our rejected articles paired with the metadata for the Dimensions publication that most closely resembles each.
However, the best match isn’t necessarily an actual match, so you must add a review process before analyzing or drawing any conclusions from this dataframe. In this section, we will quantify the quality of the match to aid in this review process. Levenshtein’s ratio measures the similarity between two strings (in this case the search title and the found title) by calculating the minimum number of edits (insertions, deletions, or substitutions) needed to transform one string into the other. The lev.ratio function normalizes this distance and returns a score from 0 to 100, with higher scores indicating closer matches. This score appears in the dataframe as TitleRatio.
By scanning the results and considering the volume of data you’re working with, your level of patience and your tolerance for false positives/negatives, you can make a business decision to accept any matches above a particular score or to use the score to streamline any human validation process.
[14]:
import Levenshtein as lev
Matched['TitleRatio'] = Matched.dropna(subset=['RA_Title', 'Dim_title']).apply(
lambda x: lev.ratio(x.RA_Title, x.Dim_title) * 100, axis=1)
Matched['FirstAuthorRatio'] = Matched.dropna(subset=['RA_First Author', 'Dim_FirstAuthor']).apply(
lambda x: lev.ratio(x['Input_FALast'], x['Dim_FirstAuthor']) * 100, axis=1)
Matched['CorrAuthorRatio'] = Matched.dropna(subset=['RA_Corr Author', 'Dim_CorrAuthor']).apply(
lambda x: lev.ratio(x['Input_CALast'], x['Dim_CorrAuthor']) * 100, axis=1)
print(len(Matched))
Matched.head(3)
[14]:
| RA_Manuscript ID | RA_Date of Rejection | RA_Reject Reason | RA_Title | RA_First Author | RA_Corr Author | RA_Co-Authors | RA_Subject Category | RA_Editor | RA_Submitted Journal | RA_Article Type | RA_Keywords | RA_Custom | RA_Funders | RA_Keywords_Or | Input_Keywords_And | Input_FALast | Input_CALast | Dim_id | Dim_title | Dim_altmetric | Dim_authors_count | Dim_date_print | Dim_field_citation_ratio | Dim_publisher | Dim_recent_citations | Dim_relative_citation_ratio | Dim_score | Dim_times_cited | Dim_journal.id | Dim_journal.title | Dim_Reject_ManID | Dim_FirstAuthor | Dim_LastAuthor | Dim_CorrAuthor | Jour_id | Jour_issn | Jour_journal_lists | Jour_sjr | Jour_snip | Jour_start_year | Jour_title | TitleRatio | FirstAuthorRatio | CorrAuthorRatio | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | JSS76145 | 2001-04-01 | Reject Open | Erythrodiol 3 acetate pentacyclic triterpenoi... | Moon, Hyung-In | Chung, Jin Ho | Moon, Hyung-In; Seo, Dong Wan; Kim, Kyu-Han; C... | NaN | Kim, Soo-jin | Science Serial | NaN | Humans, Enzyme Inhibitors/isolation & purifica... | NaN | NaN | Humans OR Enzyme Inhibitors isolation purifi... | Humans AND Enzyme Inhibitors isolation purif... | Moon | Chung | pub.1035176145 | RETRACTED: Erythrodiol-3-acetate, pentacyclic ... | 3.0 | 6.0 | 2005-03 | 0.57 | Elsevier | 0.0 | 0.10 | 314.917360 | 6.0 | jour.1089348 | Journal of Ethnopharmacology | JSS76145 | Moon | Chung | Moon,Chung | jour.1089348 | [0378-8741, 1872-7573] | [Norwegian register level 1, ERA 2018, UGC Jou... | 0.936 | 1.55 | 1978.0 | Journal of Ethnopharmacology | 90.604027 | 100.0 | 66.666667 |
| 1 | JSS50060 | 2012-06-23 | Reject Open | A Programmable Dual RNA Guided DNA Endonucleas... | Jinek, Martin | Fonfara, I | Jinek, Martin; Chylinski, Krzysztof; Fonfara, ... | NaN | Garcia, Luis | Science Serial | NaN | Deoxyribonucleases, Type II Site-Specific/meta... | NaN | NaN | Deoxyribonucleases OR Type II Site Specific me... | Deoxyribonucleases AND Type II Site Specific m... | Jinek | Fonfara | pub.1041850060 | A Programmable Dual-RNA–Guided DNA Endonucleas... | 4390.0 | 6.0 | 2012-08-17 | 1097.75 | American Association for the Advancement of Sc... | 3442.0 | 272.63 | 121.100395 | 14223.0 | jour.1346339 | Science | JSS50060 | Jinek | Charpentier | jour.1346339 | [0036-8075, 1095-9203] | [Nature Index journals, ERA 2018, UGC Journal ... | 11.900 | 9.28 | 1880.0 | Science | 94.805195 | 100.0 | 0.000000 | |
| 2 | JSS48881 | 1998-01-01 | EDREJECT | Ileal lymphoid nodular hyperplasia non specif... | Wakefield, AJ | Wakefield, AJ | Wakefield, AJ; Murch, SH; Anthony, A; Linnell,... | NaN | Patel, Priya | Chemistry Compendium | NaN | Developmental Disabilities/etiology*, Child, H... | NaN | NaN | Developmental Disabilities etiology OR Child ... | Developmental Disabilities etiology AND Child... | Wakefield | Wakefield | pub.1047248881 | RETRACTED: Ileal-lymphoid-nodular hyperplasia,... | 4690.0 | 13.0 | 1998-02 | NaN | Elsevier | 196.0 | 36.24 | 171.698400 | 2328.0 | jour.1077219 | The Lancet | JSS48881 | Wakefield | Walker-Smith | Wakefield | jour.1077219 | [0140-6736, 1474-547X] | [ERA 2018, UGC Journal List Group II, VABB-SHW... | 12.100 | 33.70 | 1823.0 | The Lancet | 87.782805 | 100.0 | 100.000000 |
8. Export for Analysis or dashboard feed:#
[15]:
DimensionsRAExport = Matched
# Export the DataFrame to an Excel file
file_name = "DimensionsRAExport.xlsx"
DimensionsRAExport.to_excel(file_name, index=False)
if 'google.colab' in sys.modules:
files.download(file_name)
[16]:
#Alternative .csv export
DimensionsRAExport = Matched
file_name = "DimensionsRAExport.csv"
DimensionsRAExport.to_csv(file_name, index=False)
if 'google.colab' in sys.modules:
files.download(file_name)
9. Conclusion#
In this tutorial we have used the fuzzy, full-text capability of the Dimensions API to identify the final outcome of rejected articles. Our next steps would be to evaluate the bibliometrics of these publications and use the results of that analysis to inform future accept/reject decisions.
Note
The Dimensions Analytics API allows to carry out sophisticated research data analytics tasks like the ones described on this website. Check out also the associated Github repository for examples, the source code of these tutorials and much more.