https://github.com/bcgsc/pori_graphkb_api
REST API for the GraphKB project
https://github.com/bcgsc/pori_graphkb_api
genomics graphdb knowledge-base personalized-medicine pori
Last synced: 5 months ago
JSON representation
REST API for the GraphKB project
- Host: GitHub
- URL: https://github.com/bcgsc/pori_graphkb_api
- Owner: bcgsc
- License: gpl-3.0
- Created: 2020-12-17T19:23:36.000Z (about 5 years ago)
- Default Branch: develop
- Last Pushed: 2025-04-29T17:05:47.000Z (10 months ago)
- Last Synced: 2025-04-29T18:23:22.662Z (10 months ago)
- Topics: genomics, graphdb, knowledge-base, personalized-medicine, pori
- Language: JavaScript
- Homepage: https://bcgsc.github.io/pori
- Size: 7.91 MB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: docs/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# GraphKB API
 [](https://codecov.io/gh/bcgsc/pori_graphkb_api)  [](https://www.orientdb.org/)  [](https://doi.org/10.5281/zenodo.5730581)
This repository is part of the [platform for oncogenomic reporting and interpretation](https://github.com/bcgsc/pori).
The GraphKB database is implemented using [orientDB](https://github.com/orientechnologies/orientdb) and [orientjs](https://github.com/orientechnologies/orientjs).
It is a graph database which is used to store variants, ontologies, and the relevance of this terms and variants. The KB uses strict controlled vocabulary to provide a parsable and machine-readable interface for other applications to build on. The API is a REST API built on node/express.
## About
### Database Schema
The [schema](https://github.com/bcgsc/pori_graphkb_schema) is defined in a separate NPM package.
In general it consists of four major types of data: ontology terms, variants, evidence, and statements.
### OpenAPI Specification
All KB API routes are documented with OpenAPI specification. The specification is hosted with the api under `/api/spec`
### Authentication
Authentication in the KB uses tokens. KB API tokens can be generated using the token route defined in the API specification.
The first layer of authentication happens when KB uses [keycloak](https://www.keycloak.org/) to authenticate users against the LDAP. A request is sent
to keycloak with the users credentials and a token is returned if the user exists and has access to KB.
The next step happens when KB looks up the username in the KB database. Each user in KB belongs to one or more UserGroups. Each of these UserGroups contains table-level permission schemas.

In summary, KB Client will send user credentials and receive a token which will be used in the header of all subsequent requests.
## Quick Start
Most of the time you will want the deployment instructions rather than the ones below. For
these please see the [contributing guide](./docs/CONTRIBUTING.md).
Requirements
- orientdb 3.0, 3.1, or 3.2
- node v16, v18 or v20
Clone the repository
```bash
git clone https://github.com/bcgsc/pori_graphkb_api.git
cd pori_graphkb_api
git checkout develop
```
Install the dependencies
```bash
npm install
```
To actually use the API, the orientDB instance must already be running. To configure where the tests will point to the user can either modify `config/config.js` or set the [environment variables](env.md) which override this config (default values are shown below, this will change depending on how you db server is configured).
```bash
GKB_DBS_PASS=root
GKB_DBS_USER=root
GKB_DB_HOST='HOST NAME'
GKB_DB_PORT=2424
GKB_KEY_FILE='id_rsa' # used in generating the tokens
```
Create the keyfile (pick the current directory)
```bash
yes | ssh-keygen -t rsa -b 4096 -f id_rsa -N ''
```
After these options are configured, the server can be started
```bash
npm start
```