@@ -36,25 +36,27 @@ create_asu_trajectory <- function(env, patient_type, param) {
3636 }) | >
3737
3838 log_(function () {
39- dest <- get_attribute(env , " post_asu_destination" )
40- paste0(" \U 0001F3AF Planned ASU -> " , dest )
39+ dest_num <- get_attribute(env , " post_asu_destination" )
40+ dest <- param [[" map_num2val" ]][as.character(dest_num )]
41+ paste0(" \U 0001F3AF Planned ASU -> " , dest_num , " (" , dest , " )" )
4142 }, level = 1L ) | >
4243
4344 # Sample ASU LOS. For stroke patients, LOS distribution is based on
4445 # the planned destination after the ASU.
4546 set_attribute(" asu_los" , function () {
46- dest <- get_attribute(env , " post_asu_destination" )
47+ dest_num <- get_attribute(env , " post_asu_destination" )
48+ dest <- param [[" map_num2val" ]][as.character(dest_num )]
4749 if (patient_type == " stroke" ) {
4850 switch (
4951 dest ,
50- esd = param [[" dest " ]][[" los" ]][[" asu" ]][[" stroke_esd" ]],
51- rehab = param [[" dest " ]][[" los" ]][[" asu" ]][[" stroke_no_esd " ]],
52- other = param [[" dest " ]][[" los" ]][[" asu" ]][[" stroke_mortality" ]],
52+ esd = param [[" dist " ]][[" los" ]][[" asu" ]][[" stroke_esd" ]]() ,
53+ rehab = param [[" dist " ]][[" los" ]][[" asu" ]][[" stroke_noesd " ]]() ,
54+ other = param [[" dist " ]][[" los" ]][[" asu" ]][[" stroke_mortality" ]]() ,
5355 stop(" Stroke post-asu destination '" , dest , " ' invalid" ,
5456 call. = FALSE )
5557 )
5658 } else {
57- param [[" dest " ]][[" los" ]][[" asu" ]][[patient_type ]]()
59+ param [[" dist " ]][[" los" ]][[" asu" ]][[patient_type ]]()
5860 }
5961 }) | >
6062
@@ -72,7 +74,9 @@ create_asu_trajectory <- function(env, patient_type, param) {
7274 # If that patient's destination is rehab, then start on that trajectory
7375 branch(
7476 option = function () {
75- if (get_attribute(env , " post_asu_destination" ) == " rehab" ) 1L else 0L
77+ dest_num <- get_attribute(env , " post_asu_destination" )
78+ dest <- param [[" map_num2val" ]][as.character(dest_num )]
79+ if (dest == " rehab" ) 1L else 0L
7680 },
7781 continue = FALSE , # Do not continue main trajectory after branch
7882 create_rehab_trajectory(env , patient_type , param )
0 commit comments