Skip to content

Commit

Permalink
Merge pull request #215 from Caleydo/release-v13.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkh authored Feb 15, 2023
2 parents 6d25fde + f02b415 commit cd1a165
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 36 deletions.
36 changes: 27 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
.DEFAULT_GOAL := help
pkg_src = tdp_publicdb

flake8 = flake8 $(pkg_src) setup.py
isort = isort $(pkg_src) setup.py
black = black --line-length 140 $(pkg_src) setup.py
pyright = echo 'pyright not used' # pyright $(pkg_src) setup.py
ruff = ruff $(pkg_src) setup.py --line-length 140 --select E,W,F,N,I,C,B,UP,PT,SIM,RUF --ignore E501,C901,B008,C417

.PHONY: start ## Start the development server
start:
python $(pkg_src)

.PHONY: all ## Perform the most common development-time rules
all: format lint test
Expand All @@ -13,25 +17,25 @@ ci: check-format lint test

.PHONY: format ## Auto-format the source code
format:
$(isort)
$(ruff) --fix
$(black)

.PHONY: check-format ## Check the source code format without changes
check-format:
$(isort) --check-only
$(black) --check

.PHONY: lint ## Run flake8
.PHONY: lint ## Run flake8 and pyright
lint:
$(flake8)
$(ruff) --format=github
$(pyright)

.PHONY: test ## Run tests
test:
pytest $(pkg_src)

.PHONEY: documentation ## Generate docs
documentation:
mkdocs build
documentation:
echo "TODO"

.PHONY: install ## Install the requirements
install:
Expand All @@ -41,6 +45,20 @@ install:
develop:
pip install -e .[develop]

.PHONY: env_encrypt ## Encrypts the current ./<app>/.env
env_encrypt:
openssl aes-256-cbc -pbkdf2 -in ./$(pkg_src)/.env -out ./$(pkg_src)/.env.enc

.PHONY: env_decrypt ## Decrypts the ./<app>/.env.enc
env_decrypt:
@if [ -z "${ENV_PASSWORD}" ]; then \
echo "No ENV_PASSWORD set, prompting for password..."; \
openssl aes-256-cbc -pbkdf2 -d -in ./$(pkg_src)/.env.enc -out ./$(pkg_src)/.env; \
else \
echo "ENV_PASSWORD set, using it..."; \
openssl aes-256-cbc -pbkdf2 -d -in ./$(pkg_src)/.env.enc -out ./$(pkg_src)/.env -pass env:ENV_PASSWORD; \
fi

