Skip to content

Commit

Permalink
bmds3 collapse changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hausman-gdit committed Feb 5, 2024
1 parent c7a3cbd commit e52c262
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 33 deletions.
9 changes: 4 additions & 5 deletions bmds_server/analysis/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
from typing import NamedTuple, Self

import bmds
from bmds.bmds3.constants import DistType
from bmds.bmds3.models.multi_tumor import Multitumor, MultitumorBase
from bmds.bmds3.sessions import BmdsSession
from bmds.bmds3.types.nested_dichotomous import IntralitterCorrelation, LitterSpecificCovariate
from bmds.constants import ModelClass
from bmds.constants import DistType, ModelClass
from bmds.models.multi_tumor import Multitumor, MultitumorBase
from bmds.sessions import BmdsSession
from bmds.types.nested_dichotomous import IntralitterCorrelation, LitterSpecificCovariate

from .schema import AnalysisSessionSchema
from .transforms import (
Expand Down
6 changes: 3 additions & 3 deletions bmds_server/analysis/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import bmds
import pandas as pd
import reversion
from bmds.bmds3.batch import BatchBase, BmdsSessionBatch, MultitumorBatch
from bmds.bmds3.recommender.recommender import RecommenderSettings
from bmds.bmds3.types.sessions import VersionSchema
from bmds.batch import BatchBase, BmdsSessionBatch, MultitumorBatch
from bmds.constants import ModelClass
from bmds.recommender.recommender import RecommenderSettings
from bmds.types.sessions import VersionSchema
from django.conf import settings
from django.core.cache import cache
from django.core.exceptions import ValidationError
Expand Down
15 changes: 10 additions & 5 deletions bmds_server/analysis/reporting/docx.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

import docx
from bmds import __version__
from bmds.bmds3.reporting import write_setting_p
from bmds.datasets.transforms.polyk import PolyKAdjustment
from bmds.reporting.styling import Report
from bmds.reporting.styling import Report, write_setting_p
from django.conf import settings
from django.utils.timezone import now

Expand Down Expand Up @@ -58,14 +57,20 @@ def build_docx(

bmds_version = analysis.get_bmds_version()
if bmds_version:
write_setting_p(report, "BMDS version: ", f"{bmds_version.pretty} ({bmds_version.dll})")
write_setting_p(
report, "BMDS version: ", f"{bmds_version.pretty} ({bmds_version.dll})"
)

write_setting_p(report, "BMDS Online version: ", str(settings.COMMIT))

if not analysis.is_finished:
report.document.add_paragraph("Execution is incomplete; no report could be generated")
report.document.add_paragraph(
"Execution is incomplete; no report could be generated"
)
elif analysis.has_errors:
report.document.add_paragraph("Execution generated errors; no report can be generated")
report.document.add_paragraph(
"Execution generated errors; no report can be generated"
)
else:
batch = analysis.to_batch()
batch.to_docx(
Expand Down
2 changes: 1 addition & 1 deletion bmds_server/analysis/reporting/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from typing import Any

import pandas as pd
from bmds.bmds3.sessions import BmdsSession
from bmds.constants import Dtype
from bmds.sessions import BmdsSession

from ..executor import AnalysisSession, MultiTumorSession

Expand Down
2 changes: 1 addition & 1 deletion bmds_server/analysis/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from io import StringIO

import pandas as pd
from bmds.bmds3.types.sessions import VersionSchema
from bmds.datasets.transforms.polyk import PolyKAdjustment
from bmds.types.sessions import VersionSchema
from pydantic import BaseModel, Field, field_validator
from rest_framework.schemas.openapi import SchemaGenerator

Expand Down
8 changes: 4 additions & 4 deletions bmds_server/analysis/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from enum import StrEnum

import bmds
from bmds.bmds3.types.continuous import ContinuousModelSettings
from bmds.bmds3.types.dichotomous import DichotomousModelSettings
from bmds.bmds3.types.nested_dichotomous import NestedDichotomousModelSettings
from bmds.bmds3.types.priors import PriorClass
from bmds.constants import Dtype
from bmds.types.continuous import ContinuousModelSettings
from bmds.types.dichotomous import DichotomousModelSettings
from bmds.types.nested_dichotomous import NestedDichotomousModelSettings
from bmds.types.priors import PriorClass

from .validators.datasets import AdverseDirection

Expand Down
2 changes: 1 addition & 1 deletion bmds_server/analysis/validators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from bmds.bmds3.recommender import RecommenderSettings
from bmds.recommender import RecommenderSettings

from ...common.validation import pydantic_validate
from .datasets import validate_datasets
Expand Down
8 changes: 4 additions & 4 deletions bmds_server/analysis/validators/options.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Any

import bmds
from bmds.bmds3.constants import DistType
from bmds.bmds3.types.continuous import ContinuousRiskType
from bmds.bmds3.types.dichotomous import DichotomousRiskType
from bmds.bmds3.types.nested_dichotomous import LitterSpecificCovariate
from bmds.constants import DistType
from bmds.types.continuous import ContinuousRiskType
from bmds.types.dichotomous import DichotomousRiskType
from bmds.types.nested_dichotomous import LitterSpecificCovariate
from django.conf import settings
from django.core.exceptions import ValidationError
from pydantic import BaseModel, Field
Expand Down
2 changes: 1 addition & 1 deletion bmds_server/analysis/validators/selectors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from bmds.bmds3.selected import SelectedModelSchema
from bmds.selected import SelectedModelSchema
from pydantic import BaseModel


Expand Down
2 changes: 1 addition & 1 deletion compose/app/test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import bmds
from bmds.bmds3.models.dichotomous import Logistic
from bmds.models.dichotomous import Logistic

dataset = bmds.DichotomousDataset(
doses=[0, 50, 100, 150, 200], ns=[100, 100, 100, 100, 100], incidences=[0, 5, 30, 65, 90]
Expand Down
2 changes: 1 addition & 1 deletion tests/analysis/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import docx
import pandas as pd
import pytest
from bmds.bmds3.recommender import RecommenderSettings
from bmds.recommender import RecommenderSettings
from django.urls import reverse
from rest_framework.test import APIClient

Expand Down
4 changes: 2 additions & 2 deletions tests/analysis/test_executor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from copy import deepcopy

from bmds.bmds3.constants import ContinuousModelIds, DichotomousModelIds
from bmds.bmds3.types.priors import PriorClass
from bmds.constants import ContinuousModelIds, DichotomousModelIds
from bmds.types.priors import PriorClass

from bmds_server.analysis.executor import AnalysisSession

Expand Down
4 changes: 2 additions & 2 deletions tests/analysis/test_transforms.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import bmds
import pytest
from bmds.bmds3.types.continuous import ContinuousRiskType
from bmds.bmds3.types.dichotomous import DichotomousRiskType
from bmds.constants import M_Exponential, M_ExponentialM3, M_ExponentialM5
from bmds.types.continuous import ContinuousRiskType
from bmds.types.dichotomous import DichotomousRiskType

from bmds_server.analysis import transforms

Expand Down
6 changes: 4 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path

import pytest
from bmds.bmds3.recommender import RecommenderSettings
from bmds.recommender import RecommenderSettings
from django.core.management import call_command


Expand Down Expand Up @@ -38,7 +38,9 @@ def vcr_config():

@pytest.fixture(scope="module")
def vcr_cassette_dir(request):
cassette_dir = Path(__file__).parent.absolute() / "cassettes" / request.module.__name__
cassette_dir = (
Path(__file__).parent.absolute() / "cassettes" / request.module.__name__
)
return str(cassette_dir)


Expand Down

0 comments on commit e52c262

Please sign in to comment.