### [Precedence diagrams](https://www.bupar.net/precedence.html)

The precedence matrix shows the flows from one activity to another in a rectangular format. A precedence diagram is a two-dimensional matrix showing the flows between activities. It can contain different type values, by adjusting the type argument.

In `r-programming` it can be calculated using `bupar` package.

```
#Example

# Absolute Frequencies
patients %>%
    precedence_matrix(type = "absolute") 

```

**Output**

```
## # A tibble: 13 x 3
##    antecedent            consequent                n
##    <fct>                 <fct>                 <int>
##  1 Triage and Assessment End                       2
##  2 Blood test            End                       1
##  3 Start                 Registration            500
##  4 Registration          Triage and Assessment   500
##  5 MRI SCAN              Discuss Results         236
##  6 Triage and Assessment Blood test              237
##  7 Blood test            MRI SCAN                236
##  8 Discuss Results       Check-out               492
##  9 X-Ray                 End                       2
## 10 Check-out             End                     491
## 11 X-Ray                 Discuss Results         259
## 12 Triage and Assessment X-Ray                   261
## 13 Discuss Results       End                       3

```

How to get the precedence matrix using python? Is there any package where a precedence matrix is obtained in python?