Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
mod_chat\analytics\indicator\cognitive_depth Class Reference

Cognitive depth indicator - chat. More...

Inheritance diagram for mod_chat\analytics\indicator\cognitive_depth:
mod_chat\analytics\indicator\activity_base core_analytics\local\indicator\community_of_inquiry_activity core_analytics\local\indicator\linear core_analytics\local\indicator\base core_analytics\calculable

Public Member Functions

 add_sample_data ($data)
 add_sample_data More...
 
 calculate ($sampleids, $samplesorigin, $starttime=false, $endtime=false, $existingcalculations=array())
 Calculates the indicator. More...
 
 clear_sample_data ()
 clear_sample_data More...
 
 fill_per_analysable_caches (\core_analytics\analysable $analysable)
 Fetch the course grades of this activity type instances. More...
 
string get_activity_type ()
 Returns the activity type. More...
 
 get_calculation_outcome ($value, $subtype=false)
 get_calculation_outcome More...
 
 get_cognitive_depth_level (\cm_info $cm)
 Returns the potential level of cognitive depth. More...
 
 get_display_value ($value, $subtype=false)
 get_display_value More...
 
 get_id ()
 The class id is the calculable class full qualified class name. More...
 
 get_indicator_type ()
 Defines indicator type. More...
 
 get_social_breadth_level (\cm_info $cm)
 Returns the potential level of social breadth. 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...
 
 should_be_displayed ($value, $subtype)
 Show only the main feature. More...
 

Static Public Member Functions

static get_feature_headers ()
 get_feature_headers More...
 
static get_max_value ()
 Returns the maximum value an indicator calculation can return. More...
 
static get_min_value ()
 Returns the minimum value an indicator calculation can return. More...
 
static get_name ()
 Returns the name. More...
 
static instance ()
 Returns an instance of the indicator. More...
 
static required_sample_data ()
 required_sample_data More...
 

Public Attributes

const COGNITIVE_LEVEL_1 = 1
 Constant for this cognitive level.
 
const COGNITIVE_LEVEL_2 = 2
 Constant for this cognitive level.
 
const COGNITIVE_LEVEL_3 = 3
 Constant for this cognitive level.
 
const COGNITIVE_LEVEL_4 = 4
 Constant for this cognitive level.
 
const COGNITIVE_LEVEL_5 = 5
 Constant for this cognitive level.
 
const INDICATOR_COGNITIVE = "cognitve"
 Constant cognitive indicator type.
 
const INDICATOR_SOCIAL = "social"
 Constant social indicator type.
 
const MAX_COGNITIVE_LEVEL = 5
 Max cognitive depth level accepted.
 
const MAX_SOCIAL_LEVEL = 5
 Max social breadth level accepted.
 
const MAX_VALUE = 1
 Max value an indicator can return.
 
const MIN_VALUE = -1
 Min value an indicator can return.
 
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.
 
const SOCIAL_LEVEL_1 = 1
 Constant for this social level.
 
const SOCIAL_LEVEL_2 = 2
 Constant for this social level.
 
const SOCIAL_LEVEL_3 = 3
 Constant for this social level.
 
const SOCIAL_LEVEL_4 = 4
 Constant for this social level.
 
const SOCIAL_LEVEL_5 = 5
 Constant for this social level.
 

