diff --git a/pipestat/reports.py b/pipestat/reports.py index 649c22f0..bf10ea09 100644 --- a/pipestat/reports.py +++ b/pipestat/reports.py @@ -647,6 +647,17 @@ def create_index_html(self, navbar, footer): ) project_objects = self.create_project_objects() + + if self.looper_samples: + try: + sources = self.looper_samples[0]._mapped_attr["_project"].config["sample_modifiers"]['derive']['sources'] + derived_table = self.create_derived_table(derived_attributes=sources) + except KeyError: + # No sample modifers or sources, so just pass + derived_table = None + else: + derived_table = None + columns = ["Record Identifiers"] + list(sorted_sample_stat_results.keys()) template_vars = dict( navbar=navbar, @@ -668,6 +679,16 @@ def create_index_html(self, navbar, footer): render_jinja_template("index.html", self.jinja_env, template_vars), ) + def create_derived_table(self, derived_attributes): + print("Placeholder") + if derived_attributes: + for k,v in derived_attributes.items(): + print(f"{k} {v}") + + + return None + + def create_project_objects(self): """ Render available project level outputs defined in the diff --git a/tests/test_pipestat.py b/tests/test_pipestat.py index 21d6125a..00ca9668 100644 --- a/tests/test_pipestat.py +++ b/tests/test_pipestat.py @@ -2132,3 +2132,36 @@ def test_multi_results_summarize( psm.summarize() data = YAMLConfigManager(filepath=os.path.join(temp_dir, "aggregate_results.yaml")) assert r_id in data[psm.pipeline_name][psm.pipeline_type].keys() + + @pytest.mark.parametrize("backend", ["file"]) + def test_temp( + self, + config_file_path, + results_file_path, + recursive_schema_file_path, + backend, + range_values, + ): + # This is for temporary PEATAC testing for determining summarize function + with TemporaryDirectory() as d, ContextManagerDBTesting(DB_URL): + temp_dir = d + # single_results_file_path = "{record_identifier}/results.yaml" + # results_file_path = os.path.join(temp_dir, single_results_file_path) + # args = dict(schema_path=recursive_schema_file_path, database_only=False) + # n = 3 + config_file_path = "/home/drc/pepatac_tutorial/processed/looper_pipestat_config.yaml" + + # for i in range_values[:n]: + # r_id = i[0] + # val = i[1] + # backend_data = {"record_identifier": r_id, "results_file_path": results_file_path} + # args.update(backend_data) + # psm = SamplePipestatManager(**args) + # psm.report(record_identifier=r_id, values=val, force_overwrite=True) + psm = PipestatManager(config_file=config_file_path) + reportlink = psm.summarize() + print(reportlink) + statstsv = psm.table() + print(statstsv) + # data = YAMLConfigManager(filepath=os.path.join(temp_dir, "aggregate_results.yaml")) + # assert r_id in data[psm.pipeline_name][psm.pipeline_type].keys() \ No newline at end of file