Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
core_analytics\calculable Class Reference

Calculable dataset items abstract class. More...

Inheritance diagram for core_analytics\calculable:
core_analytics\local\indicator\base core_analytics\local\target\base core_analytics\local\indicator\discrete core_analytics\local\indicator\linear core_analytics\local\target\discrete core_analytics\local\target\linear core_analytics\local\indicator\binary core\analytics\indicator\read_actions core_analytics\local\indicator\community_of_inquiry_activity core_course\analytics\indicator\potential_cognitive_depth core_course\analytics\indicator\potential_social_breadth core_user\analytics\indicator\user_profile_set core_analytics\local\target\binary core\analytics\indicator\any_access_after_end core\analytics\indicator\any_access_before_start core\analytics\indicator\any_course_access core\analytics\indicator\any_write_action core\analytics\indicator\any_write_action_in_course core_course\analytics\indicator\activities_due core_course\analytics\indicator\completion_enabled core_course\analytics\indicator\no_student core_course\analytics\indicator\no_teacher core_user\analytics\indicator\user_track_forums mod_assign\analytics\indicator\activity_base mod_book\analytics\indicator\activity_base mod_chat\analytics\indicator\activity_base mod_choice\analytics\indicator\activity_base mod_data\analytics\indicator\activity_base mod_feedback\analytics\indicator\activity_base mod_folder\analytics\indicator\activity_base mod_forum\analytics\indicator\activity_base mod_glossary\analytics\indicator\activity_base mod_imscp\analytics\indicator\activity_base mod_label\analytics\indicator\activity_base mod_lesson\analytics\indicator\activity_base mod_lti\analytics\indicator\activity_base mod_page\analytics\indicator\activity_base mod_quiz\analytics\indicator\activity_base mod_resource\analytics\indicator\activity_base mod_scorm\analytics\indicator\activity_base mod_survey\analytics\indicator\activity_base mod_url\analytics\indicator\activity_base mod_wiki\analytics\indicator\activity_base mod_workshop\analytics\indicator\activity_base core_course\analytics\target\course_enrolments core_course\analytics\target\no_teaching core_user\analytics\target\upcoming_activities_due

Public Member Functions

 add_sample_data ($data)
 add_sample_data More...
 
 clear_sample_data ()
 clear_sample_data More...
 
 get_calculation_outcome ($value, $subtype=false)
 Returns how good the calculated value is. More...
 
 get_display_value ($value, $subtype=false)
 Returns the visible value of the calculated value. More...
 
 get_id ()
 The class id is the calculable class full qualified class name. More...
 
 save_calculation_info (\core_analytics\local\time_splitting\base $timesplitting, int $rangeindex)
 Stores in MUC the previously added data and it associates it to the provided $calculable. More...
 

Static Public Member Functions

static get_name ()
 Returns a lang_string object representing the name for the indicator or target. More...
 

Public Attributes

const OUTCOME_NEGATIVE = 3
 Negative calculation outcome.
 
const OUTCOME_NEUTRAL = 0
 Neutral calculation outcome.
 
const OUTCOME_OK = 2
 Positive calculation outcome.
 
const OUTCOME_VERY_NEGATIVE = 4
 Very negative calculation outcome.
 
const OUTCOME_VERY_POSITIVE = 1
 Very positive calculation outcome.
 

Protected Member Functions

 add_shared_calculation_info (int $sampleid, array $info)
 Adds info related to the current calculation for later use when generating insights. More...
 
 classify_value ($value, $ranges)
 Classifies the provided value into the provided range according to the ranges predicates. More...
 
 get_time_range_weeks_number ($starttime, $endtime)
 Returns the number of weeks a time range contains. More...
 
 limit_value ($calculatedvalue)
 Limits the calculated value to the minimum and maximum values. More...
 
 retrieve ($elementname, $sampleid)
 Retrieve the specified element associated to $sampleid. More...
 

Protected Attributes

core_analytics calculation_info null $calculationinfo = null
 
array[] $sampledata = array()
 

Detailed Description

Calculable dataset items abstract class.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ add_sample_data()

core_analytics\calculable::add_sample_data (   $data)

add_sample_data

Parameters
array$data
Return values
void

◆ add_shared_calculation_info()

core_analytics\calculable::add_shared_calculation_info ( int  $sampleid,
array  $info 
)
finalprotected

Adds info related to the current calculation for later use when generating insights.

Note that the data in $info array is reused across multiple samples, if you want to add data just for this sample you can use the sample id as key.

Please, note that you should be careful with how much data you add here as it can kill the server memory.

Parameters
int$sampleidThe sample id this data is associated with
array$infoThe data. Indexed by an id unique across the site. E.g. an activity id.
Return values
null

◆ classify_value()

core_analytics\calculable::classify_value (   $value,
  $ranges 
)
protected

Classifies the provided value into the provided range according to the ranges predicates.

Use:

  • eq as 'equal'
  • ne as 'not equal'
  • lt as 'lower than'
  • le as 'lower or equal than'
  • gt as 'greater than'
  • ge as 'greater or equal than'
Exceptions
coding_exception
Parameters
int | float$value
array$rangese.g. [ ['lt', 20], ['ge', 20] ]
Return values
float

◆ clear_sample_data()

core_analytics\calculable::clear_sample_data ( )

clear_sample_data

Return values
void

◆ get_calculation_outcome()

core_analytics\calculable::get_calculation_outcome (   $value,
  $subtype = false 
)
abstract

Returns how good the calculated value is.

Use one of core_analytics\calculable::OUTCOME_* values.