Protected Member Functions

 activity_completed_by (\cm_info $activity, $starttime, $endtime, $student=false)
 Was the activity supposed to be completed during the provided time range?. More...
 
 activity_type_completed_by (\cm_info $activity, $starttime, $endtime, $student=false)
 True if the activity is due or it has been closed during this period, false if during another period, null if no due time. More...
 
 add_shared_calculation_info (int $sampleid, array $info)
 Adds info related to the current calculation for later use when generating insights. More...
 
 any_feedback ($action, cm_info $cm, $contextid, $user)
 Is there any feedback activity log for this user in this context? More...
 
 any_log ($contextid, $user)
 Do activity logs contain any log of user in this context? More...
 
 any_write_log ($contextid, $user)
 Do activity logs contain any write log of user in this context? More...
 
 availability_completed_by (\core_availability\info $info, $starttime, $endtime)
 Check if the activity/section should have been completed during the provided period according to its availability rules. More...
 
 calculate_sample ($sampleid, $tablename, $starttime=false, $endtime=false)
 calculate_sample More...
 
 classify_value ($value, $ranges)
 Classifies the provided value into the provided range according to the ranges predicates. More...
 
 cognitive_calculate_sample ($sampleid, $tablename, $starttime=false, $endtime=false)
 Calculates the cognitive depth of a sample. More...
 
 feedback_check_grades ()
 feedback_check_grades More...
 
 feedback_post_action (\cm_info $cm, $contextid, $userid, $eventnames, $after=false)
 feedback_post_action More...
 
 feedback_replied (\cm_info $cm, $contextid, $userid, $after=null)
 $cm is used for this method overrides. More...
 
 feedback_replied_events ()
 feedback_replied_events More...
 
 feedback_submitted (\cm_info $cm, $contextid, $userid, $after=null)
 $cm is used for this method overrides. More...
 
 feedback_submitted_events ()
 Returns the list of events that involve submitting something after receiving feedback from other users. More...
 
 feedback_viewed (\cm_info $cm, $contextid, $userid, $after=null)
 $cm is used for this method overrides. More...
 
 feedback_viewed_events ()
 feedback_viewed_events More...
 
 fetch_activity_logs ($activities, $starttime=false, $endtime=false)
 Fetch acitivity logs from database. More...
 
 fetch_student_grades (\core_analytics\course $course)
 Gets the course student grades. More...
 
 fill_instance_data (\cm_info $cm)
 Fills in activity instance data. More...
 
 get_activities ($starttime, $endtime, $student=false)
 Guesses all activities that were available during a period of time. More...
 
 get_graded_date ($contextid, $userid, $checkfeedback=false)
 Returns the date a user was graded. More...
 
 get_student_activities ($sampleid, $tablename, $starttime, $endtime)
 Returns the activities the user had access to between a time period. More...
 
 get_time_range_weeks_number ($starttime, $endtime)
 Returns the number of weeks a time range contains. More...
 
 get_timeclose_field ()
 Returns the name of the field that controls activity availability. 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...
 
 social_calculate_sample ($sampleid, $tablename, $starttime=false, $endtime=false)
 Calculates the social breadth of a sample. More...
 
 to_features ($calculatedvalues)
 Converts the calculated values to a list of features for the dataset. More...
 
 validate_calculated_value ($calculatedvalue)
 Validates the calculated value. More...
 

Static Protected Member Functions

static include_averages ()
 Set to false to avoid context features to be added as dataset features. More...
 

Protected Attributes

array $activitylogs = null
 Array of logs by [contextid][userid].
 
core_analytics calculation_info null $calculationinfo = null
 
core_analytics course $course = null
 
array $grades = null
 Array of grades by [contextid][userid].
 
array $instancedata = array()
 instancedata
 
array[] $sampledata = array()
 

Detailed Description

Cognitive depth indicator - chat.

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

Member Function Documentation

◆ activity_completed_by()

core_analytics\local\indicator\community_of_inquiry_activity::activity_completed_by ( \cm_info  $activity,
  $starttime,
  $endtime,
  $student = false 
)
protectedinherited

Was the activity supposed to be completed during the provided time range?.

Parameters
cm_info$activity
int$starttime
int$endtime
stdClass | false$student
Return values
bool

◆ activity_type_completed_by()

core_analytics\local\indicator\community_of_inquiry_activity::activity_type_completed_by ( \cm_info  $activity,
  $starttime,
  $endtime,
  $student = false 
)
protectedinherited

True if the activity is due or it has been closed during this period, false if during another period, null if no due time.

It can be overwritten by activities that allow teachers to set a due date or a time close separately from Moodle availability system. Note that in most of the cases overwriting get_timeclose_field should be enough.

Returns true or false if the time close date falls into the provided time range. Null otherwise.

Parameters
cm_info$activity
int$starttime
int$endtime
stdClass | false$student
Return values
null

◆ add_sample_data()

core_analytics\calculable::add_sample_data (   $data)
inherited

add_sample_data

Parameters
array$data
Return values
void

◆ add_shared_calculation_info()

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

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

◆ any_feedback()

core_analytics\local\indicator\community_of_inquiry_activity::any_feedback (   $action,
cm_info  $cm,
  $contextid,
  $user 
)
protectedinherited

Is there any feedback activity log for this user in this context?

This method returns true if $user is empty and there is any feedback activity logs.

Parameters
string$action
cm_info$cm
int$contextid
stdClass | false$user
Return values
bool

