Skip to content

Commit

Permalink
Merge pull request #222 from wtsi-npg/devel
Browse files Browse the repository at this point in the history
Release PR for 2.1.0
  • Loading branch information
nerdstrike authored Apr 15, 2024
2 parents 1bf8e60 + 5ea356c commit e6e9dff
Show file tree
Hide file tree
Showing 52 changed files with 3,404 additions and 1,051 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
DB_URL: "mysql+pymysql://q:q@q/q"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Poetry
run: |
pipx install poetry
- uses: actions/setup-python@v3
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
Expand All @@ -27,14 +27,13 @@ jobs:
run: |
poetry env use '3.10'
poetry install
- name: Build openapi.json
run: |
mkdir gh_pages
poetry run python -c "from lang_qc.main import app; import json; output = open('gh-pages/openapi.json', 'w'); json.dump(app.openapi(), output); output.close()"
- name: Deploy github pages
uses: JamesIves/github-pages-deploy-action@v4.3.3
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
branch: gh-pages
folder: gh-pages
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Poetry
run: |
pipx install poetry
- uses: actions/setup-python@v3
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
Expand All @@ -41,7 +41,7 @@ jobs:
run: |
poetry run isort --check --diff --color .
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18.x

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:

- name: Check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v3
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
Expand Down Expand Up @@ -59,13 +59,13 @@ jobs:
MYSQL_DATABASE: "langqc"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Poetry
run: |
pipx install poetry
- uses: actions/setup-python@v3
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
Expand All @@ -82,10 +82,10 @@ jobs:
test-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
- run: npm install
working-directory: ./frontend
- run: npm run test
Expand Down
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,40 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [2.1.0] - 2024-04-15

### Changed

