Git Product home page Git Product logo

jtree's Introduction

JTree

Database Access API for AMDL Results Database

View On SwaggerHub
Build Status Go Report Card

Getting started

This project requires Go to be installed. On OS X with Homebrew you can just run brew install go.

Installing this code: $ go get github.com/Bio-core/JTree

To get any missing dependencies run: $ bash go_get.sh

Running it then should be as simple as:

$ make database
$ make build
$ ./bin/jtree

To generate fake data, run $ ./bin/jtree -g=100, where 100 is the amount of dummy data requested To run on a spesific port run $ ./bin/jtree -p=8000, where 8000 is the desired port

Endpoints:

# QUERIES
# This will return all of the columns in the database
$ curl http://127.0.0.1:8000/Jtree/metadata/0.1.0/columns

# This will return all of the searchable fields in the database
$ curl http://127.0.0.1:8000/Jtree/metadata/0.1.0/searchable

# This will return all of the uneditable fields in the database
$ curl http://127.0.0.1:8000/Jtree/metadata/0.1.0/uneditable

# This is an example query that will return all data from every table in the database
$ curl http://127.0.0.1:8000/Jtree/metadata/0.1.0/query -X POST -H "content-type:application/json" /
-d '{"selected_fields":["*"],"selected_tables":["samples", "patients","experiments", "results", "resultdetails"],"selected_conditions":[[]]}'

# This is an example query that will return all data where the date of birth is greater than 1950
$ curl http://127.0.0.1:8000/Jtree/metadata/0.1.0/query -X POST -H "content-type:application/json" -d /
'{"selected_fields":["samples.sample_id", "patients.dob"],"selected_tables":["samples", "patients","experiments", "results", "resultdetails"],"selected_conditions":[["AND", "patients.dob", "Greater than", "1950"]]}'


# INSERTS and UPDATES
# Note that inserts and updates operate the same way, the only difference is that the public key is not passed with the object structure for in insert
# samples
$ curl -X POST -H "Content-Type: application/json" /
 -d '{`# See models.samples for object structure`}' 127.0.0.1:8000/Jtree/metadata/0.1.0/samples

# patients
$ curl -X POST -H "Content-Type: application/json" /
 -d '{`# See models.patients for object structure`}' 127.0.0.1:8000/Jtree/metadata/0.1.0/patients

# experiments
$ curl -X POST -H "Content-Type: application/json" /
 -d '{`# See models.experiments for object structure`}' 127.0.0.1:8000/Jtree/metadata/0.1.0/experiments

 # results
$ curl -X POST -H "Content-Type: application/json" /
 -d '{`# See models.results for object structure`}' 127.0.0.1:8000/Jtree/metadata/0.1.0/results

 # resultdetails
$ curl -X POST -H "Content-Type: application/json" /
 -d '{`# See models.resultdetails for object structure`}' 127.0.0.1:8000/Jtree/metadata/0.1.0/resultdetails

Docker

For golang code, may need to change the connection string with the update ip for the docker continer

$ docker inspect <container name> | grep IPAddr

Then git commit and puch to master (because it does a goget) and run the docker commands below

$ docker network create -d bridge mysql-network
$ docker run --name mysqldb -p 3306:3306 -e MYSQL_ROOT_PASSWORD=waterloo -d --network=mysql-network mysql/mysql-server
$ docker exec -i mysqldb mysql -u root -pwaterloo -e "CREATE DATABASE JTree"
$ docker exec -i mysqldb mysql -u root -pwaterloo JTree < ./sql/jtree_backup.sql
$ docker exec -i mysqldb mysql -u root -pwaterloo -e "grant SELECT on JTree.* to 'select'@'%' identified by 'passwords';flush privileges;grant SELECT,INSERT, UPDATE on JTree.* to 'update'@'%' identified by 'passwordu';flush privileges;"
$ docker build -t docker/jtree .
$ docker run --network=mysql-network --name jtree -p 8000:8000 -d docker/jtree

jtree's People

Contributors

mitch-strong avatar ljdursi avatar rdeborj avatar

Watchers

James Cloos avatar Kelsea Tomaino 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.