.PHONY: build ## Build a wheel
build:
python setup.py sdist bdist_wheel --dist-dir dist_python
Expand All @@ -55,4 +73,4 @@ help:
@grep -E \
'^.PHONY: .*?## .*$$' $(MAKEFILE_LIST) | \
sort | \
awk 'BEGIN {FS = ".PHONY: |## "}; {printf "\033[36m%-20s\033[0m %s\n", $$2, $$3}'
awk 'BEGIN {FS = ".PHONY: |## "}; {printf "\033[36m%-20s\033[0m %s\n", $$2, $$3}'
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tdp_publicdb",
"description": "",
"version": "13.0.3",
"version": "13.1.0",
"author": {
"name": "The Caleydo Team",
"email": "contact@caleydo.org",
Expand Down Expand Up @@ -62,7 +62,7 @@
"react-select": "^4.1.0",
"react-select-async-paginate": "^0.5.3",
"react-virtualized": "^9.22.3",
"tdp_core": "^16.2.2",
"tdp_core": "^17.0.0",
"visyn_scripts": "^1.1.1"
},
"optionalDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
tdp_core>=16.2.2,<17.0.0
tdp_core>=16.0.1,<17.0.0
12 changes: 4 additions & 8 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
black~=22.3.0
debugpy~=1.5.1
flake8~=4.0.1
isort~=5.10.1
mkdocs-material~=8.2.8
pep8-naming~=0.12.1
black~=22.12.0
pyright~=1.1.285
pytest-runner~=6.0.0
pytest~=7.1.1
recommonmark~=0.7.1
pytest~=7.2.0
ruff==0.0.218
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def requirements(file):
package_data={},
# Although 'package_data' is the preferred approach, in some case you may
# need to place data files outside of your packages. See:
# http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa
# http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
data_files=[], # [('my_data', ['data/data_file'])],
)
2 changes: 1 addition & 1 deletion src/common/GeneUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class GeneUtils {
static formatDrug(item: ISelect3Item<IDrugData>, node: HTMLElement, mode: 'result' | 'selection', currentSearchQuery?: RegExp) {
if (mode === 'result') {
// show scientific name if is different from the drug id
const showScientificName = item.id.toLocaleLowerCase() !== item.data.scientificname.toLocaleLowerCase();
const showScientificName = item.data.scientificname && item.id.toLocaleLowerCase() !== item.data.scientificname.toLocaleLowerCase();
// highlight match
return `${item.id.replace(currentSearchQuery!, Select3Utils.highlightMatch)}<br>
${
Expand Down
13 changes: 12 additions & 1 deletion src/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export const tissue: IDataSourceConfig = {
ColumnDescUtils.numberCol('height', 0, find('height').max, { label: 'Height', visible: false }),
ColumnDescUtils.numberCol('weight', 0, find('weight').max, { label: 'Weight', visible: false }),
ColumnDescUtils.numberCol('bmi', 0, find('bmi').max, { label: 'Body Mass Index (BMI)', visible: false }),
ColumnDescUtils.numberCol('tumorpurity', 0, find('tumorpurity').max, { label: 'Tumor Purity', visible: false }),
ColumnDescUtils.categoricalCol('microsatellite_stability_class', find('microsatellite_stability_class').categories, {
label: 'Micro Satellite Instability (MSI) Status',
visible: false,
Expand All @@ -157,7 +158,17 @@ export const tissue: IDataSourceConfig = {
},
columnInfo: {
string: ['id', 'tumortype_adjacent'],
number: ['age', 'days_to_death', 'days_to_last_followup', 'height', 'weight', 'bmi', 'microsatellite_stability_score', 'mutational_fraction'],
number: [
'age',
'days_to_death',
'days_to_last_followup',
'height',
'weight',
'bmi',
'tumorpurity',
'microsatellite_stability_score',
'mutational_fraction',
],
categorical: [
'organ',
'gender',
Expand Down
8 changes: 2 additions & 6 deletions tdp_publicdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
# Copyright (c) The Caleydo Team. All rights reserved.
# Licensed under the new BSD license, available at http://caleydo.org/license
###############################################################################


from typing import Type

from pydantic import BaseModel
from tdp_core.plugin.model import AVisynPlugin, RegHelper

Expand All @@ -15,7 +11,7 @@

class VisynPlugin(AVisynPlugin):
def register(self, registry: RegHelper):
registry.append("tdp-sql-database-definition", "publicdb", "tdp_publicdb.sql", dict(configKey="tdp_publicdb"))
registry.append("tdp-sql-database-definition", "publicdb", "tdp_publicdb.sql", {"configKey": "tdp_publicdb"})

registry.append(
"tdp_proxy",
Expand All @@ -39,5 +35,5 @@ def register(self, registry: RegHelper):
)

@property
def setting_class(self) -> Type[BaseModel]:
def setting_class(self) -> type[BaseModel]:
return TDPPublicDBSettings
2 changes: 2 additions & 0 deletions tdp_publicdb/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def _tissue_columns(query):
.column("height", type="number")
.column("weight", type="number")
.column("bmi", type="number")
.column("tumorpurity", type="number")
.column("microsatellite_stability_score", type="number")
.column("microsatellite_stability_class", type="categorical")
.column("mutational_fraction", type="number")
Expand Down Expand Up @@ -87,6 +88,7 @@ def _tissue_columns(query):
"height",
"weight",
"bmi",
"tumorpurity",
"microsatellite_stability_class",
"microsatellite_stability_score",
"hla_a_allele1",
Expand Down
2 changes: 1 addition & 1 deletion tdp_publicdb/migration/env.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import tdp_core.dbmigration.env # NOQA
import tdp_core.dbmigration.env

tdp_core.dbmigration.env.run_migrations_online()
4 changes: 1 addition & 3 deletions tdp_publicdb/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Dict

from pydantic import BaseModel
from tdp_core import manager

Expand All @@ -8,7 +6,7 @@ class TDPPublicDBSettings(BaseModel):
dburl: str = "postgresql://publicdb:publicdb@publicdb:5432/publicdb"
statement_timeout: str = "'5min'"
statement_timeout_query: str = "set statement_timeout to {}"
engine: Dict = {"pool_pre_ping": True}
engine: dict = {"pool_pre_ping": True}


def get_settings() -> TDPPublicDBSettings:
Expand Down
6 changes: 3 additions & 3 deletions tdp_publicdb/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
from tdp_core.server.visyn_server import create_visyn_server


@pytest.fixture
@pytest.fixture()
def app() -> Generator[FastAPI, Any, None]:
yield create_visyn_server()
return create_visyn_server()


@pytest.fixture(scope="function")
@pytest.fixture()
def client(app: FastAPI) -> Generator[TestClient, Any, None]:
with TestClient(app) as client:
yield client

0 comments on commit cd1a165

Please sign in to comment.