Skip to content

Cherry Lab Python Programming test; based on Flask/Elasticsearch

License

Notifications You must be signed in to change notification settings

ClinGen/python_react_programming_starter

 
 

Repository files navigation

Python/Flask Testing prototype

A prototype web portal for genomic information

Prerequisites

Python 2.7.8 or greater on Mac OSX. Elasticsearch 2.4

Ensure you've installed pip, virtualenv, nodejs, elasticsearch (Note: This has all been done for you already if you are actually taking the test)

Detailed install instructions (MacOSX):

>/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
>brew install python@2
>brew install git
>pip install virtualenv
>brew cask install homebrew/cask-versions/java8
>brew install [email protected]
>brew link [email protected]

Background

This application is designed to mimic a typical web programming environment in the Cherry Lab. The stack uses Python (Flask) as a web framework and API, Javascript (ReactJS) for the web front end, and Elasticsearch as a ~static, searchable database. The database is designed to connect the genomes (list of genes), the functional annotations (GO terms), and disease associations for each gene from OMIM. These data are loaded and indexed into elasticsearch and results provided by the api using /api/search/ endpoint. The system is set up to load the data from the worm C. elegans. During the test you will be asked to extend the functionality of the software.

Organization of the software

Root directory

Contains this README various python and node package requirements, and a Makefile

scripts/elastic_search directory

Contains the code for loading the data and indexing it in Elasticsearch. The data files are located in scripts/elastic_search/data.

src directory

Contains the python Flask code to handle routing, search, and API functions (and dev server).

src/js_src

ReactJS code for the front end

src/templates

A single boilerplate jinja file.

src/build

Compile JS from node; recreated with make build.

src/public

Public libraries for Select CSS and Sigma plugin

Getting started with the Application

Create a virtualenv for isolating the python dependencies:

In one terminal, start elasticsearch

See: Elasticsearch Docs for more info

elasticsearch

In a second terminal (the prototype currently requires Python2)

:

virtualenv -p python2 prototype
source prototype/bin/activate (csh)
OR
. prototype/bin/activate

In the repository directory

make build
make index
make run

To run tests

source prototype/bin/activate
make tests

Development Environment Pro Tips

Assets are compiled using webpack. To enable hot module replacement in your development environment, run npm start while the dev server is running and refresh the page. Subsequent JavaScript changes will go to your browser as a "hot update" without refreshing.

You can run JavaScript unit tests automatically on each file change by running npm run test:watch.

JavaScript coding style is enforced with ESLint. The rules are configured in the .eslintrc file.

About

Cherry Lab Python Programming test; based on Flask/Elasticsearch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 52.9%
  • Python 38.4%
  • CSS 7.5%
  • Other 1.2%