Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completed the Third Phase Targets for GSOC #69

Merged
merged 28 commits into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2413857
Delete package-lock.json
im-prakher Aug 25, 2020
0dcd13f
Visualize the polygons
im-prakher Aug 25, 2020
8362ef6
Some improvements and typo fixes
im-prakher Aug 25, 2020
df46ca1
Delete package-lock.json
im-prakher Aug 25, 2020
4190361
Delete package-lock.json
im-prakher Aug 25, 2020
d93d535
Delete settings.json
im-prakher Aug 25, 2020
629853f
Data validation done and Improved Error Logging & Handling
im-prakher Aug 27, 2020
ca9adac
SheetToCSV functonality Improved
im-prakher Aug 28, 2020
2bd507f
Deleted unnecessary sheet file
im-prakher Aug 28, 2020
6842d16
API Key Validation done
im-prakher Aug 28, 2020
ed56e5c
Changed the docker ports for visualization
im-prakher Aug 29, 2020
1c39008
Error handling improved
im-prakher Aug 29, 2020
8b3c15c
Completed the Documentation
im-prakher Aug 29, 2020
0508751
Merge branch 'master' into validate
im-prakher Aug 29, 2020
683411d
Updated images for documentation
im-prakher Aug 29, 2020
d109999
README.md conflicts resolved
im-prakher Aug 29, 2020
a0976e7
Added GSOC 2020 Report
im-prakher Aug 30, 2020
41db3ae
Show appropriate message for User not found
im-prakher Aug 31, 2020
36ba632
Updated pandas version to 0.24.2
im-prakher Aug 31, 2020
5e31351
Fixed markdown for list
im-prakher Sep 3, 2020
3e944d3
Changed spreadsheet links from edit to view mode
im-prakher Sep 3, 2020
688fcfe
Changed bety image for logo
im-prakher Sep 3, 2020
c36b060
Fixed typo in validation.js
im-prakher Nov 8, 2020
4499fab
Make indentation better in homepage.js
im-prakher Nov 8, 2020
14c2e3b
Update README.md
im-prakher Dec 10, 2020
9e5f808
Fix merge conflicts between 63 and 69
KristinaRiemer Dec 14, 2020
10de5bb
Merge branch 'im-prakher-validate'
KristinaRiemer Dec 14, 2020
9e90eeb
Merge pull request #1 from KristinaRiemer/master
im-prakher Jan 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,4 @@ venv.bak/

# node modules
node_modules/
yarn.lock
244 changes: 229 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,48 @@

