Code Monkey home page Code Monkey logo

vivo-on-rails's Introduction

VIVO on Rails

This is the code for the new VIVO front-end for Researchers@Brown. This is a Ruby on Rails application that searches directly against the VIVO's Solr index. See the General Architecture information below for more details.

Pre-requisites

You need to have Solr running. We use the Solr index that VIVO provides out of the box but we have added several fields needed by this project. See Solr Index section below.

We are currently using Ruby 2.7.1, Rails 6.0.3, and MySQL.

brew install ruby-install
brew install chruby
ruby-install ruby 2.7.1
source /usr/local/opt/chruby/share/chruby/chruby.sh
chruby 2.7.1
brew install mysql
gem install bundle

To get started

git https://github.com/Brown-University-Library/vivo-on-rails.git
cd vivo-on-rails
source .env_sample
bundle config set path 'vendor/bundle'
bundle install
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rails server

Update the values in .env_sample to match the URLs where Solr is running in your environment.

General Architecture

This is a Ruby on Rails web site that shows faculty information stored in Solr. All searches and retrieval of information are done against Solr.

In the future, access to the Fuseki triple store will be used to perform linked data queries and other visualizations.

A few diagrams on how the project is structure can be found here

Solr Index

The site assumes that the Solr index has Faculty information stored in a structure like the following:

  {
    id: "http://vivo.brown.edu/individual/jane_researcher",
    record_type: "PEOPLE",
    affiliations: ["dept1", "dept2", ... "deptN"],
    research_areas":["r1", "r2", "r3", ... "rN"],
    json_txt: "# string representation of a JSON object with the all the data (see below)"
  }

Below is a sample of the data stored in json_txt for a sample PEOPLE document. Notice that the field is a string with the JSON of the data for the given document.

"{
  \"record_type\":\"PEOPLE\",
  \"affiliations_text\":\"\",
  \"affiliations\":[
    {
      \"uri\":\"http://vivo.brown.edu/individual/org-brown-univ-dept57\",
      \"name\":\"Pathology and Laboratory Medicine\",
      \"id\":\"http://vivo.brown.edu/individual/org-brown-univ-dept57\"
    }
  ],
  \"awards\":\"\",
  \"collaborators\":[],
  \"contributor_to\":[],
  \"education\":[
    {
      \"school_uri\":\"http://vivo.brown.edu/individual/n37819\",
      \"date\":\"1980\",
      \"degree\":\"BA\",
      \"school_name\":\"Mount Holyoke College\"
    },
    {
      \"school_uri\":\"http://vivo.brown.edu/individual/n67738\",
      \"date\":\"1985\",
      \"degree\":\"MD\",
      \"school_name\":\"State University of New York\"
    }
  ],
  \"email\":\"[email protected]\",
  \"funded_research\":\"\",
  \"name\":\"Hansen, Katrine\",
  \"org_label\":\"Pathology and Laboratory Medicine\",
  \"overview\":\"\",
  \"research_overview\":\"\",
  \"research_statement\":\"\",
  \"scholarly_work\":\"\",
  \"teacher_for\":[],
  \"teaching_overview\":\"\",
  \"title\":\"Associate Professor of Pathology and Laboratory Medicine\",
  \"thumbnail\":null,
  \"research_areas\":[],
  \"uri\":\"http://vivo.brown.edu/individual/khansenm\",
  \"id\":\"http://vivo.brown.edu/individual/khansenm\"
}"

Organization records follow a similar pattern.

  {
    id: "http://vivo.brown.edu/individual/some-org-id",
    record_type: "ORGANIZATION",
    json_txt: "# string representation of a JSON object with the all the data (see below)"
  }

Below is a sample of the data stored in json_txt for a sample ORGANIZATION. Notice that the field is a string with the JSON of the data for the given document.

