AIM
 All Classes Functions Variables Typedefs Enumerations
CoachingEngine::CalibrationCoach Class Reference

#include <CalibrationCoach.h>

Inheritance diagram for CoachingEngine::CalibrationCoach:
CoachingEngine::Coach AIM

Public Member Functions

 CalibrationCoach (std::string name="calibration_coach")
 
virtual void setGoal (InitializationType type, const AIMValue &init, bool dynamic=true)
 
virtual void processDateValue (const std::string &sensor, const AIMValue &dateValue)
 
virtual std::vector
< TaskDescription
getFutureTasks (double start, double end)
 
virtual TaskDescription setTaskValueManually (std::string taskType, double taskStartDate, const AIMValue &data)
 
double getTimeActiveBaseline ()
 
double getSleepDurationBaseline ()
 
double getSleepStartBaseline ()
 
double getSleepEndBaseline ()
 
double getMentalResilienceBaseline ()
 
bool hasTimeActiveBaseline ()
 
bool hasSleepTimeBaseLine ()
 
bool hasMentalResilienceBaseLine ()
 
virtual void setProperties (const std::map< std::string, AIMValue > &properties)
 
int getMissingDays ()
 
Coach::Type getCoachAdvice ()
 
AIMValue getValues (double date)
 
virtual void pause (double time)
 
virtual void resume (double time)
 
- Public Member Functions inherited from CoachingEngine::Coach
 Coach (const Coach &other)
 
Coachoperator= (const Coach &rhs)
 
void addData (const AIMData &data)
 
void doTick ()
 
std::vector< AIMValuegetRequirements () const
 
bool requirementsAreUpdated (bool reset) const
 
virtual AIMValue getGoal () const
 
virtual std::vector
< TaskDescription
getCurrentTasks () const
 
virtual Status getStatus () const
 
virtual Type getType ()
 
virtual const std::map
< std::string, AIMValue > & 
getProperties ()
 
virtual std::map< std::string,
AIMValue
getMemberDataAsProperties () const
 
- Public Member Functions inherited from AIM
 AIM (std::string name="")
 
 AIM (const AIM &other)
 
AIMoperator= (const AIM &rhs)
 
virtual void addDataSubscriber (const std::string &key, AIM *subscriber)
 
virtual void removeDataSubscriber (const std::string &key)
 
virtual AIMValue setProperty (const std::string &key, AIMValue value)
 
virtual AIMValue getProperty (std::string key) const
 
virtual void sendData ()
 
virtual std::string exportProperties ()
 
virtual std::vector< std::pair
< std::string, AIMValue > > 
getOutputData (bool clear_output=false)
 
virtual std::vector< std::pair
< std::string, AIMValue > > 
getInputData (bool clear_input=false)
 
virtual AIMgetDataSubscriber (std::string subscriber)
 
virtual std::string getName () const
 

Static Public Attributes

static const std::string PROP_SENSORS = "sensors"
 
static const std::string PROP_SENSOR_VALUES = "sensor_values"
 
static const std::string PROP_MISSING_DAYS = "missing_days"
 
static const std::string PROP_BASELINE_VALUES = "baseline_values"
 
static const std::string PROP_IN_BACKGROUND = "on_foreground"
 
static const std::string FIELD_MANUAL_POSTFIX = "_manual"
 
static const std::string FIELD_SLEEP_START_DATE = "start_date"
 
static const std::string FIELD_SLEEP_END_DATE = "end_date"
 
static const std::string FIELD_SLEEP_SLEEPTIME = "sleepTime"
 
- Static Public Attributes inherited from CoachingEngine::Coach
static const std::string PROP_COMPLETED_TASKS = "completed_tasks"
 
static const std::string PROP_ACTIVE_TASKS = "active_tasks"
 
static const std::string PROP_STATUS = "status"
 
static const std::string PROP_GOAL = "goal"
 
static const std::string PROP_BASELINE = "baseline"
 
static const std::string PROP_DYNAMIC_COACH = "dynamic_coach"
 
static const std::string PROP_GOAL_TYPE = "goal_type"
 
static const std::string PROP_START_DATE = "start_date"
 
static const std::string PROP_END_DATE = "end_date"
 
static const std::string PROP_TOTAL_DAYS = "total_days"
 
static const std::string PROP_GAIN = "gain"
 
static const std::string PROP_CURRENT_TIME = "clock"
 
static const std::string PROP_START_PAUSE = "start_pause"
 
static const std::string OUTPUT_FIELD_COACH_TYPE = "coach_type"
 
static const std::string PROP_PAUSED_SECONDS = "paused_seconds"
 
- Static Public Attributes inherited from AIM
static const std::string VERSION = AIM_VERSION
 

Additional Inherited Members

- Public Types inherited from CoachingEngine::Coach
enum  Type {
  PHYSICAL_ACTIVITY, MENTAL_RESILIENCE, SLEEP_DURATION, JETLAG,
  SHIFTWORK, CALIBRATION, NONE, BIORHYTHM
}
 
enum  InitializationType { MANUAL_GOAL, POPULATION_GOAL, PERSONAL_GOAL }
 
enum  Status { UNINITIALIZED, GOAL_INITIALIZED, READY, PAUSED }
 