Parameters
float$value
string | false$subtype
Return values
int

Reimplemented in core_analytics\local\indicator\linear, core_analytics\local\indicator\binary, core_analytics\local\target\linear, core_analytics\local\target\discrete, and core_analytics\local\target\binary.

◆ get_display_value()

core_analytics\calculable::get_display_value (   $value,
  $subtype = false 
)

Returns the visible value of the calculated value.

Parameters
float$value
string | false$subtype
Return values
string

Reimplemented in core_analytics\local\indicator\linear, core_analytics\local\indicator\discrete, core_analytics\local\indicator\binary, and core_analytics\local\target\discrete.

◆ get_id()

core_analytics\calculable::get_id ( )

The class id is the calculable class full qualified class name.

Return values
string

◆ get_name()

static core_analytics\calculable::get_name ( )
staticabstract

Returns a lang_string object representing the name for the indicator or target.

Used as column identificator.

If there is a corresponding '_help' string this will be shown as well.

Return values
lang_string

Reimplemented in core_user\analytics\target\upcoming_activities_due, core_user\analytics\indicator\user_track_forums, core_user\analytics\indicator\user_profile_set, mod_workshop\analytics\indicator\social_breadth, mod_workshop\analytics\indicator\cognitive_depth, mod_wiki\analytics\indicator\social_breadth, mod_wiki\analytics\indicator\cognitive_depth, mod_url\analytics\indicator\social_breadth, mod_url\analytics\indicator\cognitive_depth, mod_survey\analytics\indicator\social_breadth, mod_survey\analytics\indicator\cognitive_depth, mod_scorm\analytics\indicator\social_breadth, mod_scorm\analytics\indicator\cognitive_depth, mod_resource\analytics\indicator\social_breadth, mod_resource\analytics\indicator\cognitive_depth, mod_quiz\analytics\indicator\social_breadth, mod_quiz\analytics\indicator\cognitive_depth, mod_page\analytics\indicator\social_breadth, mod_page\analytics\indicator\cognitive_depth, mod_lti\analytics\indicator\social_breadth, mod_lti\analytics\indicator\cognitive_depth, mod_lesson\analytics\indicator\social_breadth, mod_lesson\analytics\indicator\cognitive_depth, mod_label\analytics\indicator\social_breadth, mod_label\analytics\indicator\cognitive_depth, mod_imscp\analytics\indicator\social_breadth, mod_imscp\analytics\indicator\cognitive_depth, mod_glossary\analytics\indicator\social_breadth, mod_glossary\analytics\indicator\cognitive_depth, mod_forum\analytics\indicator\social_breadth, mod_forum\analytics\indicator\cognitive_depth, mod_folder\analytics\indicator\social_breadth, mod_folder\analytics\indicator\cognitive_depth, mod_feedback\analytics\indicator\social_breadth, mod_feedback\analytics\indicator\cognitive_depth, mod_data\analytics\indicator\social_breadth, mod_data\analytics\indicator\cognitive_depth, mod_choice\analytics\indicator\social_breadth, mod_choice\analytics\indicator\cognitive_depth, mod_chat\analytics\indicator\social_breadth, mod_chat\analytics\indicator\cognitive_depth, mod_book\analytics\indicator\social_breadth, mod_book\analytics\indicator\cognitive_depth, mod_assign\analytics\indicator\social_breadth, mod_assign\analytics\indicator\cognitive_depth, core\analytics\indicator\read_actions, core\analytics\indicator\any_write_action_in_course, core\analytics\indicator\any_write_action, core\analytics\indicator\any_course_access, core\analytics\indicator\any_access_before_start, core\analytics\indicator\any_access_after_end, core_course\analytics\target\no_teaching, core_course\analytics\target\no_recent_accesses, core_course\analytics\target\no_access_since_course_start, core_course\analytics\target\course_gradetopass, core_course\analytics\target\course_dropout, core_course\analytics\target\course_completion, core_course\analytics\target\course_competencies, core_course\analytics\indicator\potential_social_breadth, core_course\analytics\indicator\potential_cognitive_depth, core_course\analytics\indicator\no_teacher, core_course\analytics\indicator\no_student, core_course\analytics\indicator\completion_enabled, and core_course\analytics\indicator\activities_due.

◆ get_time_range_weeks_number()

core_analytics\calculable::get_time_range_weeks_number (   $starttime,
  $endtime 
)
protected

Returns the number of weeks a time range contains.

Useful for calculations that depend on the time range duration. Note that it returns a float, rounding the float may lead to inaccurate results.

Parameters
int$starttime
int$endtime
Return values
float

◆ limit_value()

core_analytics\calculable::limit_value (   $calculatedvalue)
protected

Limits the calculated value to the minimum and maximum values.

Parameters
float$calculatedvalue
Return values
float|null

◆ retrieve()

core_analytics\calculable::retrieve (   $elementname,
  $sampleid 
)
protected

Retrieve the specified element associated to $sampleid.

Parameters
string$elementname
int$sampleid
Return values
stdClass|falseAn stdClass object or false if it can not be found.

◆ save_calculation_info()

core_analytics\calculable::save_calculation_info ( \core_analytics\local\time_splitting\base  $timesplitting,
int  $rangeindex 
)
final

Stores in MUC the previously added data and it associates it to the provided $calculable.

Flagged as final as we don't want people to extend this, it is likely to be moved to core_analytics\calculable

Parameters
core_analytics\local\time_splitting\base$timesplitting
int$rangeindex
Return values
null

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