Skip to content

Commit

Permalink
Display report stages during approval
Browse files Browse the repository at this point in the history
  • Loading branch information
aristizabal95 committed Oct 20, 2023
1 parent 91fa794 commit 4c7d299
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cli/medperf/commands/report/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pandas as pd

from medperf import config
from medperf.entities.cube import Cube
from medperf.utils import dict_pretty_print, approval_prompt, storage_path


Expand Down Expand Up @@ -51,6 +52,12 @@ def run(
report_status = report.status_name.value_counts() / len(report)
report_status_dict = report_status.round(3).to_dict()

cube = Cube.get(prep_cube_uid)
with open(cube.stages_path, "r") as f:
stages = yaml.safe_load(f)

stages = {id: content["status_name"] for id, content in stages.items()}

if os.path.exists(report_metadata_path):
with open(report_metadata_path, "r") as f:
server_metadata = yaml.safe_load(f)
Expand All @@ -66,6 +73,7 @@ def run(
"data_preparation_mlcube": prep_cube_uid,
"contents": report_status_dict,
"metadata": metadata,
"stages": stages,
}

if report_uid is None:
Expand All @@ -74,6 +82,8 @@ def run(
"Do you approve the submission of the status report to the MedPerf Server?"
+ " This report will be visible by the benchmark owner and updated"
+ " with the latest status change throughout the preparation process."
+ " At most, the report will contain the displayed stages and the proportion of"
+ " the data tha is at any given stage."
+ " [Y/n]"
)

Expand All @@ -83,6 +93,8 @@ def run(
ui.print("Report submission cancelled")
return False

del body["stages"] # the stages key is only intended for display

if report_uid is not None:
report_metadata = comms.update_report(report_uid, body)
else:
Expand Down

0 comments on commit 4c7d299

Please sign in to comment.