Metadata-Version: 2.1
Name: brapi-proxy
Version: 0.0.3
Summary: A BRAPI server instance that functions as a proxy for endpoints from existing BRAPI services
Author-email: Matthijs Brouwer <matthijs.brouwer@wur.nl>
License: MIT License
        
        Copyright (c) 2024 EU H2020 AGENT project
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/matthijsbrouwer/brapi-proxy
Classifier: Topic :: Internet :: Proxy Servers
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Flask >=3.0.3
Requires-Dist: flask-restx >=1.3.0
Requires-Dist: Requests >=2.32.2
Requires-Dist: waitress >=3.0.0

# BrAPI proxy solution


A BRAPI server instance that functions as a proxy for endpoints from existing BRAPI services.

## Installation

- **Step 1: Install BrAPI Proxy**
  - To install the BRAPI Proxy, run the following command:
    ```sh
    pip install brapi_proxy
    ```
- **Step 2: Test the Installation (Optional)**
  - To ensure that the installation was successful, you can run the BRAPI Proxy in demo mode with the following command:
    ```sh
    brapi_proxy --demo
    ```

## Usage

- **Step 1: Create Configuration File**
  - Create a file named config.ini.
  - Populate this file with the necessary configuration settings.

- **Step 2: Start the Service**
  - Start the service by running the command:
    ```sh
    brapi_proxy
    ```
  - If the config.ini file is located outside the working directory, use the --config option to specify its location. For example:
    ```sh
    brapi_proxy --config /path/to/config.ini
    ```
    
---

### Currently Supported

**BrAPI Versions**
- version 2.1

**Endpoints**

- BrAPI-Core
  - /commoncropnames
  - /studies
  - /studies/{studyDbId}
- BrAPI-Genotyping
  - /callsets
  - /callsets/{callSetDbId}
  - /variants
  - /variants/{variantDbId}
  - /variantsets
  - /variantsets/{variantSetDbId}
  - /plates
  - /plates/{plateDbId}
  - /samples
  - /samples/{sampleDbId}
  - /references
  - /references/{referenceDbId}
  - /referencesets
  - /referencesets/{referenceSetDbId}
  - /allelematrix
  
### ToDo

- Implement additional endpoints
- Enable authentication for underlying servers
  
---

### Structure Configuration File

Create a `config.ini` file with the necessary configuration settings.

**Basic Configuration**

Include at least the `brapi` section:

```config
[brapi]
port=8080
host=::
threads=4
debug=False
version=2.1
```

**Optional: Authorization**

Optionally, provide authentication tokens to restrict access in the `authorization` section:

```
[authorization]
john=tokenjohn123abc
mary=tokenmary456def
```

**Server Definitions**

Within sections prefixed with `server.`, define the underlying servers:

```
[server.test1]
url=https://test-server.brapi.org/brapi/v2
calls=commoncropnames,variants,allelematrix
prefix.variants=barley:
prefix.variantsets=barley:
prefix.references=barley:
prefix.referencesets=barley:
prefix.callsets=barley:

[server.test2]
url=https://test-server.brapi.org/brapi/v2
calls=commoncropnames,variants,allelematrix
prefix.variants=wheat:
prefix.variantsets=wheat:
prefix.references=wheat:
prefix.referencesets=wheat:
prefix.callsets=wheat:

[server.test3]
url=https://test-server.brapi.org/brapi/v2
calls=samples,studies,plates,callsets,variantsets,referencesets,references
```

---
This software has been developed for the [AGENT](https://www.agent-project.eu/) project



