Skip to content

Commit

Permalink
docs(data-flow): Document DataFlow View diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger committed Mar 19, 2024
1 parent 3960e31 commit f5a113d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
5 changes: 5 additions & 0 deletions capellambse_context_diagrams/collectors/dataflow_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)


Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -153,3 +157,4 @@ def collector_default(
modeltypes.DiagramType.OAIB: collector_portless,
modeltypes.DiagramType.SDFB: collector_default,
}
"""Collector registry."""
35 changes: 35 additions & 0 deletions docs/data_flow_view.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!--
~ SPDX-FileCopyrightText: 2022 Copyright DB InfraGO AG and the capellambse-context-diagrams contributors
~ SPDX-License-Identifier: Apache-2.0
-->

# 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)
```
<figure markdown>
<img src="../assets/images/DatFlow view of Eat food.svg">
<figcaption>[OAIB] DataFlow View Diagram of Eat food</figcaption>
</figure>

## Check out the code

To understand the collection have a look into the
[`data_flow_view`][capellambse_context_diagrams.collectors.dataflow_view]
module.
4 changes: 3 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f5a113d

Please sign in to comment.