"{
  \"record_type\":\"ORGANIZATION\",
  \"uri\":\"http://vivo.brown.edu/individual/org-brown-univ-dept57\",
  \"name\":\"Pathology and Laboratory Medicine\",
  \"overview\":...",
  \"thumbnail\":\"http://vivo.brown.edu/individual/n5457\",
  \"people\":[
  {
    \"id\":\"http://vivo.brown.edu/individual/khansenm\",
    \"uri\":\"http://vivo.brown.edu/individual/khansenm\",
    \"label\":\"Hansen, Katrine\",
    \"specific_position\":\"Associate Professor of Pathology and Laboratory Medicine\",
    \"general_position\":\"Faculty Position\"
  },
  {
    \"id\":\"http://vivo.brown.edu/individual/elaposat\",
    \"uri\":\"http://vivo.brown.edu/individual/elaposat\",
    \"label\":\"\",
    \"specific_position\":\"Clinical Associate Professor of Pathology and Laboratory Medicine\",
    \"general_position\":\"Faculty Position\"
  }]
}

We use json_txt to reconstruct the data that will be displayed when the user wants to view the detail for a specific individual or organization. This is what allows us to run the system without interfacing with the Fuseki endpoint.

TODO: We still need to create individual fields in Solr to allow for a better search experience, for example, a separate field for name to give it a higher boost on search results and the ability to facet the data by other fields.

Caveats

The code at this point is hard-coded for very specific predicates that we use at Brown and might not work on your particular VIVO database.

The unit tests (bundle exec rake vivo:tests) are hard-coded to find very specific people/departments so they will very likely fail on your installation.

vivo-on-rails's People

Contributors

bcail avatar bentbul avatar birkin avatar cbrusch avatar dependabot[bot] avatar hectorcorrea avatar jmanc avatar jrhoads avatar justinuhr avatar katrinleinweber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vivo-on-rails's Issues

Visualization - general tweaks

The entire content of the visualizations is flushed to the left side of the screen, it would be nice if there was a margin on the left. (see arrow 1 in screenshot)

It would be nice if the researcher name (Audrey Tyrka) also had the bar with the color of the department as the department name does (see arrow 2 below)

It would be nice if the buttons to select the visualization were the same size (see arrow 3 below)

Code:
https://github.com/Brown-University-Library/vivo-on-rails/blob/master/app/views/visualization/collab.html.erb (it really applies to all the views under app/views/visualization)

screen shot 2018-08-20 at 2 28 37 pm

What is VIZ_SERVICE_URL meant to be?

I'm attempting to develop graph visualizations for a new web application representing scholarship located at the Ibero-Amerikanisches Institut (Ibero-American Institute) Preußischer Kulturbesitz in Berlin, Germany.

Since it is our goal to integrate graph visualization functionality using d3.js into a web frontend we develop ourselves and use VIVO as a backend in order to feed that frontend, we stumbled across VIVO on Rails, which we thought of using as some kind of blueprint. However, we're going to use Laravel as the web framework rather than Ruby on Rails. Now I'm trying to figure out how it all works together :)

As far as I believe having understood up to now the data to be displayed in the graph is being retrieved in the form of a JSON file, which is then being processed by d3.js. For example, this should apply when calling the URL https://vivo.brown.edu/display/chaassko/viz/coauthor in your live system.

But when investigating the Ruby on Rails code provided by you on Github, I'm getting stuck at the moment it comes to the CoauthorGraph.get_data(id) call. There, in app/models/coauthor_graph.rb, line 25, the environment constant ENV['VIZ_SERVICE_URL'] is being used. This is commented out in .env_sample, having a default value of just https://somewhere anyway. But this seems to be the spot where the JSON file actually is being retrieved from.

So what is this VIZ_SERVICE_URL meant to be? Is it supposed to point to an API provided by VIVO out of box, or some third-party software component? I would be very grateful if you could enlighten me a bit :)

Visualization - Show buttons

The "Show Collaborator" and "Show Collaborator's Collaborators" buttons normally display at the top of the page but sometimes, when the screen is too wide, they show at the bottom. It would be nice if they always show at the top regardless of the screen width.

Code: https://github.com/Brown-University-Library/vivo-on-rails/blob/master/app/views/visualization/collab.html.erb

Normal display (buttons are at the top of the screen)
screen shot 2018-08-20 at 2 25 36 pm

Display on a wide screen (buttons are at the bottom of the screen)
screen shot 2018-08-20 at 2 25 22 pm

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.