- Public Types inherited from AIM
typedef std::pair< std::string,
AIMValue
AIMData
 
typedef std::queue< AIMDataAIMDataQueue
 
typedef std::queue< AIMValueAIMValueQueue
 
typedef std::map< std::string,
AIMValueQueue
InputDataQueue
 
- Protected Types inherited from CoachingEngine::Coach
typedef std::map< std::string,
std::unordered_set< Task * > > 
SensorRoutes
 
- Protected Member Functions inherited from CoachingEngine::Coach
 Coach (Type coachType, std::string name="coach")
 
virtual void addActiveTask (Task &task)
 
virtual void removeActiveTask (Task *task)
 
virtual double calculateTargetValue (int week, double goalValue, double lastValue, double speed=(2.0/3.0))
 
virtual int getWeek (double date)
 
virtual double calculateGoal (std::string taskType, double currentValue, int weeksLeft)
 
virtual void decreaseGain (std::string taskType)
 
virtual void increaseGain (std::string taskType)
 
virtual void handleCompletedTask (Task *task)
 
virtual bool checkAndHandleNewWeek ()
 
virtual double calculateAverage (std::string taskType, double startDate, double endDate, int min_values=1, int nr_values=-1)
 
virtual void createNewTask (std::string taskType)
 
virtual std::pair< double, double > calculateTaskPeriod (double currentTime, std::string taskType="")
 
virtual void removeRoutesForTask (Task *task)
 
virtual TaskgetTask (TaskDescription::Type type)
 
- Protected Member Functions inherited from AIM
void setDataSubscribers (const std::map< std::string, AIM * > &subscribers)
 
void setInputDataQueue (const InputDataQueue &inputDataQueue)
 
void setOutputDataQueue (const AIMDataQueue &outputDataQueue)
 
- Protected Attributes inherited from CoachingEngine::Coach
const Type type
 
Status status
 
std::vector< Task * > activeTasks
 
std::vector< Task * > completedTasks
 
SensorRoutes routes
 
AIMValue goal
 
AIMValue baseline
 
Clock clock
 
bool dynamicCoach
 
InitializationType goalType
 
double end_date
 
double start_date
 
int total_days
 
AIMValue gain
 
- Protected Attributes inherited from AIM
std::string name
 
std::vector< AIMValuerequirements
 
bool requirementsUpdated
 
std::map< std::string, AIM * > dataSubscribers
 
std::map< std::string, AIMValueproperties
 
InputDataQueue inputDataQueue
 
AIMDataQueue outputDataQueue
 

Detailed Description

Implementation of the calibration coach. This coach coaches a user to calibrate the coaching engine.

Member Function Documentation

std::vector< TaskDescription > CoachingEngine::CalibrationCoach::getFutureTasks ( double  start,
double  end 
)
virtual

Return planned tasks for the specified time range.

Parameters
startStart date as Unix timestmap for the range to get planned tasks for,
endEnd date as Unix timestamp for the range to get planned tasks for.
Returns
A list of the tasks planned for the specified period.

Reimplemented from CoachingEngine::Coach.

int CoachingEngine::CalibrationCoach::getMissingDays ( )

Calculate the missing days

void CoachingEngine::CalibrationCoach::pause ( double  time)
virtual

Pause the coach

Parameters
timeThe current time

Reimplemented from CoachingEngine::Coach.

void CoachingEngine::CalibrationCoach::processDateValue ( const std::string &  sensor,
const AIMValue dateValue 
)
virtual

Called with the sensor and a date/value tuple.

Reimplemented from CoachingEngine::Coach.

void CoachingEngine::CalibrationCoach::resume ( double  time)
virtual

Un-pause the coach

Parameters
timeThe current time

Reimplemented from CoachingEngine::Coach.

void CoachingEngine::CalibrationCoach::setGoal ( InitializationType  type,
const AIMValue init,
bool  dynamic = true 
)
virtual

Set the goal of the Coach

The CalibrationCoach does not have an InitializationType and cannot be dynamic. The CalibrationCoach can be initialized with the AIMValue init which contains a map with sensor names to calibrate as key. When the CalibrationCoach is finished it's collecting data in the background (with optional requirement), without creating tasks When the CalibrationCoach is already running in the background it will be put in the foreground. A buffer of daily data for 30 days is kept for each sensor.

Parameters
typeUnused parameter
initThe AIMValue map with the sensors to calibrate as key.
dynamicUnused parameter

Reimplemented from CoachingEngine::Coach.

void CoachingEngine::CalibrationCoach::setProperties ( const std::map< std::string, AIMValue > &  properties)
virtual

set the properties of the coach

Reimplemented from CoachingEngine::Coach.

TaskDescription CoachingEngine::CalibrationCoach::setTaskValueManually ( std::string  taskType,
double  taskStartDate,
const AIMValue data 
)
virtual

Override the value of a task.

The status will be re-evaluated and set, and if the task is currently active, a message will be send about the status

Parameters
taskTypeThe Task::Type as string
taskStartDatethe start date of the task
dataThe sensor data
Returns
The updated Task will be returned as TaskDescritpion

Reimplemented from CoachingEngine::Coach.


The documentation for this class was generated from the following files: