# SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later

digraph cli {

    fontname = "Helvetica";
    bgcolor = invis;
    node [shape = rectangle, style = filled, fontname = "Helvetica", fillcolor = gray90, color = black];
    graph [style = dotted, color = black, fontcolor = black];
    edge [color = black];
    rankdir = LR;

    subgraph data {
        cluster = true;
        rank = same;
        label = "datamodule";
        node [shape = cylinder, fillcolor = gold, fixed = true, width = 1.5, height = 0.7];
        train_data [
            label = "Training",
            href="../data-model.html",
            target="_top",
        ];
        valid_data [
            label = "Validation",
            href="../data-model.html",
            target="_top",
        ];
        test_data [
            label = "Test",
            href="../data-model.html",
            target="_top",
        ];
    }

    subgraph core {
        cluster = true;
        label = "experiment (command)";

        subgraph products {
            cluster = false;
            node [shape = note, fillcolor = aquamarine];
            model [label = "Model\nweights", fillcolor = coral];
            train_metadata [label = "JSON\nmetadata"];
            logs [label = "Tensorboard\nlogs"];
            train_analysis_plots [label = "Train\nEvolution\nPlots"];
            prediction_metadata [label = "JSON\nmetadata"];
            predictions [label = "Predictions"];
            evaluation [label = "Evaluation\nTable&Plots"];
            evaluation_metadata [label = "JSON\nmetadata"];
        }

        subgraph commands {
            cluster = false;
            train [
                label = "train",
                href="../cli.html#mednet-train",
                target="_top",
            ];
            train_analysis [
                label = "train-analysis",
                href="../cli.html#mednet-train-analysis",
                target="_top",
            ];
            predict [
                label = "predict"
                href="../cli.html#mednet-predict",
                target="_top",
            ];
            evaluate [
                label = "evaluate\n(task specific)"
                href="../cli.html#mednet",
                target="_top",
            ];
        }

        subgraph workflow {
            cluster = false;
            {train_data valid_data} -> train -> {model train_metadata logs};
            {train_metadata logs} -> train_analysis -> train_analysis_plots;
            {test_data model} -> predict -> {predictions prediction_metadata};
            {predictions} -> evaluate -> {evaluation evaluation_metadata};
        }
    }

}
