/BETYdb-YABA

Yet Another BETYdb API (for metadata upload)

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

License Build Status

BETYdb-YABA

Yet Another BETYdb API (for metadata upload)

Gsoc Report : Project Summary

Setup BETYdb

Following commands can be used to initialize the database to be used with YABA development.

docker-compose up -d postgres
docker-compose run --rm bety initialize
docker-compose run --rm bety sync

Running the App

Bring up container for YABA-API

docker-compose up -d yaba_api

Running the App (without initialization and synchronization of bety)

Bring up the containers at once

Once initialization and synchronization of bety database is done,the below command can be directly used to start the app.(Skip the "Setup BETYdb" step)

# Bring up full stack
docker-compose up

How to hit the YABA API endpoints

Following endpoints can be used to upload Metadata to respective tables in bety.

Experiments: (to experiments table):

curl -F "fileName=@input_files/experiments.csv"   \
     http://localhost:5001/yaba/v1/experiments?username=guestuser

Sites: (to sites table)

curl -F "fileName=@input_files/sites.csv"   \
     -F "shp_file=@input_files/S8_two_row_polys.shp"  \
     -F "dbf_file=@input_files/S8_two_row_polys.dbf"  \
     -F "prj_file=@input_files/S8_two_row_polys.prj"  \
     -F "shx_file=@input_files/S8_two_row_polys.shx"  \
     http://localhost:5001/yaba/v1/sites

Treatments: (to treatments table)

curl -F "fileName=@input_files/treatments.csv"   \
     http://localhost:5001/yaba/v1/treatments?username=guestuser

Cultivars: (to cultivars table)

curl -F "fileName=@input_files/cultivars.csv"   \
     http://localhost:5001/yaba/v1/cultivars

Citations: (to citations table)

curl -F "fileName=@input_files/citations.csv"   \
     http://localhost:5001/yaba/v1/citations?username=guestuser

Experiments_sites: (to experiments_sites table)

curl -F "fileName=@input_files/experiments_sites.csv"   \
     http://localhost:5001/yaba/v1/experiments_sites

Experiments_treatments: (to experiments_treatments table)

curl -F "fileName=@input_files/experiments_treatments.csv"   \
     http://localhost:5001/yaba/v1/experiments_treatments

Sites_cultivars: (to sites_cultivars table)

curl -F "fileName=@input_files/sites_cultivars.csv"   \
     http://localhost:5001/yaba/v1/sites_cultivars

Citations_sites: (to citations_sites table)

curl -F "fileName=@input_files/citations_sites.csv"   \
     http://localhost:5001/yaba/v1/citations_sites

How to hit the Client Endpoints

Following endpoints can be used to upload Metadata to respective tables in bety.

Experiments: (to experiments table):

curl -F "fileName=@input_files/experiments.csv"   \
     http://localhost:6001/experiments?username=guestuser

Sites: (to sites table)

curl -F "fileName=@input_files/sites.csv"   \
     -F "shp_file=@input_files/S8_two_row_polys.shp"  \
     -F "dbf_file=@input_files/S8_two_row_polys.dbf"  \
     -F "prj_file=@input_files/S8_two_row_polys.prj"  \
     -F "shx_file=@input_files/S8_two_row_polys.shx"  \
     http://localhost:6001/sites

Treatments: (to treatments table)

curl -F "fileName=@input_files/treatments.csv"   \
     http://localhost:6001/treatments?username=guestuser

Cultivars: (to cultivars table)

curl -F "fileName=@input_files/cultivars.csv"   \
     http://localhost:6001/cultivars

Citations: (to citations table)

curl -F "fileName=@input_files/citations.csv"   \
     http://localhost:6001/citations?username=guestuser

Experiments_sites: (to experiments_sites table)

curl -F "fileName=@input_files/experiments_sites.csv"   \
     http://localhost:6001/experiments_sites

Experiments_treatments: (to experiments_treatments table)

curl -F "fileName=@input_files/experiments_treatments.csv"   \
     http://localhost:6001/experiments_treatments

Sites_cultivars: (to sites_cultivars table)

curl -F "fileName=@input_files/sites_cultivars.csv"   \
     http://localhost:6001/sites_cultivars

Citations_sites: (to citations_sites table)

curl -F "fileName=@input_files/citations_sites.csv"   \
     http://localhost:6001/citations_sites