SiddheshSingh / filter-doi-crossref

Retrieve DOI from searching query on Crossref and save it to csv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

filter-doi-crossref

Python code to retrieve DOI from searching query on Crossref and save it as a CSV File.

Crossref Client

Habanero is used as the Crossref client.

from habanero import Crossref

Procedure

  • The query is searched in Crossref works and is filtered specifically for DOI.
  Crossref().works(query=query,select='DOI')
  • These results are obtained by using Deep Paging Cursors as maximum limit in offset is 10K which is much lesser than total results.
  Crossref().works(query=query,select='DOI',cursor='*')
  • DOIs are then collected in a list which is converted to CSV file using CSV writer.
    Following function converts a list of dictionaries containing 'DOI' as an index to a CSV file:
  def listtocsv(doi,filename):
      import csv
      csvfile = filename
      with open(csvfile, "w") as output:
          writer = csv.writer(output, lineterminator='\n')
          for val in doi:
              writer.writerow([val['DOI']]) 
      return 'Success'

About

Retrieve DOI from searching query on Crossref and save it to csv


Languages

Language:Python 100.0%