Skip to content

Create mermaid diagram generator for use with DecisionTableobjects #869

@ahouseholder

Description

@ahouseholder

Describe the solution you'd like

In ssvc.decision_tables.helpers, create a method like:

dt_to_mermaid(dt: DecisionTable) -> str:
    """
    Given a decision table, generate a mermaid diagram that presents it as a tree.
    """

that returns a mermaid block:

```mermaid
 flowchart LR
...etc...
```

Additional Context

Bonus round:

  1. Add a method in ssvc.doc_helpers that takes a DecisionTable object as its argument and generates a tabbed example block inside a !!! note similar to how ssvc.doc_helpers.example_block does this for a DecisionPoint object.
    def example_block(
    dp: SsvcDecisionPoint, indent: int = 4, include_json: bool = True
    ) -> str:
    """Given a decision point, return a markdown block that contains an example of the decision point."""
  2. Update each of the markdown documentation pages for the known decision models to include this code generation block inside a python exec="true" idprefix="" markdown block.

See for example

https://github.com/CERTCC/SSVC/blob/0e85eea05ea373a048893176d6a2c22a08ec348a/docs/reference/decision_points/automatable.md?plain=1#L3C1-L8

but for ssvc.decision_tables.ssvc.supplier_dt etc.

Sub-issues

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesttech/backendBack-end tools, code, infrastructure

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions