Skip to content

Commit

Permalink
334 output refactoring (#14)
Browse files Browse the repository at this point in the history
* merge GOF

* gof tweak, infotable merge

* modal first pass

* tweak imports

* merge summary, fix import

* remove lollipop

* fix after merge w/ floating point hover

* wip

* updates

* fix test failures and warnings

* use CamelCase

* version updates

* remove multitumor analysis of deviance

* add cdf plot to individual multitumor models

* remove special multitumor components

* use new <Table> component

* add ruff check to windows batch file

* make summary results consistent across types

* remove duplicative parameter components

* revert to psycopg2

---------

Co-authored-by: Andy Shapiro <[email protected]>
  • Loading branch information
hausman-gdit and shapiromatron authored Apr 16, 2024
1 parent 92b79d8 commit 5bdacc6
Show file tree
Hide file tree
Showing 40 changed files with 498 additions and 1,052 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ lint: lint-py lint-js ## Check formatting issues
format: format-py format-js ## Fix formatting issues where possible

lint-py: ## Check python formatting issues
@ruff format . --check && ruff .
@ruff format . --check && ruff check .

format-py: ## Fix python formatting issues where possible
@ruff format . && ruff . --fix --show-fixes
@ruff format . && ruff check . --fix --show-fixes

lint-js: ## Check javascript formatting issues
@npm --prefix ./frontend run lint
Expand Down
3 changes: 3 additions & 0 deletions bmds_server/analysis/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from rest_framework import exceptions, mixins, viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.schemas.openapi import AutoSchema

from ..common import renderers
from ..common.renderers import BinaryFile
Expand All @@ -19,6 +20,7 @@
class AnalysisViewset(mixins.RetrieveModelMixin, viewsets.GenericViewSet):
serializer_class = serializers.AnalysisSerializer
queryset = models.Analysis.objects.prefetch_related("collections").all()
schema = AutoSchema(operation_id_base="Analysis")

@action(detail=False, url_path="default")
def default(self, request, *args, **kwargs):
Expand Down Expand Up @@ -198,6 +200,7 @@ def collections(self, request, *args, **kwargs):
class PolyKViewset(viewsets.GenericViewSet):
queryset = models.Analysis.objects.none()
serializer_class = UnusedSerializer
schema = AutoSchema(operation_id_base="PolyK")

def _run_analysis(self, request) -> PolyKAdjustment:
try:
Expand Down
1 change: 1 addition & 0 deletions bmds_server/common/templatetags/bs4.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Twitter Bootstrap 4 - helper methods
"""

from datetime import datetime
from textwrap import dedent
from uuid import uuid4
Expand Down
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"rimraf": "^2.4.3",
"style-loader": "^0.19.0",
"webpack": "^5.88.1",
"webpack-bundle-tracker": "^2.0.1",
"webpack-bundle-tracker": "^3.1.0",
"webpack-cli": "^5.1.4",
"webpack-dev-middleware": "^6.1.1"
},
Expand All @@ -58,7 +58,7 @@
"lodash": "^4.17.21",
"mobx": "^5.15.7",
"mobx-react": "^6.3.1",
"plotly.js": "2.27.0",
"plotly.js": "2.30.0",
"popper.js": "^1.16.1",
"prop-types": "^15.7.2",
"react": "^17.0.2",
Expand Down
75 changes: 0 additions & 75 deletions frontend/src/components/IndividualModel/ContinuousSummary.js

This file was deleted.

78 changes: 0 additions & 78 deletions frontend/src/components/IndividualModel/DichotomousSummary.js

This file was deleted.

36 changes: 15 additions & 21 deletions frontend/src/components/IndividualModel/GoodnessFit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import {ff} from "@/utils/formatters";

@observer
class GoodnessFit extends Component {
getDichotomousData() {
const {store} = this.props,
gof = store.modalModel.results.gof,
dataset = store.selectedDataset;
getDichotomousData(dataset, model) {
const gof = model.results.gof;
return {
headers: [
"Dose",
Expand All @@ -35,10 +33,8 @@ class GoodnessFit extends Component {
};
}

getContinuousNormalData(dtype) {
const {store} = this.props,
gof = store.modalModel.results.gof,
dataset = store.selectedDataset,
getContinuousNormalData(dataset, dtype, model) {
const gof = model.results.gof,
useFF = dtype === Dtype.CONTINUOUS_INDIVIDUAL;
return {
headers: [
Expand All @@ -65,10 +61,8 @@ class GoodnessFit extends Component {
};
}

getContinuousLognormalData(dtype) {
const {store} = this.props,
gof = store.modalModel.results.gof,
dataset = store.selectedDataset,
getContinuousLognormalData(dataset, dtype, model) {
const gof = model.results.gof,
useFF = dtype === Dtype.CONTINUOUS_INDIVIDUAL;
return {
headers: [
Expand Down Expand Up @@ -98,22 +92,22 @@ class GoodnessFit extends Component {
}),
};
}

render() {
const {store} = this.props,
settings = store.modalModel.settings,
dataset = store.selectedDataset,
model = store.modalModel,
dataset = store.isMultiTumor ? store.modalDataset : store.selectedDataset,
{dtype} = dataset;

let data;
if (dtype == Dtype.DICHOTOMOUS) {
data = this.getDichotomousData();
if (store.isMultiTumor || dtype == Dtype.DICHOTOMOUS) {
data = this.getDichotomousData(dataset, model);
} else if (isLognormal(settings.disttype)) {
data = this.getContinuousLognormalData(dataset, dtype, model);
} else {
if (isLognormal(settings.disttype)) {
data = this.getContinuousLognormalData(dtype);
} else {
data = this.getContinuousNormalData(dtype);
}
data = this.getContinuousNormalData(dataset, dtype, model);
}

return (
<table className="table table-sm table-bordered text-right">
<colgroup>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/IndividualModel/InfoTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class InfoTable extends Component {
render() {
const {outputStore} = this.props,
model = outputStore.modalModel,
dataset = outputStore.selectedDataset,
dataset = outputStore.isMultiTumor
? outputStore.modalDataset
: outputStore.selectedDataset,
data = [
["Dataset", dataset.metadata.name],
["Model", model.name],
Expand Down
Loading

0 comments on commit 5bdacc6

Please sign in to comment.