Text this: Modelling in- and out-patient rehabilitation for substance abuse in dynamic environments