capellambse.extensions.metrics package

Tools for statistical evaluation of model contents.

capellambse.extensions.metrics.get_summary_badge(model)

Provide visual summary of model contents.

Return type:

str

Parameters:

model (MelodyModel)

Submodules

capellambse.extensions.metrics.collector module

Collection of tools for collection of statistical data from a model.

Objects of interest are those that we see people working on most. We think that counting those may help us with model complexity evaluation - for example identify if a model is big or small or see where the modeling focus is (problem space / solution space / balanced)

capellambse.extensions.metrics.collector.quantify_model_layers(model)

Count objects of interest and diagrams on model layers.

Return type:

tuple[list[int], list[int]]

Returns:

  • list – The number of interesting objects per model layer

  • list – The number of diagrams per model layer

Parameters:

model (MelodyModel)

Notes

The order of numbers in a list corresponds to the order of model layers - OA, SA, LA, PA.

capellambse.extensions.metrics.composer module

Collection of tools for drawing model complexity assessment badge.

capellambse.extensions.metrics.composer.LEGEND = ((2, 'Operational Analysis'), (36, 'System Analysis'), (66, 'Logical Architecture'), (99, 'Physical Architecture'))

The x-offset and label of each legend entry.

capellambse.extensions.metrics.composer.draw_bar(data, max_width, x, y, height=8, show_label_threshold=0.1)

Construct a 4-segment bar plot (SVG string).

Segment spacing is defined by {data}; Sum of {data} must match 1 for the thing to work the right way. Segments are labeled with “%” if the width is above {show_label_threshold}.

Return type:

str

Parameters:
capellambse.extensions.metrics.composer.draw_diagrams_icon(x, y)

Create simple diagram icon (SVG string).

Parameters:
capellambse.extensions.metrics.composer.draw_group(contents, fill=None, font_size=None, font_family=None)

Construct a group (SVG string).

Return type:

str

Parameters:
  • contents (list[str])

  • fill (str | None)

  • font_size (float | None)

  • font_family (str | None)

capellambse.extensions.metrics.composer.draw_labeled_bar(x, y, label, segments, draw_icon)

Construct a bar with label and icon (SVG string).

Return type:

str

Parameters:
capellambse.extensions.metrics.composer.draw_legend(x, y)

Construct plot legend (SVG string).

Parameters:
capellambse.extensions.metrics.composer.draw_objects_icon(x, y)

Create simple objects icon (SVG string).

Parameters:
capellambse.extensions.metrics.composer.draw_rect(x, y, width, height, fill='#FFF', stroke='#333', stroke_width=0)

Construct a rectangle (SVG string).

Return type:

str

Parameters:
capellambse.extensions.metrics.composer.draw_summary_badge(objects, diagrams, scale=4.0)

Construct summary badge (SVG string).

Return type:

str

Parameters:
capellambse.extensions.metrics.composer.draw_text(x, y, text, font_size=None)

Construct a text element (SVG string).

Return type:

str

Parameters: