bupar - need to show node data in process_matrix

36 views Asked by At

I run the code below to produce a bupaR process map, and I get all the time values for both the edges and nodes:

my_data %>% process_map(type_nodes = processmapR::performance(FUN = mean,units = "hours"),type_edges = processmapR::performance(units = "hours"))

Now, I can produce data for just the edges using :

my_Data %>% process_matrix(performance()

antecedent      consequent     n         flow_time
<fct>           <fct>          <dbl>     <dbl>
 1 Step1        step2          2         0.0417
 2 step1        step4          27        0.926 
 3 STEP1        step5          1         12.4 

This is fine for edges, but am struggling to work out how I can extract the times for the nodes.

Other posts like bupaR - changing the metric the process map displays? nor the bupaR doco seems to help

The process_map can produce values for the nodes when its run, how does it extract this data?

1

There are 1 answers

0
Gert Janssenswillen On

The most direct way to get the information from nodes from a process map is using the get_activities() function.

The example below shows an example with patients and a default processmap.

patients %>% process_map() %>% get_activities()
# A tibble: 9 × 3
  node                  from_id value
  <chr>                   <int> <dbl>
1 ARTIFICIAL_END              1   500
2 ARTIFICIAL_START            2   500
3 Blood test                  3   237
4 Check-out                   4   492
5 Discuss Results             5   495
6 MRI SCAN                    6   236
7 Registration                7   500
8 Triage and Assessment       8   500
9 X-Ray                       9   261

The resulting data.frame is not the most 'clean' (e.g. the artificial nodes, the 'from_id'), which is why this function is currently not that promoted on the website. There is an get_flows() as well, if you want to skip the process_matrix and directly use the flow-data from the process map.