◆ any_log()

core_analytics\local\indicator\community_of_inquiry_activity::any_log (   $contextid,
  $user 
)
finalprotectedinherited

Do activity logs contain any log of user in this context?

If user is empty we look for any log in this context.

Parameters
int$contextid
stdClass | false$user
Return values
bool

◆ any_write_log()

core_analytics\local\indicator\community_of_inquiry_activity::any_write_log (   $contextid,
  $user 
)
finalprotectedinherited

Do activity logs contain any write log of user in this context?

If user is empty we look for any write log in this context.

Parameters
int$contextid
stdClass | false$user
Return values
bool

◆ availability_completed_by()

core_analytics\local\indicator\community_of_inquiry_activity::availability_completed_by ( \core_availability\info  $info,
  $starttime,
  $endtime 
)
protectedinherited

Check if the activity/section should have been completed during the provided period according to its availability rules.

Parameters
core_availability\info$info
int$starttime
int$endtime
Return values
bool|null

◆ calculate()

core_analytics\local\indicator\base::calculate (   $sampleids,
  $samplesorigin,
  $starttime = false,
  $endtime = false,
  $existingcalculations = array() 
)
inherited

Calculates the indicator.

Returns an array of values which size matches $sampleids size.

Parameters
int[]$sampleids
string$samplesorigin
integer$starttimeLimit the calculation to this timestart
integer$endtimeLimit the calculation to this timeend
array$existingcalculationsExisting calculations of this indicator, indexed by sampleid.
Return values
array[0] = [$sampleid => int[]|float[]], [1] = [$sampleid => int|float], [2] = [$sampleid => $sampleid]

◆ calculate_sample()

core_analytics\local\indicator\community_of_inquiry_activity::calculate_sample (   $sampleid,
  $tablename,
  $starttime = false,
  $endtime = false 
)
protectedinherited

calculate_sample

Exceptions
coding_exception
Parameters
int$sampleid
string$tablename
int$starttime
int$endtime
Return values
float|int|null

Reimplemented from core_analytics\local\indicator\base.

◆ classify_value()

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

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 ( )
inherited

clear_sample_data

Return values
void

◆ cognitive_calculate_sample()

core_analytics\local\indicator\community_of_inquiry_activity::cognitive_calculate_sample (   $sampleid,
  $tablename,
  $starttime = false,
  $endtime = false 
)
protectedinherited

Calculates the cognitive depth of a sample.

Parameters
int$sampleid
string$tablename
int$starttime
int$endtime
Return values
float|int|null
Exceptions
coding_exception

◆ feedback_check_grades()

mod_chat\analytics\indicator\activity_base::feedback_check_grades ( )
protectedinherited

feedback_check_grades

Return values
bool

Reimplemented from core_analytics\local\indicator\community_of_inquiry_activity.

◆ feedback_post_action()

mod_chat\analytics\indicator\activity_base::feedback_post_action ( \cm_info  $cm,
  $contextid,
  $userid,
  $eventnames,
  $after = false 
)
protectedinherited

feedback_post_action

Parameters
cm_info$cm
int$contextid
int$userid
string[]$eventnames
int$after
Return values
bool

Reimplemented from core_analytics\local\indicator\community_of_inquiry_activity.

◆ feedback_replied()

core_analytics\local\indicator\community_of_inquiry_activity::feedback_replied ( \cm_info  $cm,
  $contextid,
  $userid,
  $after = null 
)
protectedinherited

$cm is used for this method overrides.

This function must be fast.

Parameters
cm_info$cm
mixed$contextid
mixed$userid
int$afterTimestamp, defaults to the graded date or false if we don't check the date.
Return values
bool

Reimplemented in mod_quiz\analytics\indicator\cognitive_depth, mod_lesson\analytics\indicator\cognitive_depth, and mod_assign\analytics\indicator\cognitive_depth.

◆ feedback_replied_events()

mod_chat\analytics\indicator\activity_base::feedback_replied_events ( )
protectedinherited

feedback_replied_events

Return values
string[]

Reimplemented from core_analytics\local\indicator\community_of_inquiry_activity.

◆ feedback_submitted()

core_analytics\local\indicator\community_of_inquiry_activity::feedback_submitted ( \cm_info  $cm,
  $contextid,
  $userid,
  $after = null 
)
protectedinherited

$cm is used for this method overrides.

This function must be fast.

