Predict Prevalence of Involvement#

Prevalence prediction module.

This computes the prevalence of an observed involvement pattern, given a trained model. It can also compare this prediction to the observed prevalence in the data. As for the risk prediction, this uses caching and computes the priors first.

lyscripts.compute.prevalences.compute_prevalences(model_config: ModelConfig, graph_config: GraphConfig, dist_configs: dict[str, DistributionConfig], modality_configs: dict[str, ModalityConfig], priors: ndarray, diagnosis: dict[Literal['ipsi', 'contra'], dict], midext: bool | None = None, progress_desc: str = 'Computing prevalences from priors') ndarray[source]#

Compute the prevalence of a diagnosis given the priors and the model.

lyscripts.compute.prevalences.generate_query_from_diagnosis(diagnosis: DiagnosisConfig) Q[source]#

Transform a diagnosis into a query for the data.

lyscripts.compute.prevalences.observe_prevalence(data: DataFrame, scenario_config: ScenarioConfig, mapping: dict[int, str] | Callable[[int], str] | None = None) QueryPortion[source]#

Extract prevalence defined in a scenario from the data.

mapping defines how the T-stages in the data are supposed to be mapped to the T-stages defined in the scenario.

It returns the number of patients that match the given scenario and the total number of patients that are considered. E.g., in the example below we 79 patients are of late T-stage and have a tumor extending over the midline. Of those, 30 were diagnosed with contralateral involvement in LNL II based on a CT scan.

>>> data = next(lydata.load_datasets(year=2021, institution="usz"))
>>> scenario_config = ScenarioConfig(
...     t_stages=["late"],
...     midext=True,
...     diagnosis=DiagnosisConfig(contra={"CT": {"II": True}}),
... )
>>> observe_prevalence(data, scenario_config)
QueryPortion(match=np.int64(7), total=np.int64(79))
pydantic settings lyscripts.compute.prevalences.PrevalencesCLI[source]#

Bases: BaseComputeCLI

Predict the prevalence of an involvement pattern from model samples.

Show JSON schema
{
   "title": "PrevalencesCLI",
   "description": "Predict the prevalence of an involvement pattern from model samples.",
   "type": "object",
   "properties": {
      "configs": {
         "default": [
            "config.yaml"
         ],
         "description": "Path to the YAML file(s) that contain the configuration(s). Configs from YAML files may be overwritten by command line arguments. When multiple files are specified, the configs are merged in the order they are given. Note that every config file must have a `version: 1` key in it.",
         "items": {
            "format": "path",
            "type": "string"
         },
         "title": "Configs",
         "type": "array"
      },
      "graph": {
         "$ref": "#/$defs/GraphConfig"
      },
      "model": {
         "$ref": "#/$defs/ModelConfig",
         "default": {
            "external_file": null,
            "class_name": "Unilateral",
            "constructor": "binary",
            "max_time": 10,
            "named_params": null,
            "kwargs": {}
         }
      },
      "distributions": {
         "additionalProperties": {
            "$ref": "#/$defs/DistributionConfig"
         },
         "default": {},
         "description": "Mapping of model T-categories to predefined distributions over diagnose times.",
         "title": "Distributions",
         "type": "object"
      },
      "cache_dir": {
         "default": "/home/docs/checkouts/readthedocs.org/user_builds/lyscripts/checkouts/latest/docs/source/.cache",
         "description": "Cache directory for storing function calls.",
         "format": "path",
         "title": "Cache Dir",
         "type": "string"
      },
      "scenarios": {
         "default": [],
         "description": "List of scenarios to compute risks for.",
         "items": {
            "$ref": "#/$defs/ScenarioConfig"
         },
         "title": "Scenarios",
         "type": "array"
      },
      "sampling": {
         "$ref": "#/$defs/SamplingConfig"
      },
      "modalities": {
         "additionalProperties": {
            "$ref": "#/$defs/ModalityConfig"
         },
         "default": {},
         "description": "Maps names of diagnostic modalities to their specificity/sensitivity.",
         "title": "Modalities",
         "type": "object"
      },
      "prevalences": {
         "$ref": "#/$defs/HDF5FileStorage",
         "description": "Storage for the computed prevalences."
      },
      "data": {
         "$ref": "#/$defs/DataConfig"
      }
   },
   "$defs": {
      "DataConfig": {
         "description": "Where to load lymphatic progression data from and how to feed it into a model.",
         "properties": {
            "source": {
               "anyOf": [
                  {
                     "format": "file-path",
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/LyDataset"
                  }
               ],
               "description": "Either a path to a CSV file or a config that specifies how and where to fetch the data from.",
               "title": "Source"
            },
            "side": {
               "anyOf": [
                  {
                     "enum": [
                        "ipsi",
                        "contra"
                     ],
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Side of the neck to load data for. Only for Unilateral models.",
               "title": "Side"
            },
            "mapping": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "type": "integer"
                     },
                     {
                        "type": "string"
                     }
                  ]
               },
               "description": "Optional mapping of numeric T-stages to model T-stages.",
               "title": "Mapping",
               "type": "object"
            }
         },
         "required": [
            "source"
         ],
         "title": "DataConfig",
         "type": "object"
      },
      "DiagnosisConfig": {
         "description": "Defines an ipsi- and contralateral diagnosis pattern.",
         "properties": {
            "ipsi": {
               "additionalProperties": {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "enum": [
                              false,
                              0,
                              "healthy",
                              true,
                              1,
                              "involved",
                              "micro",
                              "macro",
                              "notmacro"
                           ]
                        },
                        {
                           "type": "null"
                        }
                     ]
                  },
                  "type": "object"
               },
               "default": {},
               "description": "Observed diagnoses by different modalities on the ipsi neck.",
               "examples": [
                  {
                     "CT": {
                        "II": true,
                        "III": false
                     }
                  }
               ],
               "title": "Ipsi",
               "type": "object"
            },
            "contra": {
               "additionalProperties": {
                  "additionalProperties": {
                     "anyOf": [
                        {
                           "enum": [
                              false,
                              0,
                              "healthy",
                              true,
                              1,
                              "involved",
                              "micro",
                              "macro",
                              "notmacro"
                           ]
                        },
                        {
                           "type": "null"
                        }
                     ]
                  },
                  "type": "object"
               },
               "default": {},
               "description": "Observed diagnoses by different modalities on the contra neck.",
               "title": "Contra",
               "type": "object"
            }
         },
         "title": "DiagnosisConfig",
         "type": "object"
      },
      "DistributionConfig": {
         "description": "Configuration defining a distribution over diagnose times.",
         "properties": {
            "kind": {
               "default": "frozen",
               "description": "Parametric distributions may be updated.",
               "enum": [
                  "frozen",
                  "parametric"
               ],
               "title": "Kind",
               "type": "string"
            },
            "func": {
               "const": "binomial",
               "default": "binomial",
               "description": "Name of predefined function to use as distribution.",
               "title": "Func",
               "type": "string"
            },
            "params": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "type": "integer"
                     },
                     {
                        "type": "number"
                     }
                  ]
               },
               "default": {},
               "description": "Parameters to pass to the predefined function.",
               "title": "Params",
               "type": "object"
            }
         },
         "title": "DistributionConfig",
         "type": "object"
      },
      "GraphConfig": {
         "description": "Specifies how the tumor(s) and LNLs are connected in a DAG.",
         "properties": {
            "tumor": {
               "additionalProperties": {
                  "items": {
                     "type": "string"
                  },
                  "type": "array"
               },
               "description": "Define the name of the tumor(s) and which LNLs it/they drain to.",
               "title": "Tumor",
               "type": "object"
            },
            "lnl": {
               "additionalProperties": {
                  "items": {
                     "type": "string"
                  },
                  "type": "array"
               },
               "description": "Define the name of the LNL(s) and which LNLs it/they drain to.",
               "title": "Lnl",
               "type": "object"
            }
         },
         "required": [
            "tumor",
            "lnl"
         ],
         "title": "GraphConfig",
         "type": "object"
      },
      "HDF5FileStorage": {
         "description": "HDF5 file storage for in- and outputs of computations.",
         "properties": {
            "file": {
               "description": "Path to the HDF5 file. Parent directories are created if needed.",
               "format": "path",
               "title": "File",
               "type": "string"
            },
            "dataset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Name of the dataset in the HDF5 file. Save/load methods can override this.",
               "title": "Dataset"
            }
         },
         "required": [
            "file"
         ],
         "title": "HDF5FileStorage",
         "type": "object"
      },
      "InvolvementConfig": {
         "description": "Config that defines an ipsi- and contralateral involvement pattern.",
         "properties": {
            "ipsi": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "enum": [
                           false,
                           0,
                           "healthy",
                           true,
                           1,
                           "involved",
                           "micro",
                           "macro",
                           "notmacro"
                        ]
                     },
                     {
                        "type": "null"
                     }
                  ]
               },
               "default": {},
               "description": "Involvement pattern for the ipsilateral side of the neck.",
               "examples": [
                  {
                     "II": true,
                     "III": false
                  }
               ],
               "title": "Ipsi",
               "type": "object"
            },
            "contra": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "enum": [
                           false,
                           0,
                           "healthy",
                           true,
                           1,
                           "involved",
                           "micro",
                           "macro",
                           "notmacro"
                        ]
                     },
                     {
                        "type": "null"
                     }
                  ]
               },
               "default": {},
               "description": "Involvement pattern for the contralateral side of the neck.",
               "title": "Contra",
               "type": "object"
            }
         },
         "title": "InvolvementConfig",
         "type": "object"
      },
      "LyDataset": {
         "description": "Specification of a dataset.",
         "properties": {
            "year": {
               "description": "Release year of dataset.",
               "exclusiveMinimum": 0,
               "maximum": 2026,
               "title": "Year",
               "type": "integer"
            },
            "institution": {
               "description": "Institution's short code. E.g., University Hospital Zurich: `usz`.",
               "minLength": 1,
               "title": "Institution",
               "type": "string"
            },
            "subsite": {
               "description": "Tumor subsite(s) patients in this dataset were diagnosed with.",
               "minLength": 1,
               "title": "Subsite",
               "type": "string"
            },
            "repo_name": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "lycosystem/lydata",
               "description": "GitHub `repository/owner`.",
               "title": "Repo Name"
            },
            "ref": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "main",
               "description": "Branch/tag/commit of the repo.",
               "title": "Ref"
            },
            "local_dataset_dir": {
               "anyOf": [
                  {
                     "format": "directory-path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Path to directory containing all the dataset subdirectories. So, e.g. if `path_on_disk` is `~/datasets` and the dataset is `2023-clb-multisite`, then the CSV file is expected to be at `~/datasets/2023-clb-multisite/data.csv`.",
               "title": "Local Dataset Dir"
            }
         },
         "required": [
            "year",
            "institution",
            "subsite"
         ],
         "title": "LyDataset",
         "type": "object"
      },
      "ModalityConfig": {
         "description": "Define a diagnostic or pathological modality.",
         "properties": {
            "spec": {
               "description": "Specificity of the modality.",
               "maximum": 1.0,
               "minimum": 0.5,
               "title": "Spec",
               "type": "number"
            },
            "sens": {
               "description": "Sensitivity of the modality.",
               "maximum": 1.0,
               "minimum": 0.5,
               "title": "Sens",
               "type": "number"
            },
            "kind": {
               "default": "clinical",
               "description": "Clinical modalities cannot detect microscopic disease.",
               "enum": [
                  "clinical",
                  "pathological"
               ],
               "title": "Kind",
               "type": "string"
            }
         },
         "required": [
            "spec",
            "sens"
         ],
         "title": "ModalityConfig",
         "type": "object"
      },
      "ModelConfig": {
         "description": "Define which of the ``lymph`` models to use and how to set them up.",
         "properties": {
            "external_file": {
               "anyOf": [
                  {
                     "format": "file-path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Path to a Python file that defines a model.",
               "title": "External File"
            },
            "class_name": {
               "default": "Unilateral",
               "description": "Name of the model class to use.",
               "enum": [
                  "Unilateral",
                  "Bilateral",
                  "Midline"
               ],
               "title": "Class Name",
               "type": "string"
            },
            "constructor": {
               "default": "binary",
               "description": "Trinary models differentiate btw. micro- and macroscopic disease.",
               "enum": [
                  "binary",
                  "trinary"
               ],
               "title": "Constructor",
               "type": "string"
            },
            "max_time": {
               "default": 10,
               "description": "Max. number of time-steps to evolve the model over.",
               "title": "Max Time",
               "type": "integer"
            },
            "named_params": {
               "default": null,
               "description": "Subset of valid model parameters a sampler may provide in the form of a dictionary to the model instead of as an array. Or, after sampling, with this list, one may safely recover which parameter corresponds to which index in the sample.",
               "items": {
                  "type": "string"
               },
               "title": "Named Params",
               "type": "array"
            },
            "kwargs": {
               "additionalProperties": true,
               "default": {},
               "description": "Additional keyword arguments to pass to the model constructor.",
               "title": "Kwargs",
               "type": "object"
            }
         },
         "title": "ModelConfig",
         "type": "object"
      },
      "SamplingConfig": {
         "description": "Settings to configure the MCMC sampling.",
         "properties": {
            "storage_file": {
               "description": "Path to HDF5 file store results or load last state.",
               "format": "path",
               "title": "Storage File",
               "type": "string"
            },
            "history_file": {
               "anyOf": [
                  {
                     "format": "path",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Path to store the burn-in metrics (as CSV file).",
               "title": "History File"
            },
            "dataset": {
               "default": "mcmc",
               "description": "Name of the dataset in the HDF5 file.",
               "title": "Dataset",
               "type": "string"
            },
            "cores": {
               "anyOf": [
                  {
                     "exclusiveMinimum": 0,
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 2,
               "description": "Number of cores to use for parallel sampling. If `None`, no parallel processing is used.",
               "title": "Cores"
            },
            "seed": {
               "default": 42,
               "description": "Seed for the random number generator.",
               "title": "Seed",
               "type": "integer"
            },
            "walkers_per_dim": {
               "default": 20,
               "description": "Number of walkers per parameter space dimension.",
               "title": "Walkers Per Dim",
               "type": "integer"
            },
            "check_interval": {
               "default": 50,
               "description": "Check for convergence each time after this many steps.",
               "title": "Check Interval",
               "type": "integer"
            },
            "trust_factor": {
               "default": 50.0,
               "description": "Trust the autocorrelation time only when it's smaller than this factor times the length of the chain.",
               "title": "Trust Factor",
               "type": "number"
            },
            "relative_thresh": {
               "default": 0.05,
               "description": "Relative threshold for convergence.",
               "title": "Relative Thresh",
               "type": "number"
            },
            "burnin_steps": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Number of burn-in steps to take. If None, burn-in runs until convergence.",
               "title": "Burnin Steps"
            },
            "num_steps": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 100,
               "description": "Number of steps to take in the MCMC sampling.",
               "title": "Num Steps"
            },
            "thin_by": {
               "default": 10,
               "description": "How many samples to draw before for saving one.",
               "title": "Thin By",
               "type": "integer"
            },
            "inverse_temp": {
               "default": 1.0,
               "description": "Inverse temperature for thermodynamic integration. Note that this is not yet fully implemented.",
               "title": "Inverse Temp",
               "type": "number"
            }
         },
         "required": [
            "storage_file"
         ],
         "title": "SamplingConfig",
         "type": "object"
      },
      "ScenarioConfig": {
         "description": "Define a scenario for which e.g. prevalences and risks may be computed.",
         "properties": {
            "t_stages": {
               "description": "List of T-stages to marginalize over in the scenario.",
               "examples": [
                  [
                     "early"
                  ],
                  [
                     3,
                     4
                  ]
               ],
               "items": {
                  "anyOf": [
                     {
                        "type": "integer"
                     },
                     {
                        "type": "string"
                     }
                  ]
               },
               "title": "T Stages",
               "type": "array"
            },
            "t_stages_dist": {
               "default": [
                  1.0
               ],
               "description": "Distribution over T-stages to use for marginalization.",
               "examples": [
                  [
                     1.0
                  ],
                  [
                     0.6,
                     0.4
                  ]
               ],
               "items": {
                  "type": "number"
               },
               "title": "T Stages Dist",
               "type": "array"
            },
            "midext": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Whether the patient's tumor extends over the midline.",
               "title": "Midext"
            },
            "mode": {
               "default": "HMM",
               "description": "Which underlying model architecture to use.",
               "enum": [
                  "HMM",
                  "BN"
               ],
               "title": "Mode",
               "type": "string"
            },
            "involvement": {
               "$ref": "#/$defs/InvolvementConfig",
               "default": {
                  "ipsi": {},
                  "contra": {}
               }
            },
            "diagnosis": {
               "$ref": "#/$defs/DiagnosisConfig",
               "default": {
                  "ipsi": {},
                  "contra": {}
               }
            }
         },
         "required": [
            "t_stages"
         ],
         "title": "ScenarioConfig",
         "type": "object"
      }
   },
   "required": [
      "graph",
      "sampling",
      "prevalences",
      "data"
   ]
}

field modalities: dict[str, ModalityConfig] = {}#

Maps names of diagnostic modalities to their specificity/sensitivity.

field prevalences: HDF5FileStorage [Required]#

Storage for the computed prevalences.

field data: DataConfig [Required]#
cli_cmd() None[source]#

Start the prevalences subcommand.

Command Help#

Usage: lyscripts compute prevalences [-h] [--configs list[Path]]
                                     [--graph [JSON]]
                                     [--graph.tumor dict[str,list[str]]]
                                     [--graph.lnl dict[str,list[str]]]
                                     [--model [JSON]]
                                     [--model.external-file {Path,null}]
                                     [--model.class-name {Unilateral,Bilateral,Midline}]
                                     [--model.constructor {binary,trinary}]
                                     [--model.max-time int]
                                     [--model.named-params Sequence[str]]
                                     [--model.kwargs dict[str,Any]]
                                     [--distributions dict[str,JSON]]
                                     [--cache-dir Path]
                                     [--scenarios list[JSON]]
                                     [--sampling [JSON]]
                                     [--sampling.storage-file Path]
                                     [--sampling.history-file {Path,null}]
                                     [--sampling.dataset str]
                                     [--sampling.cores {int,null}]
                                     [--sampling.seed int]
                                     [--sampling.walkers-per-dim int]
                                     [--sampling.check-interval int]
                                     [--sampling.trust-factor float]
                                     [--sampling.relative-thresh float]
                                     [--sampling.burnin-steps {int,null}]
                                     [--sampling.num-steps {int,null}]
                                     [--sampling.thin-by int]
                                     [--sampling.inverse-temp float]
                                     [--modalities dict[str,JSON]]
                                     [--prevalences [JSON]]
                                     [--prevalences.file Path]
                                     [--prevalences.dataset {str,null}]
                                     [--data [JSON]]
                                     [--data.source [{Path,JSON}]]
                                     [--data.source.year int]
                                     [--data.source.institution str]
                                     [--data.source.subsite str]
                                     [--data.source.repo-name {str,null}]
                                     [--data.source.ref {str,null}]
                                     [--data.source.local-dataset-dir {Path,null}]
                                     [--data.side {{ipsi,contra},null}]
                                     [--data.mapping dict[{{0,1,2,3,4},str},{int,str}]]

Predict the prevalence of an involvement pattern from model samples.

Options:
  -h, --help            show this help message and exit
  --configs list[Path]  Path to the YAML file(s) that contain the
                        configuration(s). Configs from YAML files may be
                        overwritten by command line arguments. When multiple
                        files are specified, the configs are merged in the
                        order they are given. Note that every config file must
                        have a `version: 1` key in it. (default:
                        ['config.yaml'])
  --distributions dict[str,JSON]
                        Mapping of model T-categories to predefined
                        distributions over diagnose times. (default: {})
  --cache-dir Path      Cache directory for storing function calls. (default:
                        /home/docs/checkouts/readthedocs.org/user_builds/lyscr
                        ipts/checkouts/latest/docs/source/.cache)
  --scenarios list[JSON]
                        List of scenarios to compute risks for. (default: [])
  --modalities dict[str,JSON]
                        Maps names of diagnostic modalities to their
                        specificity/sensitivity. (default: {})

Graph Options:
  Specifies how the tumor(s) and LNLs are connected in a DAG.

  --graph [JSON]        set graph from JSON string (default: {})
  --graph.tumor dict[str,list[str]]
                        Define the name of the tumor(s) and which LNLs it/they
                        drain to. (required)
  --graph.lnl dict[str,list[str]]
                        Define the name of the LNL(s) and which LNLs it/they
                        drain to. (required)

Model Options:
  Define which of the ``lymph`` models to use and how to set them up.

  --model [JSON]        set model from JSON string (default: {})
  --model.external-file {Path,null}
                        Path to a Python file that defines a model. (default:
                        None)
  --model.class-name {Unilateral,Bilateral,Midline}
                        Name of the model class to use. (default: Unilateral)
  --model.constructor {binary,trinary}
                        Trinary models differentiate btw. micro- and
                        macroscopic disease. (default: binary)
  --model.max-time int  Max. number of time-steps to evolve the model over.
                        (default: 10)
  --model.named-params Sequence[str]
                        Subset of valid model parameters a sampler may provide
                        in the form of a dictionary to the model instead of as
                        an array. Or, after sampling, with this list, one may
                        safely recover which parameter corresponds to which
                        index in the sample. (default: None)
  --model.kwargs dict[str,Any]
                        Additional keyword arguments to pass to the model
                        constructor. (default: {})

Sampling Options:
  Settings to configure the MCMC sampling.

  --sampling [JSON]     set sampling from JSON string (default: {})
  --sampling.storage-file Path
                        Path to HDF5 file store results or load last state.
                        (required)
  --sampling.history-file {Path,null}
                        Path to store the burn-in metrics (as CSV file).
                        (default: null)
  --sampling.dataset str
                        Name of the dataset in the HDF5 file. (default: mcmc)
  --sampling.cores {int,null}
                        Number of cores to use for parallel sampling. If
                        `None`, no parallel processing is used. (default: 2)
  --sampling.seed int   Seed for the random number generator. (default: 42)
  --sampling.walkers-per-dim int
                        Number of walkers per parameter space dimension.
                        (default: 20)
  --sampling.check-interval int
                        Check for convergence each time after this many steps.
                        (default: 50)
  --sampling.trust-factor float
                        Trust the autocorrelation time only when it's smaller
                        than this factor times the length of the chain.
                        (default: 50.0)
  --sampling.relative-thresh float
                        Relative threshold for convergence. (default: 0.05)
  --sampling.burnin-steps {int,null}
                        Number of burn-in steps to take. If None, burn-in runs
                        until convergence. (default: null)
  --sampling.num-steps {int,null}
                        Number of steps to take in the MCMC sampling.
                        (default: 100)
  --sampling.thin-by int
                        How many samples to draw before for saving one.
                        (default: 10)
  --sampling.inverse-temp float
                        Inverse temperature for thermodynamic integration.
                        Note that this is not yet fully implemented. (default:
                        1.0)

Prevalences Options:
  HDF5 file storage for in- and outputs of computations.

  --prevalences [JSON]  set prevalences from JSON string (default: {})
  --prevalences.file Path
                        Path to the HDF5 file. Parent directories are created
                        if needed. (required)
  --prevalences.dataset {str,null}
                        Name of the dataset in the HDF5 file. Save/load
                        methods can override this. (default: null)

Data Options:
  Where to load lymphatic progression data from and how to feed it into a
  model.

  --data [JSON]         set data from JSON string (default: {})
  --data.side {{ipsi,contra},null}
                        Side of the neck to load data for. Only for Unilateral
                        models. (default: null)
  --data.mapping dict[{{0,1,2,3,4},str},{int,str}]
                        Optional mapping of numeric T-stages to model
                        T-stages. (default factory: DataConfig.<lambda>)

Data.Source Options:
  Specification of a dataset.

  --data.source [{Path,JSON}]
                        set data.source from JSON string (default: {})
  --data.source.year int
                        Release year of dataset. (required)
  --data.source.institution str
                        Institution's short code. E.g., University Hospital
                        Zurich: `usz`. (required)
  --data.source.subsite str
                        Tumor subsite(s) patients in this dataset were
                        diagnosed with. (required)
  --data.source.repo-name {str,null}
                        GitHub `repository/owner`. (default:
                        lycosystem/lydata)
  --data.source.ref {str,null}
                        Branch/tag/commit of the repo. (default: main)
  --data.source.local-dataset-dir {Path,null}
                        Path to directory containing all the dataset
                        subdirectories. So, e.g. if `path_on_disk` is
                        `~/datasets` and the dataset is `2023-clb-multisite`,
                        then the CSV file is expected to be at
                        `~/datasets/2023-clb-multisite/data.csv`. (default:
                        null)