[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Build Status](https://travis-ci.org/saurabh1969/BETYdb-YABA.svg?branch=api)](https://travis-ci.org/saurabh1969/BETYdb-YABA)

# BETYdb-YABA

Yet Another BETYdb API (for metadata upload)

Developed as part of Google Summer of Code 2019 and 2020
- [GSOC 2019 Report and Workplan](https://osf.io/v7f9t/wiki/GSOC%202019%20Workplan%20and%20Summary/)

## Setup BETYdb
# ![BETYdb Logo](images/bety.png) BETYdb-YABA

Another BETYdb-YABA app for Metadata Upload for seasons using the GUI.
Developed as part of Google Summer of Code 2019 and 2020.

## Table of Contents

- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Setup BETYdb](#setup-betydb)
- [Running the App](#running-the-app)
- [Steps to Upload Metadata](#steps-to-upload-metadata)
- [Schema and Format of the Tables](#schema-and-format-of-the-tables)
- [Cultivars](#cultivars)
- [Experiments](#experiments)
- [Treatments](#treatments)
- [Citations](#citations)
- [Sites](#sites)
- [Sites cultivars](#sites-cultivars)
- [Experiments sites](#experiments-sites)
- [Experiments treatments](#experiments-treatments)
- [Citations sites](#citations-sites)
- [Screenshots](#screenshots)
- [Developer's Documentation](#developers-documentation)
- [Working of the YABA app](working-of-the-yaba-app-works)
- [Hit the YABA API endpoints](#hit-the-yaba-api-endpoints)
- [Hit the Client Endpoints](#hit-the-client-endpoints)
- [Previous Year GSoC Reports](#previous-year-gsoc-reports)
- [Contributing](#contributing)
- [License](#license)

## Getting Started

### Prerequisites

* Docker
* Install docker based on your OS from [here](https://www.docker.com/get-started)
* Docker Compose
* Installation instructions for docker-compose from [here](https://docs.docker.com/compose/install/)

### Setup BETYdb

Following commands can be used to initialize the database to be used
with YABA development.
Expand All @@ -19,25 +53,187 @@ docker-compose run --rm bety initialize
docker-compose run --rm bety sync
```

### Running the App

## Running the App
Once you have completed this step, YABA interface will be running and you can upload your Metadata at [localhost:3001](http://localhost:3001/)

### Bring up container for YABA-API
#### Bring up the containers at once

```sh
docker-compose up
```

#### Bring up container for YABA-API

If you only want to run the yaba-api, not the interface and yaba-client, you can do this.

```sh
docker-compose up -d yaba_api
```

## Running the App (without initialization and synchronization of bety)
### Running the App without initialization and synchronization of bety

Once you have completed this step, YABA interface will be running and you can upload your Metadata at [localhost:3001](http://localhost:3001/)

### Bring up the containers at once
#### Skip the "Setup BETYdb" step and 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)
```sh
# Bring up full stack
docker-compose up
```
## How to hit the YABA API endpoints

## Steps to Upload Metadata

1. Enter your API key
2. Upload your shapefile and different tables
3. Check whether your tables are valid or not
4. Confirm the design of your cultivars
5. Confirm the design of your experiments
6. Confirm the design of your treatments
7. You will be redirected to the success page if the upload is successful.

## Schema and Format of the Tables

### Cultivars

| field | type | notes | required |
|-----------|-----------|-------|----------|
| name | character | | yes |
| species | character | | yes |
| ecotype | character | | no |
| notes | character | | no |

### Experiments

| field | type | notes | required |
|-------------|-----------|------------------------------|----------|
| name | character | | yes |
| start_date | date | must be in format yyyy-mm-dd | yes |
| end_date | date | must be in format yyyy-mm-dd | yes |
| description | character | | no |
| design | character | | no |


### Treatments

| field | type | notes | required |
|-|-|-|-|
| name | character | | yes |
| definition | character | | yes |
| control | boolean | either 't' or 'f' | yes |
| experiment | character | this should exactly match an experiment name inputted in the 'name' field of the experiments sheet; if associated with more than one experiment, separate names with a space and comma | yes |

### Citations

| field | type | notes | required |
|---------|-----------|------------|----------|
| author | character | | yes |
| year | numeric | | yes |
| title | character | | yes |
| journal | character | | no |
| volume | numeric | | no |
| page | character | page range | no |
| url | character | | no |
| pdf | character | | no |
| doi | character | | no |

### Sites

Cultivar and species combination for each site must be present in the cultivars sheet

| field | type | notes | required |
|-|-|-|-|
| sitename | character | must be unique | yes |
| city | character | | no |
| state | character | | no |
| country | character | | no |
| notes | character | | no |
| greenhouse | boolean | either 't' or 'f' | no |
| geometry | geometry | must provide shapefile | yes |
| time_zone | character | | no |
| cultivar | character | this should exactly match a cultivar name inputted in the 'name' field of the cultivars sheet | yes |
| species | character | this should exactly match a species name inputted in the 'species' field of the cultivars sheet | yes |
| experiment | character | this should exactly match an experiment name inputted in the 'name' field of the experiments sheet | yes |

### Sites cultivars

| field | type | notes | required |
|---------------|-----------|------------------------------------------------------------------------------------------------------|----------|
| cultivar_name | character | this should exactly match a cultivar name inputted in the 'name' field of the cultivars sheet | yes |
| specie_id | numeric | this should exactly match an id of cultivar name inputted in the 'name' field of the cultivars sheet | yes |
| sitename | character | this should exactly match a site inputted in the 'sitename' field of the sites sheet | yes |

### Experiments sites

| field | type | notes | required |
|-----------------|-----------|------------------------------------------------------------------------------------------------------|----------|
| experiment_name | character | this should exactly match a experiment name inputted in the 'name' field of the experiments sheet | yes |
| sitename | character | this should exactly match a site inputted in the 'sitename' field of the sites sheet | yes |

### Experiments treatments

| field | type | notes | required |
|-----------------|-----------|---------------------------------------------------------------------------------------------------|----------|
| experiment_name | character | this should exactly match a experiment name inputted in the 'name' field of the experiments sheet | yes |
| treatment_name | character | this should exactly match a treatment name inputted in the 'name' field of the treatments sheet | yes |

### Citations sites

| field | type | notes | required |
|----------|-----------|-----------------------------------------------------------------------------------------------|----------|
| author | character | this should exactly match a author name inputted in the 'author' field of the citations sheet | yes |
| year | numeric | this should exactly match a year inputted in the 'year' field of the citations sheet | yes |
| title | character | this should exactly match a title inputted in the 'title' field of the citations sheet | yes |
| sitename | character | this should exactly match a site inputted in the 'sitename' field of the sites sheet | yes |

## Screenshots

### Homepage
![homepage](images/homepage.png)

### Upload 1
![upload1](images/upload1.png)

### Upload 2
![upload2](images/upload2.png)

### Validation page
![validation_page](images/validation_page.png)

### Cultivar Design page
![cultivars_design](images/cultivars_design.png)

### Experiments Design Page
![experiments_design](images/experiments_design.png)

### Treatments Design Page
![treatments_design](images/treatments_design.png)

### Error Page
![error_page](images/error_page.png)

### Success Page
![success_page](images/success_page.png)

## Developer's Documentation

### Working of the YABA app

The YABA app runs using Docker and there are different containers running different parts of the app,

**postgres:** Runs the container for Postgresql with postgis docker image to hold the data.

**bety:** Runs the container for BETY database docker image.

**yaba_app:** Runs the python code in the app folder of the repository. Contains the code for YABA API endpoints (Developed using Connexion and Flask).

**yaba_client:** Runs the python code in the client folder of the repository. Contains the code for YABA Client endpoints (Developed using Flask).

**yaba_interface:** Runs the javascript code in the interface folder of the repository. Contains the code for interface of the YABA app (Developed using React JS).

**yaba_visualization:** Runs the javascript code in the visualization folder of the repository. Contains the code for visualization component of the YABA app (Developed using Node JS).

### Hit the YABA API endpoints

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

Expand Down Expand Up @@ -108,7 +304,7 @@ curl -F "fileName=@input_files/citations_sites.csv" \
http://localhost:5001/yaba/v1/citations_sites
```

## How to hit the Client Endpoints
### Accessing the Client Endpoints

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

Expand Down Expand Up @@ -178,3 +374,21 @@ Citations_sites: (to citations_sites table)
curl -F "fileName=@input_files/citations_sites.csv" \
http://localhost:6001/citations_sites
```

## Previous Year GSoC Reports

- [GSOC 2020 Report](https://osf.io/v7f9t/wiki/GSOC%202020%20Report/)
- [GSOC 2020 Roadmap](https://osf.io/v7f9t/wiki/GSOC%202020%20Roadmap/)
- [GSOC 2019 Report and Workplan](https://osf.io/v7f9t/wiki/GSOC%202019%20Workplan%20and%20Summary/)

## Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Your contributions could be as simple as fixing the indentations or typos to as complex as bringing new modules and features. **Any contributions you make are greatly appreciated.**

#### First-time Open Source contributors
Please note that BETYdb-YABA is beginner-friendly. If you have never done any open-source yet, we encourage you to do so. **We will be happy and proud of your first PR ever.**

You can begin with resolving any [open issues](https://github.com/PecanProject/BETYdb-YABA/issues).

## License
It is distributed under the BSD 3-Clause license. See [LICENSE](https://github.com/PecanProject/BETYdb-YABA/blob/master/LICENSE) for more information.
Loading