Skip to content

Commit

Permalink
Merge pull request #183 from pepkit/dev
Browse files Browse the repository at this point in the history
v0.9.1 release
  • Loading branch information
donaldcampbelljr authored Apr 24, 2024
2 parents e7d4237 + dc0b7fc commit 6484e51
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 9 deletions.
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.

## [0.9.1] - 2024-04-24
### Fixed
- Pipestat summarize html report columns now show stats only [#148](https://github.com/pepkit/pipestat/issues/148).
- When creating HTML reports from both sample and project level results (multi results), only sample-level results show in the main index table [#150](https://github.com/pepkit/pipestat/issues/150).
- Add more complex schema during dependency check to mitigate false test failures regarding different output schemas [#181](https://github.com/pepkit/pipestat/issues/181).

## [0.9.0] - 2024-04-19
### Fixed
- Bug with rm_record for filebackend
Expand Down
2 changes: 1 addition & 1 deletion pipestat/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.9.0"
__version__ = "0.9.1"
1 change: 1 addition & 0 deletions pipestat/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"InvalidTimeFormatError",
"PipestatDependencyError",
"ColumnNotFoundError",
"SchemaValidationErrorDuringReport",
]


Expand Down
2 changes: 1 addition & 1 deletion pipestat/jinja_templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
<!-- };-->

<!-- })(jQuery);-->
</script>
<!-- </script>-->
<script>
$.noConflict();
jQuery(function ($) {
Expand Down
20 changes: 15 additions & 5 deletions pipestat/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ def create_index_html(self, navbar, footer):
all_result_identifiers = input_sample_attributes + all_result_identifiers

if self.prj.cfg["multi_result_files"] is True:
pipeline_types = ["sample", "project"]
pipeline_types = ["sample"]
else:
pipeline_types = [self.prj.backend.pipeline_type]

Expand All @@ -731,6 +731,15 @@ def create_index_html(self, navbar, footer):
if key not in sample_stat_results.keys():
sample_stat_results[key] = ""

for key in self.schema.keys():
if "type" in self.schema[key]:
if (
self.schema[key]["type"] == "file"
or self.schema[key]["type"] == "image"
or self.schema[key]["type"] == "object"
):
del sample_stat_results[key]

# Sort to ensure alignment in the table
sorted_sample_stat_results = dict(sorted(sample_stat_results.items()))

Expand Down Expand Up @@ -780,13 +789,14 @@ def create_index_html(self, navbar, footer):
)

project_objects = self.create_project_objects()
columns = ["Record Identifiers"] + list(sorted_sample_stat_results.keys())
columns_table = ["Record Identifiers"] + list(sorted_sample_stat_results.keys())
columns_stats = list(sorted_sample_stat_results.keys())
template_vars = dict(
navbar=navbar,
stats_file_path=stats_file_path,
objs_file_path=objs_file_path,
columns=columns,
columns_json=dumps(columns),
columns=columns_table,
columns_json=dumps(columns_stats),
table_row_data=table_row_data,
project_name=self.prj.cfg[PROJECT_NAME],
pipeline_name=self.pipeline_name,
Expand Down Expand Up @@ -938,7 +948,7 @@ def get_nonhighlighted_results(self, types):
def _stats_to_json_str(self):
results = {}
if self.prj.cfg["multi_result_files"] is True:
pipeline_types = ["sample", "project"]
pipeline_types = ["sample"]
else:
pipeline_types = [self.prj.backend.pipeline_type]

Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
)
DB_DEPENDENCIES = False


# SERVICE_UNAVAILABLE = False
# DB_DEPENDENCIES = True

Expand Down
2 changes: 1 addition & 1 deletion tests/data/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project_name: test
record_identifier: sample1
schema_path: sample_output_schema.yaml
schema_path: sample_output_schema_recursive.yaml
database:
dialect: postgresql
driver: psycopg
Expand Down
32 changes: 32 additions & 0 deletions tests/test_pipestat.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,38 @@ def test_complex_object_report(
]
)

@pytest.mark.parametrize(
"val",
[
{"output_file": {"path": "path_string", "title": "title_string"}},
{
"output_image": {
"path": "path_string",
"thumbnail_path": "thumbnail_path_string",
"title": "title_string",
}
},
],
)
@pytest.mark.parametrize("backend", ["db"])
def test_complex_object_report_missing_fields(
self, val, config_file_path, recursive_schema_file_path, results_file_path, backend
):
with NamedTemporaryFile() as f, ContextManagerDBTesting(DB_URL):
results_file_path = f.name
args = dict(schema_path=recursive_schema_file_path, database_only=False)
backend_data = (
{"config_file": config_file_path}
if backend == "db"
else {"results_file_path": results_file_path}
)
args.update(backend_data)

psm = SamplePipestatManager(**args)
del val[list(val.keys())[0]]["path"]
with pytest.raises(SchemaValidationErrorDuringReport):
psm.report(record_identifier=REC_ID, values=val, force_overwrite=True)

@pytest.mark.parametrize(
["rec_id", "val"],
[
Expand Down

0 comments on commit 6484e51

Please sign in to comment.