Parameters
cm_info$cm
mixed$contextid
mixed$userid
int$afterTimestamp, defaults to the graded date or false if we don't check the date.
Return values
bool

Reimplemented in mod_lesson\analytics\indicator\cognitive_depth.

◆ feedback_submitted_events()

core_analytics\local\indicator\community_of_inquiry_activity::feedback_submitted_events ( )
protectedinherited

Returns the list of events that involve submitting something after receiving feedback from other users.

Return values
string[]

Reimplemented in mod_workshop\analytics\indicator\cognitive_depth, mod_quiz\analytics\indicator\cognitive_depth, and mod_assign\analytics\indicator\cognitive_depth.

◆ feedback_viewed()

core_analytics\local\indicator\community_of_inquiry_activity::feedback_viewed ( \cm_info  $cm,
  $contextid,
  $userid,
  $after = null 
)
protectedinherited

$cm is used for this method overrides.

This function must be fast.

Parameters
cm_info$cm
mixed$contextid
mixed$userid
int$afterTimestamp, defaults to the graded date or false if we don't check the date.
Return values
bool

Reimplemented in mod_feedback\analytics\indicator\activity_base, and mod_choice\analytics\indicator\activity_base.

◆ feedback_viewed_events()

mod_chat\analytics\indicator\activity_base::feedback_viewed_events ( )
protectedinherited

feedback_viewed_events

Return values
string[]

Reimplemented from core_analytics\local\indicator\community_of_inquiry_activity.

◆ fetch_activity_logs()

core_analytics\local\indicator\community_of_inquiry_activity::fetch_activity_logs (   $activities,
  $starttime = false,
  $endtime = false 
)
protectedinherited

Fetch acitivity logs from database.

Parameters
array$activities
int$starttime
int$endtime
Return values
array

◆ fetch_student_grades()

core_analytics\local\indicator\community_of_inquiry_activity::fetch_student_grades ( \core_analytics\course  $course)
protectedinherited

Gets the course student grades.

Parameters
core_analytics\course$course
Return values
void

◆ fill_instance_data()

core_analytics\local\indicator\community_of_inquiry_activity::fill_instance_data ( \cm_info  $cm)
protectedinherited

Fills in activity instance data.

Parameters
cm_info$cm
Return values
void

◆ fill_per_analysable_caches()

core_analytics\local\indicator\community_of_inquiry_activity::fill_per_analysable_caches ( \core_analytics\analysable  $analysable)
inherited

Fetch the course grades of this activity type instances.

Parameters
core_analytics\analysable$analysable
Return values
void

Reimplemented from core_analytics\local\indicator\base.

◆ get_activities()

core_analytics\local\indicator\community_of_inquiry_activity::get_activities (   $starttime,
  $endtime,
  $student = false 
)
protectedinherited

Guesses all activities that were available during a period of time.

Parameters
int$starttime
int$endtime
stdClass | false$student
Return values
array

◆ get_activity_type()

string core_analytics\local\indicator\community_of_inquiry_activity::get_activity_type ( )
finalinherited

Returns the activity type.

No point in changing this class in children classes.

The activity name (e.g. assign or quiz)

◆ get_calculation_outcome()

core_analytics\local\indicator\linear::get_calculation_outcome (   $value,
  $subtype = false 
)
inherited

get_calculation_outcome

Parameters
float$value
string$subtype
Return values
int

Reimplemented from core_analytics\calculable.

◆ get_cognitive_depth_level()

mod_chat\analytics\indicator\cognitive_depth::get_cognitive_depth_level ( \cm_info  $cm)

Returns the potential level of cognitive depth.

Parameters
cm_info$cm
Return values
int

Reimplemented from core_analytics\local\indicator\community_of_inquiry_activity.

◆ get_display_value()

core_analytics\local\indicator\linear::get_display_value (   $value,
  $subtype = false 
)
inherited

get_display_value

Parameters
float$value
string$subtype
Return values
string

Reimplemented from core_analytics\calculable.

◆ get_feature_headers()

static core_analytics\local\indicator\linear::get_feature_headers ( )
staticinherited

get_feature_headers

Return values
array

◆ get_graded_date()

core_analytics\local\indicator\community_of_inquiry_activity::get_graded_date (   $contextid,
  $userid,
  $checkfeedback = false 
)
protectedinherited

Returns the date a user was graded.

