Overview
This blog is about where technology meets the behavioural sciences, so here we have a post describing how technology can be an adjunct to encourage adherence to a weight management intervention. In this example we show how to monitor progress of the 5:2 Fast Diet using the Goal Attainment Scale method together with actual weight measurement observations. The technology consists of a stateless complex event processing (CEP) decision service that can reason over a time series of observations to apply rules and output insights to inform and reward the participant and reinforce adherence. WeightWatcher is even easier on OpenShift, check out Decision Service Made Easy with OpenShift .
Background
The technique applies some of the concepts and tools discussed in CEP made EasyR and Really Simple Rules Service and can be inspected at the GitHub link below. The model is generalisable as it essentially consists of an event stream rules engine processing a payload of incoming facts and then returning a payload of outgoing facts – FIFO – facts-in-facts-out. The stateless design makes it easy to automate deployment and scale-out to manage interventions with large numbers of participants.
Use Cases
The demonstration includes two example use cases and is intended to reflect a scenario in which a participant has enrolled himself into a weight management intervention based on the 5:2 Fast Diet. Each day he weighs himself on a Withings WiFi scale. On some regular basis the weight observations are aggregated and processed to calculate relevant statistics. The participant self-reports on a weekly basis adherence to the fasting regime. Internet-of-Things meets Quantified-Self.
Weight Watcher
The “Weight Watch” sample shows an invocation in which a set of facts containing weight measurements are sent to the decision service. The decision service then reasons over the inputs to derive CEP insights such as average weight, least weight and weight change over a rolling time window. The request consists of facts representing Participant, Goal and Observation data records. The Participant records capture details of the user, Goal captures the Participant’s target weight objectives and Observation records a time series of weight measurements. The response payload then returns a set of facts reporting the derived insights.
Goal Attainment Scale
The “Goal Attainment” (GAS) sample demonstrates a use case in which the Participant has elected to enter into a period of intermittent fasting, known as the Fast Diet http://thefastdiet.co.uk/. The GAS fact represents the Participant’s number of fasting day goals over the week, described in ranges of worst through to best outcomes, refer http://en.wikipedia.org/wiki/Goal_Attainment_Scaling for details on the method. The Observation records then report back actual days of fasting in the previous weeks. The Decision Server then responds back with performance against goals. The GAS fact table is a candidate for remodelling as a, e.g. a Guided Decision Table.
Technical Design
The demonstration showcases a stateless complex event processing (CEP) application of the JBoss BRMS 6 feature known as the Real Time Decision Server. The approach focuses on technical design requirements one might encounter in a DevOps/microservices scenario such as automated and scriptable deployment, API based interaction and container based packaging. Deployments to traditional and docker based formats are supported including for OpenShift V3. A nginx based load balancer to simulate high availability use cases is also described. Examples show cURL, php and R based clients interacting with the Decision Server.
Clone. Deploy. Enjoy!
Clone down this repository which includes a Quick Start documentation guide with technical installation details and content covering additional use cases and tests.
https://bitbucket.org/emergile/weightwatcher
The application has been updated to leverage some new features in the OpenShift and BRMS/Drools platforms as described here.
Applications
This weightwatcher project has been forked for use in various applications. It is the basis of the JBoss Demo Central example as per the link below and is also featured in some of the OpenShift training materials.
https://github.com/jbossdemocentral/brms-weightwatcher-realtime-decision-server-demo