Skip to content

Commit

Permalink
Merge pull request #3 from bcgsc/release/v4.1.1
Browse files Browse the repository at this point in the history
Release/v4.1.1
  • Loading branch information
creisle authored Jan 19, 2021
2 parents 843c5d6 + d1e94d3 commit 56129f1
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 112 deletions.
115 changes: 18 additions & 97 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@

The GraphKB client is the front-end web client for the GraphKB project. It is built
using `React.js` and `webpack`. Linting is done with `eslint`, and follows a modified
version of the Airbnb style guide.
version of the Airbnb style guide. The full guide for developers can be found
[here](docs/CONTRIBUTING.md).

- [Getting Started](#getting-started)
- [Install](#install)
- [Tests](#tests)
- [Running the Tests](#running-the-tests)
- [Coverage Reports](#coverage-reports)
- [Style Guide](#style-guide)
- [App Organization](#app-organization)
- [Branch conventions](#branch-conventions)
- [Coding Guidelines](#coding-guidelines)
- [Reading List](#reading-list)
- [Roadmap](#roadmap)
- [Examples](#examples)
- [Notation Parser](#notation-parser)
- [Query Builder](#query-builder)

## Getting Started

Expand All @@ -27,7 +22,7 @@ First clone the repository locally and checkout the development branch
```bash
git clone https://github.com/bcgsc/pori_graphkb_client.git
cd pori_graphkb_client
git checkout development
git checkout master
```

Next install the project dependencies using npm
Expand All @@ -42,96 +37,22 @@ Start the development server
npm start
```

### Tests
## Examples

#### Running the Tests
The GraphKB Client contains views for allowing users to both add and edit data in GraphKB as well
as documentation about the app itself. Some examples of various sections are given below.

Unit tests are made using [Jest](https://jestjs.io/docs/en/getting-started.html) and [Enzyme](https://airbnb.io/enzyme/docs/api/).
In terminal before running any test commands:
### Notation Parser

The main test suite can be run using the test command
This is part of the app documentation at `/about/notation`. It is an interactive view which allows
the user to familiarized themselves with the notation used in GraphKB which is an extension of HGVS
notation.

```bash
npm run test
```

#### Coverage Reports

The files generated for jest coverage reports are stored in the `/coverage` directory:

```text
`-- coverage/
|-- clover.xml # clover report
|-- junit.xml # junit-formatted report
`-- lcov-report/**/*.html # lcov-formatted reports for each file.
```

### Style Guide

#### App Organization

```text
|-- config/
|-- docs/
`-- src
|-- components/
|-- services/
|-- static/
|-- views/
|-- App.{js,scss}
|-- index.{js,scss}
`-- registerServiceWorker.js
```

| File or Directory | Description |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| config/ | Contains webpack and jest configurations. |
| src/ | Contains all code that is required for the app to run |
| src/components/ | Contains general use app components, mostly presentational. Eg a special type of button with the GSC logo. |
| src/services/ | Contains other business logic modules that are not `React` components. Eg a collection of math functions for calculating geometries for a special graph. |
| src/static/ | Contains static resources to be loaded into the page. Eg a tutorial video .mp4 file to be loaded into a help dialog. |
| src/views/ | Highest level `React` components to be served as root components of a certain URL. Interacts with the router and App context, and are placed in the `<Route />` components. Eg an "About us" page found at the URL "/about" |
| `src/views/<view>/components` | Single-use components specific to the view they are bundled with |
| src/App.[js, scss] | `React` app root component |
| src/index.[js, scss] | `webpack` bundle root script, simply renders `React` app root component and registers service worker. |
| src/registerServiceWorker.js | Registers the service worker created by webpack to serve cached views before re-requesting them to improve performance |

#### Branch conventions

All changes should be made into their own branch and merged with a pull request, preferably with a linked KBDEV ticket in at least one of the commits. KBDEV maintainers should make branches on this repository, otherwise fork the repository into your own personal BitBucket account, and then make a pull request from there.

Here are the naming conventions for the different types of branches used in this project.

| branch type | description |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| feature/[`feature name`] | Branch for adding a new feature. Eg: `feature/stats-page` |
| release/[`version number(s)`] | Branch for releases. Can specify ranges of patch versions with "X" Eg: `release/v0.6.X` or `release/v1.0.X` |
| bugfix/[`bug desc/ticket code`] | Branch for fixing bugs. Eg: `bugfix/KBDEV-1234` or `bugfix/query-crashing` |
| ??? | New branch conventions should be discussed with the KBDEV team |

#### Coding Guidelines

- When adding new files, choose the best directory for the contents.
- Read the [GSC New Developer Guidelines wiki page](https://www.bcgsc.ca/wiki/display/DEVSU/GeneralGuidelines+for+New+Developers)
- Lint everything. App will not compile if there are linting errors.
- JSDoc all functions, classes, and `propTypes` declarations.
- Follow `Material Design` when designing front end components.

### Reading List

For new devlopers joining the project, below are listed some important topics that should be covered before you start.

- [GraphKB API spec](https://graphkb-api.bcgsc.ca/api/spec)
- Schema specification can be found at the [GraphKB schema repo](https://github.com/bcgsc/pori_graphkb_schema)
- [ReactJS basics](https://reactjs.org/tutorial/tutorial.html)
- [React Routing](https://reacttraining.com/react-router/web/guides/quick-start) as well as [integrating a custom history object into your app](https://stackoverflow.com/questions/42701129/how-to-push-to-history-in-react-router-v4/45849608#45849608)
- [ReactJS Context](https://reactjs.org/docs/context.html), which is used for providing `schema` and `user` data throughout other components in the application.
- The testing technologies linked above.
- [SASS](https://sass-lang.com/)
- [GraphComponent] : [d3 force directed graph](https://github.com/d3/d3-force). The learning curve for d3 is higher than for the other technologies since integrating with React can be a hassle. Try to use the existing code here as reference as you go.
![notation gif](docs/images/graphkb-notation-parser.gif)

### Roadmap
### Query Builder

The target user base of the Knowledgebase GUI is researchers and clinicians. As such, addressing their needs/concerns will be the #1 priority when developing. Larger features such as different data display formats, new pages, and large architecture overhauls must be discussed with other members of the KBDEV and VARDB team.
Advaced queries can be built using the query builder. The example below shows a user searching for
drug sensitivity statements loaded from [CIViC](https://civicdb.org).

Requested features are kept track of in the [KBDEV JIRA space](https://www.bcgsc.ca/jira/secure/RapidBoard.jspa?rapidView=176&projectKey=KBDEV&view=planning.nodetail&quickFilter=707) using the [client component](https://www.bcgsc.ca/jira/browse/KBDEV-468?jql=project%20%3D%20KBDEV%20AND%20component%20%3D%20GUI)
![search](docs/images/graphkb-search-sens-civic-statements.gif)
128 changes: 128 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Developers Guide

- [Install](#install)
- [Tests](#tests)
- [Running the Tests](#running-the-tests)
- [Coverage Reports](#coverage-reports)
- [Style Guide](#style-guide)
- [App Organization](#app-organization)
- [Branch conventions](#branch-conventions)
- [Coding Guidelines](#coding-guidelines)
- [Reading List](#reading-list)
- [Roadmap](#roadmap)

## Install

First clone the repository locally and checkout the development branch

```bash
git clone https://github.com/bcgsc/pori_graphkb_client.git
cd pori_graphkb_client
git checkout development
```

Next install the project dependencies using npm

```bash
npm install
```

Start the development server

```bash
npm start
```

## Tests

### Running the Tests

Unit tests are made using [Jest](https://jestjs.io/docs/en/getting-started.html) and [Enzyme](https://airbnb.io/enzyme/docs/api/).
In terminal before running any test commands:

The main test suite can be run using the test command

```bash
npm run test
```

### Coverage Reports

The files generated for jest coverage reports are stored in the `/coverage` directory:

```text
`-- coverage/
|-- clover.xml # clover report
|-- junit.xml # junit-formatted report
`-- lcov-report/**/*.html # lcov-formatted reports for each file.
```

## Style Guide

### App Organization

```text
|-- config/
|-- docs/
`-- src
|-- components/
|-- services/
|-- static/
|-- views/
|-- App.{js,scss}
|-- index.{js,scss}
`-- registerServiceWorker.js
```

| File or Directory | Description |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| config/ | Contains webpack and jest configurations. |
| src/ | Contains all code that is required for the app to run |
| src/components/ | Contains general use app components, mostly presentational. Eg a special type of button with the GSC logo. |
| src/services/ | Contains other business logic modules that are not `React` components. Eg a collection of math functions for calculating geometries for a special graph. |
| src/static/ | Contains static resources to be loaded into the page. Eg a tutorial video .mp4 file to be loaded into a help dialog. |
| src/views/ | Highest level `React` components to be served as root components of a certain URL. Interacts with the router and App context, and are placed in the `<Route />` components. Eg an "About us" page found at the URL "/about" |
| `src/views/<view>/components` | Single-use components specific to the view they are bundled with |
| src/App.[js, scss] | `React` app root component |
| src/index.[js, scss] | `webpack` bundle root script, simply renders `React` app root component and registers service worker. |
| src/registerServiceWorker.js | Registers the service worker created by webpack to serve cached views before re-requesting them to improve performance |

### Branch conventions

All changes should be made into their own branch and merged with a pull request, preferably with a linked KBDEV ticket in at least one of the commits. KBDEV maintainers should make branches on this repository, otherwise fork the repository into your own personal BitBucket account, and then make a pull request from there.

Here are the naming conventions for the different types of branches used in this project.

| branch type | description |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| feature/[`feature name`] | Branch for adding a new feature. Eg: `feature/stats-page` |
| release/[`version number(s)`] | Branch for releases. Can specify ranges of patch versions with "X" Eg: `release/v0.6.X` or `release/v1.0.X` |
| bugfix/[`bug desc/ticket code`] | Branch for fixing bugs. Eg: `bugfix/KBDEV-1234` or `bugfix/query-crashing` |
| ??? | New branch conventions should be discussed with the KBDEV team |

### Coding Guidelines

- When adding new files, choose the best directory for the contents.
- Read the [GSC New Developer Guidelines wiki page](https://www.bcgsc.ca/wiki/display/DEVSU/GeneralGuidelines+for+New+Developers)
- Lint everything. App will not compile if there are linting errors.
- JSDoc all functions, classes, and `propTypes` declarations.
- Follow `Material Design` when designing front end components.

## Reading List

For new devlopers joining the project, below are listed some important topics that should be covered before you start.

- [GraphKB API spec](https://graphkb-api.bcgsc.ca/api/spec)
- Schema specification can be found at the [GraphKB schema repo](https://github.com/bcgsc/pori_graphkb_schema)
- [ReactJS basics](https://reactjs.org/tutorial/tutorial.html)
- [React Routing](https://reacttraining.com/react-router/web/guides/quick-start) as well as [integrating a custom history object into your app](https://stackoverflow.com/questions/42701129/how-to-push-to-history-in-react-router-v4/45849608#45849608)
- [ReactJS Context](https://reactjs.org/docs/context.html), which is used for providing `schema` and `user` data throughout other components in the application.
- The testing technologies linked above.
- [SASS](https://sass-lang.com/)
- [GraphComponent] : [d3 force directed graph](https://github.com/d3/d3-force). The learning curve for d3 is higher than for the other technologies since integrating with React can be a hassle. Try to use the existing code here as reference as you go.

## Roadmap

The target user base of the Knowledgebase GUI is researchers and clinicians. As such, addressing their needs/concerns will be the #1 priority when developing. Larger features such as different data display formats, new pages, and large architecture overhauls must be discussed with other members of the KBDEV and VARDB team.

Requested features are kept track of in the [KBDEV JIRA space](https://www.bcgsc.ca/jira/secure/RapidBoard.jspa?rapidView=176&projectKey=KBDEV&view=planning.nodetail&quickFilter=707) using the [client component](https://www.bcgsc.ca/jira/browse/KBDEV-468?jql=project%20%3D%20KBDEV%20AND%20component%20%3D%20GUI)
Binary file added docs/images/graphkb-notation-parser.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphkb-client",
"version": "4.1.0",
"name": "@bcgsc-pori/graphkb-client",
"version": "4.1.1",
"private": true,
"bugs": {
"email": "[email protected]"
Expand All @@ -13,7 +13,7 @@
"dependencies": {
"@babel/polyfill": "^7.10.1",
"@babel/runtime": "^7.10.1",
"@bcgsc-pori/graphkb-parser": "^1.0.0",
"@bcgsc-pori/graphkb-parser": "^1.1.1",
"@bcgsc-pori/graphkb-schema": "^3.14.2",
"@material-ui/core": "^4.10.0",
"@material-ui/icons": "^4.9.1",
Expand Down
Loading

0 comments on commit 56129f1

Please sign in to comment.