Skip to content

Commit

Permalink
[ENH] Add back INCOMPLETE status handling for an imaging digest file (
Browse files Browse the repository at this point in the history
#118)

* add back INCOMPLETE status to plot palette and status legend

* update processing status legend title

* update reference example imaging bagel

* add tooltip with caveat for processing statuses

* update imaging bagel schema

* remove custom variable for status order
  • Loading branch information
alyssadai authored Nov 29, 2023
1 parent 98e92a2 commit 776ffbd
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 22 deletions.
23 changes: 20 additions & 3 deletions digest/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,26 @@ def status_legend_card():
return dbc.Card(
dbc.CardBody(
[
html.H5(
"Processing status legend",
className="card-title",
html.Div(
[
html.H5(
"Processing status legend",
className="card-title",
),
html.I(
className="bi bi-question-circle ms-1",
id="title-tooltip-target",
),
dbc.Tooltip(
dcc.Markdown(
"These are the recommended status definitions for processing progress. "
"For more details, see the [schema for an imaging digest file](https://github.com/neurobagel/digest/blob/main/schemas/bagel_schema.json)."
),
autohide=False,
target="title-tooltip-target",
),
],
style={"display": "inline-flex"},
),
html.P(
children=util.construct_legend_str(
Expand Down
8 changes: 3 additions & 5 deletions digest/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
STATUS_COLORS = {
"SUCCESS": CMAP[5],
"FAIL": CMAP[9],
"INCOMPLETE": CMAP[3],
"UNAVAILABLE": CMAP[10],
}
CMAP_PHENO = px.colors.qualitative.Vivid

# TODO: could use util.PIPE_COMPLETE_STATUS_SHORT_DESC to define below variable instead
PIPELINE_STATUS_ORDER = ["SUCCESS", "FAIL", "UNAVAILABLE"]

# Define margins and title position for plots
LAYOUTS = {
"margin": {"l": 30, "r": 30, "t": 60, "b": 30}, # margins of chart
Expand Down Expand Up @@ -75,7 +73,7 @@ def plot_pipeline_status_by_participants(
text_auto=True,
facet_col="pipeline_name",
category_orders={
"pipeline_complete": PIPELINE_STATUS_ORDER,
"pipeline_complete": util.PIPE_COMPLETE_STATUS_SHORT_DESC.keys(),
"session": session_list,
},
color_discrete_map=STATUS_COLORS,
Expand All @@ -102,7 +100,7 @@ def plot_pipeline_status_by_records(status_counts: pd.DataFrame) -> go.Figure:
color="pipeline_complete",
text_auto=True,
category_orders={
"pipeline_complete": PIPELINE_STATUS_ORDER,
"pipeline_complete": util.PIPE_COMPLETE_STATUS_SHORT_DESC.keys(),
"pipeline_name": status_counts["pipeline_name"]
.drop_duplicates()
.sort_values(),
Expand Down
7 changes: 4 additions & 3 deletions digest/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
},
}
PIPE_COMPLETE_STATUS_SHORT_DESC = {
"SUCCESS": "All stages of pipeline finished successfully (all expected output files present).",
"FAIL": "At least one stage of the pipeline failed.",
"UNAVAILABLE": "Pipeline has not yet been run (output directory not available).",
"SUCCESS": "All expected output files of pipeline are present.",
"FAIL": "At least one expected output of pipeline is missing.",
"INCOMPLETE": "Pipeline has not yet been run (output directory not available).",
"UNAVAILABLE": "Relevant MRI modality for pipeline not available.",
}


Expand Down
10 changes: 5 additions & 5 deletions example_bagels/example_imaging_bagel.csv
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
bids_id,participant_id,session,has_mri_data,pipeline_name,pipeline_version,pipeline_starttime,pipeline_complete
sub-MNI001,MNI001,1,TRUE,freesurfer,6.0.1,2022-05-24 13:43,SUCCESS
sub-MNI001,MNI001,2,TRUE,freesurfer,6.0.1,2022-05-24 13:46,SUCCESS
sub-MNI001,MNI001,3,TRUE,freesurfer,6.0.1,UNAVAILABLE,UNAVAILABLE
sub-MNI001,MNI001,3,TRUE,freesurfer,6.0.1,UNAVAILABLE,INCOMPLETE
sub-MNI002,MNI002,1,TRUE,freesurfer,6.0.1,2022-05-24 14:01,SUCCESS
sub-MNI002,MNI002,2,TRUE,freesurfer,6.0.1,2022-05-24 16:27,SUCCESS
sub-MNI003,MNI003,1,TRUE,freesurfer,6.0.1,2022-05-24 17:07,FAIL
sub-MNI003,MNI003,2,TRUE,freesurfer,6.0.1,2022-05-24 17:06,FAIL
sub-MNI001,MNI001,1,TRUE,freesurfer,7.3.2,2022-09-24 13:43,SUCCESS
sub-MNI001,MNI001,2,TRUE,freesurfer,7.3.2,UNAVAILABLE,UNAVAILABLE
sub-MNI001,MNI001,3,TRUE,freesurfer,7.3.2,UNAVAILABLE,UNAVAILABLE
sub-MNI001,MNI001,2,TRUE,freesurfer,7.3.2,UNAVAILABLE,INCOMPLETE
sub-MNI001,MNI001,3,TRUE,freesurfer,7.3.2,UNAVAILABLE,INCOMPLETE
sub-MNI002,MNI002,1,TRUE,freesurfer,7.3.2,2022-09-24 14:01,SUCCESS
sub-MNI002,MNI002,2,TRUE,freesurfer,7.3.2,UNAVAILABLE,UNAVAILABLE
sub-MNI002,MNI002,2,TRUE,freesurfer,7.3.2,UNAVAILABLE,INCOMPLETE
sub-MNI003,MNI003,1,TRUE,freesurfer,7.3.2,2022-09-24 17:07,SUCCESS
sub-MNI003,MNI003,2,TRUE,freesurfer,7.3.2,UNAVAILABLE,UNAVAILABLE
sub-MNI003,MNI003,2,TRUE,freesurfer,7.3.2,UNAVAILABLE,INCOMPLETE
sub-MNI001,MNI001,1,TRUE,fmriprep,20.2.7,UNAVAILABLE,UNAVAILABLE
sub-MNI001,MNI001,2,TRUE,fmriprep,20.2.7,UNAVAILABLE,UNAVAILABLE
sub-MNI001,MNI001,3,TRUE,fmriprep,20.2.7,UNAVAILABLE,UNAVAILABLE
Expand Down
12 changes: 6 additions & 6 deletions schemas/bagel_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,24 @@
},
"PIPELINE_STATUS_COLUMNS": {
"pipeline_complete": {
"Description": "Status of pipeline run. 'SUCCESS': All stages of pipeline (as configured by user) finished successfully (all expected pipeline output files are present). 'FAIL': At least one stage of the pipeline failed. 'UNAVAILABLE': Pipeline has not been run for the subject session (output directory missing).",
"Description": "Status of pipeline run. 'SUCCESS': All expected pipeline output files (as configured by pipeline tracker) are present. 'FAIL': At least one expected pipeline output is missing. 'INCOMPLETE': Pipeline has not been run for the subject session (output directory missing). 'UNAVAILABLE': Relevant MRI modality for pipeline not available for subject session.",
"dtype": "str",
"IsRequired": true,
"Range": ["SUCCESS", "FAIL", "UNAVAILABLE"],
"Range": ["SUCCESS", "FAIL", "INCOMPLETE", "UNAVAILABLE"],
"IsPrefixedColumn": false
},
"PHASE__": {
"Description": "Completion status of tracker-specified phase/subworkflow of a pipeline. This prefix must be followed by a second that is a composite of {pipeline_name}-{pipeline_version} to be grouped to the relevant pipeline. e.g., 'PHASE__fmriprep-20.2.7__func'. Each phase may correspond to a specific output subdirectory, and may be associated with multiple related output files. If phase and stage columns are both present, each phase is expected to correspond to >= 1 stage. 'SUCCESS': All output files corresponding to phase are present. 'FAIL': At least one output file of phase is missing. This status may be used to indicate that the phase crashed. 'UNAVAILABLE': Output subdirectory corresponding to phase is not present. This status may be used to indicate that this phase was not configured for the run. '' (no value): Specified phase not in pipeline described by current row/record.",
"Description": "Completion status of tracker-specified phase/stream of a pipeline. To be grouped to the relevant pipeline, a second prefix denoting {pipeline_name}-{pipeline_version} must be included, e.g., 'PHASE__fmriprep-20.2.7__func'. Each phase may correspond to a specific output subdirectory or a set of related outputs. If phase and stage columns are both present, each phase is expected to correspond to >= 1 stage. 'SUCCESS': All output files corresponding to phase are present. 'FAIL': At least one output file of phase is missing. This status may be used to indicate that the phase crashed. 'INCOMPLETE': Parent pipeline has not been run for the subject session. 'UNAVAILABLE': Relevant MRI modality for pipeline not available for subject session. '' (no value): Specified phase not in pipeline described by current row/record.",
"dtype": "str",
"IsRequired": false,
"Range": ["SUCCESS", "FAIL", "UNAVAILABLE", ""],
"Range": ["SUCCESS", "FAIL", "INCOMPLETE", "UNAVAILABLE", ""],
"IsPrefixedColumn": true
},
"STAGE__": {
"Description": "Completion status of tracker-specified stage of a pipeline. This prefix must be followed by a second that is a composite of {pipeline_name}-{pipeline_version} to be grouped to the relevant pipeline. e.g., 'STAGE__fmriprep-20.2.7__space-MNI152Lin_res-1'. Each stage may correspond to a single output file or a few linked outputs expected to always coexist. If phase and stage columns are both present, each phase is expected to correspond to >= 1 stage. 'SUCCESS': All output files corresponding to stage are present. 'FAIL': At least one output file of stage is missing. This status may be used to indicate that the stage crashed. 'UNAVAILABLE': Output subdirectory corresponding to stage is not present. This status may be used to indicate that this stage was not configured for the run. '' (no value): Specified stage not in pipeline described by current row/record.",
"Description": "Completion status of tracker-specified stage of a pipeline. To be grouped to the relevant pipeline, a second prefix denoting {pipeline_name}-{pipeline_version} must be included, e.g., 'STAGE__fmriprep-20.2.7__space-MNI152Lin_res-1'. Each stage may correspond to a single output file, subdirectory, or a few related output files. If phase and stage columns are both present, each phase is expected to correspond to >= 1 stage. 'SUCCESS': All output files corresponding to stage are present. 'FAIL': At least one output file of stage is missing. This status may be used to indicate that the stage crashed. 'INCOMPLETE': Parent pipeline has not been run for the subject session. 'UNAVAILABLE': Relevant MRI modality for pipeline not available for subject session. '' (no value): Specified stage not in pipeline described by current row/record.",
"dtype": "str",
"IsRequired": false,
"Range": ["SUCCESS", "FAIL", "UNAVAILABLE", ""],
"Range": ["SUCCESS", "FAIL", "INCOMPLETE", "UNAVAILABLE", ""],
"IsPrefixedColumn": true
}
}
Expand Down

0 comments on commit 776ffbd

Please sign in to comment.