Giter Club home page Giter Club logo

civic-server's Introduction

CIViC - Clinical Interpretations of Variants in Cancer

Code Climate DOI

This repository contains the server component of the CIViC. It is a Ruby on Rails application that serves JSON data to power the frontend website and API.

Setup

Developing for CIViC involves setting up a development environment.

To get started quickly, we recommend launching an AWS EC2 instance from our pre-configured and maintained AMI (getting started wiki page). Alternatively, you may set up your own local development environment using the following setup instructions.

Prerequisites

Before attempting to install the CIViC server and client software, you should obtain the following applications and libraries:

  • A relatively modern Ruby (>= 2.1)
    • If your OS doesn't ship with a modern Ruby, you can use rbenv and ruby-build to obtain it.
  • Postgres
  • NodeJS
  • npm
  • libxml2
  • libxslt
  • libpq-dev
  • openssl

On OSX with homebrew, this should install the needed library dependencies:

brew install libxml2 libxslt openssl postgres node

Installation

The following will set up the server side application and load the database schema.

git clone https://github.com/griffithlab/civic-server.git
cd civic-server
gem install bundler
rbenv rehash
bundle install
rbenv rehash
rake db:create
rake db:migrate

For convenience, a sanitized version of a recent database backup is provided for your local development environment. You can load it with the following command:

rake civic:load[force]

Finally, start the CIViC rails server

rails s

If you only intend to do server development, you can stop here. The server repository already contains the most recent production build of the frontend javascript. You can load CIViC in your browser at http://127.0.0.1:3000.

If you intend to develop front end features however, you'll need to set up the client side application using the following:

git clone https://github.com/griffithlab/civic-client.git
cd civic-client
npm install -g bower gulp
npm install
bower install
gulp serve

You should now be able to access the backend server at http://127.0.0.1:3000 and the frontend application at http://127.0.0.1:3001

Note that certain tasks needed by a running instance of CIViC are accomplished by 'background workers'. This includes data release generation as well as notification delivery.

You can start the workers in the background with the following command:

bin/delayed_job start 

If you would prefer the workers to run in the foreground you can start them in a console (rails c) with this command instead:

Delayed::Worker.new.start

Note to make yourself an admin in a local install you can do the following from your civic-server repo. First log into the front end http://127.0.0.1:3001 and sign in with your user. Log into a rails console, run a command that makes you an admin in the db, and exit.

rails c
User.find_by(email: '[email protected]').make_admin!
exit

Now log into the backend admin interface as follows: http://127.0.0.1:3000/admin

Git repositories related to the CIViC project

The CIViC source code and application are organized in a client-server model. The backend code is available in the civic-server repository and frontend code is available in the civic-client repository. Issues relating to curation are tracked in the civic-curation repository. An example of a Python client is available in the civic-api-client repository. Issues relating to public CIViC meetings are tracked in the civic-meeting repository.

civic-server's People

Contributors

acoffman avatar agraubert avatar ahwagner avatar bwalsh avatar chaozhang123 avatar dependabot[bot] avatar jmcmichael avatar kkrysiak avatar malachig avatar mrjosh-zz avatar nspies13 avatar obigriffith avatar pieterlukasse avatar ruslan-forostianov avatar susannasiebert avatar tmooney avatar yang-yangfeng avatar zlskidmore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

civic-server's Issues

typeahead results should include all fields searched

So on the typeahead results, I'd like to show the matching text in the dropdown but it looks like some of the fields searched are not returned in the results. For example if I search for 'nib':

http://localhost:3001/api/variants/typeahead_results?query=nib

I get a bunch of hits but the drug field, which I assume which has all the hits on 'nib', isn't returned in the results.

Also if it's not too difficult or computationally expensive, it would be cool to have would be a list of field(s) that contain the searched string. So if I type in 'BRAF' then I get all the BRAF variants and a 'hits' field that might be ['entrez_name']. If I search for 'nib', the 'hits' field would be ['drug']. Then I can include that info in the dropdown.

should admin Apply entity edit generate a revision event and diff record?