Parameters
int$contextid
int$userid
bool$checkfeedbackCheck that the student was graded or check that feedback was given
Return values
int|false

◆ get_id()

core_analytics\calculable::get_id ( )
inherited

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

Return values
string

◆ get_indicator_type()

mod_chat\analytics\indicator\cognitive_depth::get_indicator_type ( )

Defines indicator type.

Return values
string

Reimplemented from core_analytics\local\indicator\community_of_inquiry_activity.

◆ get_max_value()

static core_analytics\local\indicator\base::get_max_value ( )
staticinherited

Returns the maximum value an indicator calculation can return.

Return values
float

◆ get_min_value()

static core_analytics\local\indicator\base::get_min_value ( )
staticinherited

Returns the minimum value an indicator calculation can return.

Return values
float

◆ get_name()

static mod_chat\analytics\indicator\cognitive_depth::get_name ( )
static

Returns the name.

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

Return values
lang_string

Reimplemented from core_analytics\calculable.

◆ get_social_breadth_level()

core_analytics\local\indicator\community_of_inquiry_activity::get_social_breadth_level ( \cm_info  $cm)
inherited

◆ get_student_activities()

core_analytics\local\indicator\community_of_inquiry_activity::get_student_activities (   $sampleid,
  $tablename,
  $starttime,
  $endtime 
)
protectedinherited

Returns the activities the user had access to between a time period.

Parameters
int$sampleid
string$tablename
int$starttime
int$endtime
Return values
array

◆ get_time_range_weeks_number()

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

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

◆ get_timeclose_field()

core_analytics\local\indicator\community_of_inquiry_activity::get_timeclose_field ( )
protectedinherited

Returns the name of the field that controls activity availability.

Should be overwritten by activities that allow teachers to set a due date or a time close separately from Moodle availability system.

Just 1 field will not be enough for all cases, but for the most simple ones without overrides and stuff like that.

Return values
null|string

Reimplemented in mod_workshop\analytics\indicator\activity_base, mod_scorm\analytics\indicator\activity_base, mod_quiz\analytics\indicator\activity_base, mod_lesson\analytics\indicator\activity_base, mod_feedback\analytics\indicator\activity_base, mod_data\analytics\indicator\activity_base, mod_choice\analytics\indicator\activity_base, and mod_assign\analytics\indicator\activity_base.

◆ include_averages()

static core_analytics\local\indicator\linear::include_averages ( )
staticprotectedinherited

Set to false to avoid context features to be added as dataset features.

Return values
bool

◆ instance()

static core_analytics\local\indicator\base::instance ( )
staticinherited

Returns an instance of the indicator.

Useful to reset cached data.

Return values
core_analytics

◆ limit_value()

core_analytics\calculable::limit_value (   $calculatedvalue)
protectedinherited

Limits the calculated value to the minimum and maximum values.

Parameters
float$calculatedvalue
Return values
float|null

◆ required_sample_data()

static core_analytics\local\indicator\community_of_inquiry_activity::required_sample_data ( )
staticinherited

required_sample_data

Return values
string[]

Reimplemented from core_analytics\local\indicator\base.

◆ retrieve()

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

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 
)
finalinherited

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

◆ should_be_displayed()

core_analytics\local\indicator\linear::should_be_displayed (   $value,
  $subtype 
)
inherited

Show only the main feature.

Parameters
float$value
string$subtype
Return values
bool

Reimplemented from core_analytics\local\indicator\base.

◆ social_calculate_sample()

core_analytics\local\indicator\community_of_inquiry_activity::social_calculate_sample (   $sampleid,
  $tablename,
  $starttime = false,
  $endtime = false 
)
protectedinherited

Calculates the social breadth of a sample.

Parameters
int$sampleid
string$tablename
int$starttime
int$endtime
Return values
float|int|null

◆ to_features()

core_analytics\local\indicator\linear::to_features (   $calculatedvalues)
protectedinherited

Converts the calculated values to a list of features for the dataset.

Parameters
array$calculatedvalues
Return values
array

Reimplemented from core_analytics\local\indicator\base.

◆ validate_calculated_value()

core_analytics\local\indicator\base::validate_calculated_value (   $calculatedvalue)
protectedinherited

Validates the calculated value.

Exceptions
coding_exception
Parameters
float$calculatedvalue
Return values
true

Reimplemented in core_analytics\local\indicator\discrete.


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