Git Product home page Git Product logo

pmcfetchr's Introduction

PMCfetchR - WIP

Why?

This package was developed out of frustration with how long it took me to read through NCBI’s documentation for extracting Open Access Articles Dataset to finally partially understand how to do it. Considering that the FTP service will be discontinued in March 2022 in favor of the new cloud-based access, hosted on and AWS S3 Storage Bucket, I determined this package would utilize the AWS S3 REST API to extract full-text articles. Why? Because they are useful for text-mining/NLP related projects.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("labouz/PMCfetchR")

Getting PMCIDs

The basic structure of the PMC Open Access Subset is as follows:

Notice that the API’s URL requires the PMCID of a specific article you want to retrieve. Let’s say I have identified articles I would like to analyse but only have their PMIDs. I can convert them with the fetch_pmcid() function:

library(PMCfetchR)

my_pmcids <- fetch_pmcid(c("27576877", "29497878", "31652369", "21282321", "31693845"))

What is special about fetch_pmcid() is that you can mix and match what you input. You can pass in a character vector of PMIDs as we did above or a string of individual PMIDs as charachter or integer:

my_pmcids <- fetch_pmcid(27576877, 29497878, "28626478", 21282321, "31693845")

Note that this function will return ‘invalid’ for PMIDs that do not have associated PMCID. This likely means that the corresponding journal has not yet submitted the article’s full text XML (article is < 3 months old) or too old (older than 2005).

Getting Full Text Articles

You can then use the resulting list, or your own vector of PMCIDs, to the fetch_fulltext() function to get a tidied data frame of each article tokenized by sentence.

my_articles_df <- fetch_fulltext(my_pmcids)
#> Article PMC4989593 does not exsist.
#> Article PMC5465829 does not exsist.
#> Article PMC6835137 does not exsist.

The function will print a message to the console if a particular PMCID article is not found in each of the three AWS S3 Bucket directories.

NOTE: Due to copyright, some PMCIDs may only return the Title and Abstract.

Acknowledgements:

Developing this package would be a lot more work if not for the tidypmc package.

Chris Stubben (2021). tidypmc: Parse Full Text XML Documents from PubMed Central. https://docs.ropensci.org/tidypmc, https://github.com/ropensci/tidypmc.

pmcfetchr's People

Contributors

labouz avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

knoxju

pmcfetchr's Issues

fetch_meta()

new function to pull a paper's metadata
title, first author, doi, pmcid or pmid, mesh headings, date published, journal name

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.