Currently if an admin applies an edit, it appears to update the entity's record w/o generating a revision event that would show in logs, or revision diffs that would show up in the revisions grid. Generating revision evens and diffs would probably make the apply process much clearer (it's already proved a bit confusing - see griffithlab/civic-client#86).

Could/should we include admin apply actions in the revision workflow so that it generates update events and diffs?

Data Dump Ordering

The rake civic:dump task needs to start respecting foreign key ordering on table copy statements.

Add HGVS

And by HGVS I mean use chr:start-stop (ref -> var)

Add more information to tables in Admin interface

Here are some values and other changes that I found myself wanting in the admin interface:

  • In the Comments view show: Commentable and Commentable Type values
  • In the Evidence Items view set default sort to be reverse chronological on the Updated At field.
  • In the Evidence Items view add the Evidence Level field
  • In the Evidence Items view in the Filters section, the Variant drop down menu should be sorted by variant name. The remaining values that you can filter on could all also be drop down menus as well.
  • In the Variants view it would be good to have the 'Updated At' field so that one can quickly find the latest variants that were added.
  • In the Variants view in the Filters section the drop down menu for Gene should be sorted by Gene name. I would also make this the first filter listed instead of the last one.
  • In the Variants view, when you edit a variant ideally you should be able to edit coordinate information perhaps.
  • In the Genes view, perhaps the default sort should be by Updated At. Same thing for the Suggested Changes view.
  • It was not immediately clear how one would create a Subscription. Maybe we should have some examples in here or further guidance on how to create these?

add an applied_by attribute to suggested_changes objects?

I'm thinking that having an 'Applied by' column in the entity revisions lists would be good to have, and I bet we get asked for it eventually. Could we add an 'applied_by' attribute to objects returned from the various entities' suggested_changes endpoints? It might then make sense to change name of the 'user' attribute to 'created_by'. I don't consider this to be a high priority request, just thought it would be a good enhancement and didn't want to forget it.

Notifications

On-site notifications of changes to entities a user is watching.

expected behavior when user submits suggested revision identical to existing suggested revision?

Currently we return a 509 if a user submits an entity revision that doesn't contain any edits. In griffithlab/civic-client#88, Obi noted that he was able to submit several identical gene suggested revisions. I had expected that these would genreate 509s as well, but thinking back I don't recall if we discussed/implemented this or not.

As the revisions system is currently implemented, should these identical revisions be generating 509s and did Obi find a bug? Or is returning 509s from identical suggested something we need to discuss and add as an enhancement? (personally I think identical revisions should return a 509 or some other error).

User Profile Completion Flow

After initial sign up, direct user to a page to supply any additional required details.

Allow for supplying links, institution names, etc.

Glossary of terms

Load in a YAML glossary of definitions and provide an endpoint for accessing them.

check out prerender_service and prerender_rails for generating static crawler-friendly pages

One of the downsides of single page applications (SPAs) is that in order to be viewed they must be generated by javascript, and most search engine crawlers cannot do this. The workaround is for the server to return the SPA for users and static rendered pages for web crawlers. Google has created a set of standards for doing this, and it's also baked into AngularJS as well. More details at Google's Making AJAX Applications Crawlable page.

Given that one of the goals of CIViC is to be a useful online reference for cancer variant information, we should make it easily available to search engines, etc.

A company, prerender.io, provides software for doing the redirection and page generation logic. They've open sourced their software so it's possible to install and set up your own prerender server. Then you use their Rails libraries to plug it into your app.

I found this after digging around for a little bit, and it looks like the easiest solution. Here's Prerender.io:

https://prerender.io/

Their node-based page rendering server:

https://github.com/prerender/prerender

And the Rails gem that generates the rendering requests and serves up the prerendered pages:

https://github.com/prerender/prerender_rails

Create a browse sources/publication view that also acts as a curation queue

It would be great to a have a view in the interface that showed the current 'bibliography' of CIViC. This would be the list of sources we have obtained 1 to n evidence statements from.

