Giter VIP home page Giter VIP logo

pubmed-fetch-rb's Introduction

Pubmed Fetcher in Ruby

This is a small Ruby application for calling Pubmed APIs and storing abstracts in a local database. This app is written to be part of the BioNaVisT project, and may change to fit into its infrastructure. However, it could still be ran on as a standalone application, and may serve as an example of a lightweight and scalable Ruby application.

Tech Stack

  • Ruby
  • ActiveRecord
    • provides a simple ORM that I use to store with minimal fuss
  • PostgreSQL
    • any relational database works fine
    • can be easily swapped to other databases by installing gems

Usage

Make sure the tech stack is on your computer, and create a database in Postgres. I named mine crea.

Also configure main.rb to your database's credentials.

The initial run:

psql -U postgres -d crea < db/db_def.sql          # import database tables
bundle install                                    # install all required gems
ruby main.rb                                      # run application

It may be useful to keep track of logs:

tail -f -n100 fetch.log

Furthermore, you can keep track of the number of entries in the database already with this command:

watch -n 0.3 "psql -U postgres -d crea -c \"SELECT count(*) FROM pubmed_abstracts;\""

Details

  • The application runs by looking up, one by one, the terms inside docs/terms. Adjust the file accordingly.
  • The schema is:
    id, pmid, title, authors, search_term, section_name, section_body
    
    
    If an abstract has separate sections, they will be stored as separate entries. Otherwise, it will be stored as one entry with the section_name as "ALL".
  • There are some abstracts that are neglected as being unsuccessful, because the body does not exist, or was not recognized. The recognition uses some basic regular expressions to match certain parts of the abstract, and may not be perfect.

pubmed-fetch-rb's People

Contributors

wintermelons avatar

Watchers

James Cloos avatar  avatar

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.