Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update integration tests #62

Merged
merged 12 commits into from
Aug 27, 2024
7 changes: 3 additions & 4 deletions bmds_ui/analysis/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import pybmds
from pybmds.constants import DistType, ModelClass
from pybmds.models.multi_tumor import Multitumor
from pybmds.session import Session
from pybmds.types.nested_dichotomous import IntralitterCorrelation, LitterSpecificCovariate

Expand Down Expand Up @@ -179,7 +178,7 @@ class MultiTumorSession(NamedTuple):
"""

option_index: int
session: Multitumor | None
session: pybmds.Multitumor | None

@classmethod
def run(cls, inputs: dict, option_index: int) -> AnalysisSessionSchema:
Expand All @@ -202,7 +201,7 @@ def create(cls, inputs: dict, option_index: int) -> Self:
model_settings = build_model_settings(
dataset_type, PriorEnum.frequentist_restricted, options, {}
)
session = Multitumor(datasets, degrees=degrees, settings=model_settings)
session = pybmds.Multitumor(datasets, degrees=degrees, settings=model_settings)
return cls(option_index=option_index, session=session)

def execute(self):
Expand All @@ -213,7 +212,7 @@ def deserialize(cls, data: dict) -> Self:
obj = AnalysisSessionSchema.model_validate(data)
return cls(
option_index=obj.option_index,
session=Multitumor.from_serialized(obj.frequentist),
session=pybmds.Multitumor.from_serialized(obj.frequentist),
)

def to_schema(self) -> AnalysisSessionSchema:
Expand Down
4 changes: 2 additions & 2 deletions bmds_ui/desktop/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ def create_shortcut(no_input: bool = False):
shortcut.write_text(script)

console = Console()
console.print("BMDS Desktop Manger Created:", style="magenta")
console.print("----------------------------", style="magenta")
console.print("BMDS Desktop Manager Created:", style="magenta")
console.print("-----------------------------", style="magenta")
console.print(shortcut, style="cyan")
console.print("\nOpening this file will start BMDS Desktop.")
console.print("You can move this file or create a shortcut to it.\n")
Expand Down
21 changes: 20 additions & 1 deletion bmds_ui/desktop/components/database_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ def additional_path_checks(path: Path):
raise ValueError(f"Cannot edit database {path}. Is this a sqlite database?") from None


def check_duplicates(dbs: list[Database], db: Database):
duplicate = next((el for el in dbs if el.id != db.id and el.path == db.path), None)
if duplicate:
raise ValueError(
f"An existing project ({duplicate.name}) already exists with this filename: {db.path}"
)

duplicate = next((el for el in dbs if el.id != db.id and el.name == db.name), None)
if duplicate:
raise ValueError(f"An existing project already exists with this name: {db.name}")


class NullWidget(Widget):
DEFAULT_CSS = """
NullWidget {
Expand Down Expand Up @@ -190,12 +202,19 @@ def compose(self) -> ComposeResult:
)

def db_valid(self) -> Database:
db = Database(
kw = dict(
name=self.query_one("#name").value,
description=self.query_one("#description").value,
path=Path(self.query_one("#path").value) / self.query_one("#filename").value,
)
if self.db is None:
db = Database(**kw)
else:
db = self.db.model_copy()
for key, value in kw.items():
setattr(db, key, value)
additional_path_checks(db.path)
check_duplicates(Config.get().databases, db)
return db

@on(Button.Pressed, "#db-create")
Expand Down
6 changes: 3 additions & 3 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
Make sure you have the following applications installed locally:

- [Git](https://git-scm.com/)
- [Python](https://www.python.org/) == 3.11
- [Node.js](https://nodejs.org) == 18
- [Python](https://www.python.org/) 3.12
- [Node.js](https://nodejs.org) ≥ 20
- [Yarn](https://yarnpkg.com/)
- [PostgreSQL](https://www.postgresql.org/) >= 16
- [PostgreSQL](https://www.postgresql.org/) 16

If installing on Windows, these packages are available using [miniconda](https://docs.conda.io/en/latest/miniconda.html).

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Data/SelectModelType.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class SelectModelType extends Component {
text="New"
onClick={dataStore.addDataset}
/>
<LabelInput label="New dataset" htmlFor="idFilteredDatasets" />{" "}
<LabelInput label="New dataset" htmlFor="datasetType" />
<SelectInput
id="idFilteredDatasets"
id="datasetType"
onChange={value => dataStore.setModelType(value)}
value={dataStore.model_type}
choices={dataStore.getFilteredDatasetTypes.map(item => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/IndividualModel/Summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Summary extends Component {
}
}

return <TwoColumnTable id="info-table" data={data} label="Modeling Summary" />;
return <TwoColumnTable data={data} label="Modeling Summary" />;
}
}
Summary.propTypes = {
Expand Down
Loading