* To simplify object instantiation and fields' assignment for some
of the response models, converted `PacBioWell` and `PacBioWellFull`
models to pydantic dataclasses.
* Changed the response model for filtered by either QC status or run wells from
`PacBioWell` to `PacBioWellSummary`, the latter initially being identical
the former. In order to propagate information about a study to the tabbed
well summary view, added a new field, study_names, to the `PacBioWellSummary`
model.
* Added a new event to the tabbed well summary view, to the button with the well
name. Mouse hover over this button displays study names associated with the
well.
* Changed the colour scheme of the above mentioned button from grey to orange
if one of the studies associated with the well is the BIOSCAN study, which
the QC team needs to deal with slightly differently.
* Added a new QC state 'On hold external'. Semantically the new state is similar
to the existing 'On hold' state. The intended purpose of the new QC state - to
highlight the wells, which are waiting for a completion of some off-site
process (example - deplexing at http://mbrave.net/).

### Added

* A new response model `PacBioWellSummary`, which replaces `PacBioWell`
in the latest's capacity of the response model for a PacBio well
summary.
* A new field, `study_names`, a potentially empty sorted array of
unique study names, is added to the response model for a PacBio
well summary.

## [2.0.0] - 2024-02-20

### Changed
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ subjects other than development, testing and deployment.
- [The QC process](docs/qc_process.md)
- [The QC database schema](docs/qc_schema_explained.md)

## Prepare for release

Prior to merging to the master branch:

- Update CHANGELOG.md
- Update the hardcoded version in
- frontend/package.json
- lang_qc/__init__.py
- pyproject.toml
- If needed, update the Copyright year in frontend/src/App.vue

## Install and run locally

You can install the package with `pip install .` from the repository's root.
Expand Down
24 changes: 24 additions & 0 deletions alembic/versions/2.1.0_extend_qc_state_dict.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""extend_qc_state_dict
Revision ID: 2.1.0
Revises: 2.0.0
Create Date: 2024-03-19 12:31:26.359652
"""
from alembic import op

# revision identifiers, used by Alembic.
revision = "2.1.0"
down_revision = "2.0.0"
branch_labels = None
depends_on = None


def upgrade() -> None:
op.execute(
"INSERT INTO qc_state_dict (state, outcome) VALUES ('On hold external', NULL)"
)


def downgrade() -> None:
op.execute("DELETE FROM qc_state_dict WHERE state='On hold external'")
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-alpine as base-stage
FROM node:20-alpine as base-stage

COPY package.json /code/longue_vue/

Expand Down
3 changes: 3 additions & 0 deletions frontend/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"exclude": ["node_modules"]
}
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "npg-longue-vue",
"version": "2.0.0",
"version": "2.1.0",
"description": "UI for LangQC",
"author": "Kieron Taylor <[email protected]>",
"license": "GPL-3.0-or-later",
"engines": {
"node": ">=16.16.0",
"npm": ">=8.11.0"
},
"type": "module",
"scripts": {
"dev": "vite --port 3000",
"build": "vite build",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function notInWellsByRun() {

</el-main>

<el-footer>Copyright Genome Research Ltd 2023 - client version: {{ VERSION.replace(/['"]+/g) + (DEVMODE ? "+DEV" : "")
<el-footer>Copyright Genome Research Ltd 2023, 2024 - client version: {{ VERSION.replace(/['"]+/g) + (DEVMODE ? "+DEV" : "")
}}</el-footer>
</template>

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/QcView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { computed } from "vue";
import groupMetrics from "../utils/metrics.js";
import combineLabelWithPlate from "../utils/text.js"
import { combineLabelWithPlate } from "../utils/text.js"
const props = defineProps({
// Well object representing one prepared input for the instrument
Expand Down
20 changes: 16 additions & 4 deletions frontend/src/components/WellTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
/*
* Renders a table for a list of wells and generates buttons for selecting wells
*/
import combineLabelWithPlate from "../utils/text.js"
import { combineLabelWithPlate, listStudiesForTooltip } from "../utils/text.js"
import { ElTooltip, ElButton } from "element-plus";
const tooltipDelay = 500
const studyNameHighlight = 'BIOSCAN UK for flying insects'
defineProps({
wellCollection: Object
Expand All @@ -28,9 +32,17 @@ defineEmits(['wellSelected'])
<tr :key="wellObj.id_product" v-for="wellObj in wellCollection">
<td>{{ wellObj.run_name }}</td>
<td class="well_selector">
<button v-on:click="$emit('wellSelected', { idProduct: wellObj.id_product })">
{{ combineLabelWithPlate(wellObj.label, wellObj.plate_number) }}
</button>
<el-tooltip placement="top" effect="light" :show-after="tooltipDelay"
:content="'<span>'.concat(listStudiesForTooltip(wellObj.study_names)).concat('</span>')"
raw-content
>
<el-button plain
:type="wellObj.study_names.includes(studyNameHighlight) ? 'warning' : 'info'"
v-on:click="$emit('wellSelected', { idProduct: wellObj.id_product })"
>
{{ combineLabelWithPlate(wellObj.label, wellObj.plate_number) }}
</el-button>
</el-tooltip>
</td>
<td>{{ wellObj.instrument_type }} {{ wellObj.instrument_name }}</td>
<td>{{ wellObj.qc_state ? wellObj.qc_state.qc_state : '&nbsp;' }}</td>
Expand Down
39 changes: 35 additions & 4 deletions frontend/src/components/__tests__/WellTable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,33 @@ describe('Rows of data give rows in the table', () => {
const table = mount(WellTable, {
props: {
wellCollection: [
{run_name: 'TEST1', label: 'A1', plate_number: null, instrument_name: '1234', instrument_type: 'Revio', id_product: 'ABCDEF'},
{run_name: 'TEST1', label: 'B1', plate_number: null, instrument_name: '1234', instrument_type: 'Revio', id_product: '123456'},
{run_name: 'TEST2', label: 'A1', plate_number: 1, instrument_name: '1234', instrument_type: 'Revio', id_product: '123457'},
{
run_name: 'TEST1',
label: 'A1',
plate_number: null,
instrument_name: '1234',
instrument_type: 'Revio',
id_product: 'ABCDEF',
study_names: []
},
{
run_name: 'TEST1',
label: 'B1',
plate_number: null,
instrument_name: '1234',
instrument_type: 'Revio',
id_product: '123456',
study_names: ['Study name 1', 'Study name 2']
},
{
run_name: 'TEST2',
label: 'A1',
plate_number: 1,
instrument_name: '1234',
instrument_type: 'Revio',
id_product: '123457',
study_names: ['BIOSCAN UK for flying insects']
},
]
}
})
Expand Down Expand Up @@ -40,7 +64,14 @@ describe('Rows of data give rows in the table', () => {
expect(table.emitted().wellSelected[0][0]).toHaveProperty('idProduct')
expect(table.emitted().wellSelected[0][0].idProduct).toEqual('ABCDEF')

await rows[2].find('button').trigger('click')
let wellButton = rows[2].find('button')
await wellButton.trigger('click')
expect(table.emitted().wellSelected[1][0].idProduct).toEqual('123456')
expect(wellButton.classes('el-tooltip__trigger')).toBeTruthy()
expect(wellButton.classes('el-button--info')).toBeTruthy()

wellButton = rows[3].find('button')
expect(wellButton.classes('el-tooltip__trigger')).toBeTruthy()
expect(wellButton.classes('el-button--warning')).toBeTruthy()
})
})
19 changes: 17 additions & 2 deletions frontend/src/utils/__tests__/text.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, test, expect } from 'vitest'
import combineLabelWithPlate from '../text'
import { combineLabelWithPlate, listStudiesForTooltip } from '../text'

describe('Text processing', () => {
describe('Well label and plate display', () => {
test('Print well label without plate number', () => {
expect(combineLabelWithPlate('A1', undefined)).toEqual('A1')
expect(combineLabelWithPlate('A1', null)).toEqual('A1')
Expand All @@ -11,3 +11,18 @@ describe('Text processing', () => {
expect(combineLabelWithPlate('A1', 1)).toEqual('1-A1')
})
})

describe('Study names tooltip', () => {
test('Display a warning in case of an empty study array', () => {
expect(listStudiesForTooltip([])).toEqual('No study info')
})

test('Display a single study name for an array of one study', () => {
expect(listStudiesForTooltip(['My single study'])).toEqual('My single study')
})

test('Display multiple lines for multiple studies', () => {
expect(listStudiesForTooltip(['Study One', 'Study two', 'Study 3'])).toEqual(
'Study One<br />Study two<br />Study 3')
})
})
9 changes: 8 additions & 1 deletion frontend/src/utils/text.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
// Reusable text-mangling for the interface

export default function combineLabelWithPlate(well, plate) {
export { combineLabelWithPlate, listStudiesForTooltip }

function combineLabelWithPlate(well, plate) {
if (!plate) {
return well
} else {
return `${plate}-${well}`
}
}

function listStudiesForTooltip(study_names) {
let names = study_names.length == 0 ? ['No study info'] : study_names
return names.join('<br />')
}
3 changes: 2 additions & 1 deletion frontend/src/views/__tests__/WellsByRun.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ for (let index = 0; index < 2; index++) {
instrument_name: "1234",
instrument_type: "Revio",
id_product: `${index}23456`,
study_names: [`Study ${index}`, 'Another study'],
...someLinkGeneration
})
}
Expand All @@ -48,6 +49,7 @@ const secondaryRun = {
instrument_name: '1234',
instrument_type: 'Revio',
id_product: 'ABCDEF',
study_names: [],
...someLinkGeneration
}

Expand Down Expand Up @@ -141,7 +143,6 @@ describe('Does it work?', async () => {
let buttons = wrapper.findAll('button')
buttons[1].trigger('click')
await flushPromises()

expect(wrapper.get('#well_summary').exists()).toBe(true)
})

Expand Down
Loading

0 comments on commit e6e9dff

Please sign in to comment.