A Logic Model Using the mermaid Diagram Language

workflow
Author

Andy Grogan-Kaylor

Published

February 7, 2024

Logic models are used extensively in program development and program evaluation. I have worked on a logic model in graphviz. Here is an implementation using the mermaid graphing language.

While still sometimes not completely intuitive, I think that the language of mermaid is more intuitive than my graphviz example.

mermaid is implemented in RStudio using Quarto. This logic model was made with RStudio.

This proof of concept makes use of subgraphs to organize the components of a logic model.

Like all programming languages, mermaid may facilitate automation, replication, and documentation of a project. In this way, using mermaid may make creating a logic model easier.

Like all programming languages, mermaid may be finicky and hard to tweak. In this way, using mermaid may make creating a logic model much more difficult.

It may be much easier to use PowerPoint or Google Slides to create a logic model!!!

Code
flowchart LR

    %% first block: Domains

    subgraph Domains
    direction TB
    D1(Workshops)
    D2(Publications)
    end

    %% second block: Activities

    subgraph Activities
    direction TB
    A1(Meetings)
    A2(Social Media Posts)
    A3(Information Cards)
    end

    %% third block: Outcomes

    subgraph Outcomes
    direction TB
    O1(Better Parenting)
    end

    %% links

    D1-->A1
    D2-->A2
    D2-->A3
    A1-->O1
    A2-->O1
    A3-->O1

flowchart LR

    %% first block: Domains

    subgraph Domains
    direction TB
    D1(Workshops)
    D2(Publications)
    end

    %% second block: Activities

    subgraph Activities
    direction TB
    A1(Meetings)
    A2(Social Media Posts)
    A3(Information Cards)
    end

    %% third block: Outcomes

    subgraph Outcomes
    direction TB
    O1(Better Parenting)
    end

    %% links

    D1-->A1
    D2-->A2
    D2-->A3
    A1-->O1
    A2-->O1
    A3-->O1