write_chada_tables_plantuml#

mochada_kit.tables.write_chada_tables_plantuml(data_path, out_path=None, load_path=None, out_name=None, title=None, theme_name='plasma', copy_theme_to_local=False, linked=True, scale=None)#

Write a plantuml code file specifying a json diagram for each of five different cases.

These are:

  1. “contents” element –> Overview element. Filename: same as the json plus _overview.puml.

  2. “contents” element –> User Case element. Filename: same as the json plus _user_case.puml.

  3. “contents” element –> Experiment element. Filename: same as the json plus _experiment.puml.

  4. “contents” element –> Raw Data element. Filename: same as the json plus _raw_data.puml.

  5. “contents” element –> Data Processing element. Filename: same as the json plus _data_processing.puml.

By default, the puml code files will be saved in the same directory as the json/yaml file specified by data_path. If the argument out_path is not None, the puml code files will be saved to the path specified by out_path.

Highlights will be applied to all rows of the “contents” element and to the first (“title”) row of each other element, according to the bespoke CHADA theme specified by theme_name.

Specifying linked=True will add hyperlinks to the “contents” element. Once the puml code has been run against plantuml.jar resulting in svg image files, if these image files are all located in the same directory, you can easily navigate from one image to another by clicking the hyperlinks.

Parameters:
data_pathSTR or pathlib.Path

Absolute path or path relative to the current working directory pointing to a json or yaml file containing the CHADA data. If data_path points to a json file, the format of the file must be based on mochada_kit/templates/chada_tables_template.json. If data_path points to a yaml file, the format of the file must be based on mochada_kit/templates/chada_tables_template.yaml.

out_pathSTR, pathlib.Path or python:None, optional

Specifies the folder where the plantuml code file will be saved. This allows the puml code and json/yaml file to be located in different folders, if desired. If None, the puml code is saved in the same folder as the data_path. If not None, if it is a relative path, it is assumed to be relative to data_path. An absolute path can also be supplied. The default is None.

load_pathSTR, pathlib.Path or python:None, optional

If data_path points to a json file: if load_path = None, the json data will be directly written into the puml code rather than being loaded dynamically. If load_path is not None, load_path is the either the absolute path to the json file containing the data OR the relative path from out_path pointing to the data_path. In this case, the json data will be loaded dynamically and not written into the puml code. If data_path points to a yaml file: load_path has no effect, the data must always be written into the puml code. The default is None.

out_nameSTR or python:None, optional

By default, the puml code output will have the same filename as the json input. To use a different filename for the output, please specify a string as out_name. The default is None.

titleSTR, LIST or python:None, optional

Either a string or list of strings defining a title for the plot, or None, in which case, no title will be shown. If a list of strings is supplied, each item in the list will appear in a new row of the title. You can apply CREOLE syntax to the title strings e.g. to change the colour, make a table, make a link etc. All options are here: https://plantuml.com/creole. The default is None.

theme_nameSTR, optional

The name of one of the bespoke MOCHADA themes in the default folder given by __THEMES_DIR__. Only the part of the name after “MOCHADA-” is needed, i.e. to apply the theme ‘MOCHADA-plasma’, theme_name=’plasma’. The default is ‘plasma’.

linkedBOOL, optional

If True, add hyperlinks to the “contents” element of all diagrams. Once the puml code has been run against plantuml.jar resulting in svg image files, if these image files are all located in the same directory, you can easily navigate from one image to another by clicking the hyperlinks (if they are opened in a browser). Links will not work with png output images. The also do not work if you insert an svg image into Microsoft Word or jupyter notebook. The default is True.

scaleSTR, INT or FLOAT, optional

A parameter which helps to scale the diagram for png output. NOT necessary to use this with svg output as these can be scaled to any size later. Docs are here: https://plantuml.com/commons#4252b72e6ebcd4d4.

Common values could be:

  • 1.5 (to set the aspect ratio),

  • “1/3” (to set the aspect ratio)

  • “1024 width” (to set the width to 1024 pixels)

  • “100*200” (to set the output size to 100 by 200 pixels).