Use cases:

  • We give credit to the authors of papers, while also giving a sense of the number and diversity of papers CIViC leans on.
  • User can see if their favorite paper is already in CIViC
  • User can add a paper to the queue that they believe has value but hasn't been curated yet.

View could show:

  • Compact citation pulled from PubMed as we display elsewhere
  • Number of evidence statements pulled from the paper so far
  • Status (Curated, pending, etc.)

This view could be a third view:
'Browse by Variant', 'Browse by Gene', and now 'Browse by Source'.

genes/:geneId/variant_groups returns multiple instances of the same variant

To reproduce, query this URL:

http://127.0.0.1:3000/api/genes/38/variant_groups

and look for the four identical instances of D842V. The genes/:geneId route returns a gene record w/ a variant_groups array that looks correct.

In the client, this results in multiple identical entries in the Variant menu:

http://127.0.0.1:3001/#/events/genes/38/summary/variants/97/summary

(This issue is linked from griffithlab/civic-client#77)

implement REST API versioning?

We're planning on making some breaking changes to the API, and I was thinking about the best way to handle this so that we don't have to worry too much about pushing our changes on the client and server at the same time for this and future versions. Working on different branches helps, but implementing an API versioning feature would pretty much eliminate the problem.

I was thinking from the API side the easiest way to do it would be to place a version slug in the URL like:

http://127.0.0.1:3001/api/v1/[...]

Looks like there's at least one gem that provides this feature:

https://github.com/bploetz/versionist

and a few articles that show how to roll your own:

http://www.bignerdranch.com/blog/adding-versions-rails-api/

Additional stats endpoint(s)

We'd like a dashboard of sorts for displaying information general site information, activity, and stats. We'll need endpoints to power them. Some ideas:

  • Total database size (number of evidence items, variants, users, etc)
  • Recent activity
  • New users

civic import fails on error

I followed the install instructions but did both the rake civic:load and then the rake civic:import. The import failed on the error below. Is this because that import method is currently broken? Or can you not import directly from the files after you have already loaded from the existing database dump?

Obis-MacBook-Air:civic-server ogriffit$ rake civic:import['import/GeneSummaries.txt','import/VariantSummaries.txt','import/ClinActionEvidence.txt', 'import/VariantGroupSummaries.txt']
rake aborted!
Don't know how to build task 'civic:import[import/GeneSummaries.txt,import/VariantSummaries.txt,import/ClinActionEvidence.txt,'

Disease and drug names should be Title Case

Looking at views in the CIVIC interface, the few spots where casing is not consistent are a bit jarring to the eye. In particular, on import, or when we query and display options from an external API, can we convert disease names to Title Case? Also can we similarly convert drug names to Title Case.

Note that in both of these cases there may be diseases that are like 'AML' or drug names that are like 'PLX4720'. We don't want to lower case any of these letters.

So what I really mean, is to make the first letter of each word upper case, and leave the rest of the word alone.

Expand Search Endpoint

Search API endpoint should support diseases and drugs in addition to genes and variants.

When adding new evidence items, the drug that I entered doesn't appear in the resulting entry

If I add an evidence item following the example documented in the interface (latest pull of everything). I am able to approve this new entry in the admin interface. Then I get an evidence item that appears in the UI and for the most looks correct. But the drug value remains blank (even though I added one).

Related to #59, since the admin interface only shows a subset of values for an evidence item, I can't tell if the drug was actually entered in the database successfully and just isn't display or whether it was not captured at all at the time of entry.

If I try to edit the evidence item and add a drug, that also doesn't seem to work.

Incorporate coordinates

Include coordinate support in the importer, endpoints, and admin panels at the variant level.

Admin Dashboard should provide meaningful at-a-glance information

Recent comments are fine, but we definitely will also want things like:

  • Recent evidence item submissions
  • Evidence items waiting on admin acceptance
  • Evidence items that have failed and require manual intervention
  • Daily stats (total new users, evidence items, variants etc)

Anything else that would be useful?

API Docs

Come up with basic API documentation for the read-only portions of the API.

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.