diff --git a/capellambse_context_diagrams/collectors/dataflow_view.py b/capellambse_context_diagrams/collectors/dataflow_view.py index 3802e347..e706f2cb 100644 --- a/capellambse_context_diagrams/collectors/dataflow_view.py +++ b/capellambse_context_diagrams/collectors/dataflow_view.py @@ -22,6 +22,7 @@ def only_involved( functions: cabc.Iterable[fa.FunctionalExchange], attributes: tuple[str, str], ) -> cabc.Iterable[fa.FunctionalExchange]: + """Exchange filter function for collecting edges.""" src_attr, trg_attr = attributes src_getter = operator.attrgetter(src_attr) trg_getter = operator.attrgetter(trg_attr) @@ -44,6 +45,7 @@ def collector( cabc.Iterable[fa.FunctionalExchange], ] = only_involved, ) -> _elkjs.ELKInputData: + """Main collector that calls either default or portless collectors.""" return COLLECTORS[diagram.type](diagram, params, exchange_filter) @@ -60,6 +62,7 @@ def collector_portless( ], attribute: str = "involved_activities", ) -> _elkjs.ELKInputData: + """Collector function for the operational layer.""" data = makers.make_diagram(diagram) activities = getattr(diagram.target, attribute) filter = functools.partial( @@ -110,6 +113,7 @@ def collector_default( ], attribute: str = "involved_functions", ) -> _elkjs.ELKInputData: + """Collector for all other layers than operational architecture.""" data = makers.make_diagram(diagram) functions = getattr(diagram.target, attribute) filter = functools.partial( @@ -153,3 +157,4 @@ def collector_default( modeltypes.DiagramType.OAIB: collector_portless, modeltypes.DiagramType.SDFB: collector_default, } +"""Collector registry.""" diff --git a/docs/data_flow_view.md b/docs/data_flow_view.md new file mode 100644 index 00000000..fa101353 --- /dev/null +++ b/docs/data_flow_view.md @@ -0,0 +1,35 @@ + + +# DataFlow View Diagram + +You can access the +`.data_flow_view` on an OperationalCapability or Capability. The data flow +diagram is similar to the generic context diagram but it collects differently. +Here collection is done from the outside to the inside, meaning it starts on +the involved functions and collects the edges from there if they exist. This +results in revealing missing edges and possible modelling errors. +The diagram elements are collected from the +`.involved_activities` or `.involved_functions` attribute. + +??? example "DataFlow View Diagram of `OperationalCapability` `Eat food`" + + ``` py + import capellambse + + model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") + diag = model.by_uuid("3b83b4ba-671a-4de8-9c07-a5c6b1d3c422").data_flow_view + diag.as_svgdiagram.save(pretty=True) + ``` +
+ +
[OAIB] DataFlow View Diagram of Eat food
+
+ +## Check out the code + +To understand the collection have a look into the +[`data_flow_view`][capellambse_context_diagrams.collectors.dataflow_view] +module. diff --git a/mkdocs.yml b/mkdocs.yml index 9572963b..11b56c02 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -91,8 +91,10 @@ nav: - Styling: extras/styling.md - Tree View: - Overview: tree_view.md - - 🔥Realization View🔥: + - Realization View: - Overview: realization_view.md + - 🔥 DataFlow View 🔥: + - Overview: data_flow_view.md - Code Reference: reference/ extra_css: