Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400]
Analytics basic actions manager.
Copyright: | 2017 David Monllao {@link http://www.davidmonllao.com} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 1010 lines (37 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
manager:: (35 methods):
check_can_manage_models()
check_can_list_insights()
is_analytics_enabled()
get_all_models()
get_predictions_processor()
get_all_prediction_processors()
reset_prediction_processors()
get_predictions_processor_name()
is_mlbackend_used()
get_all_time_splittings()
get_enabled_time_splitting_methods()
get_time_splitting_methods_for_evaluation()
get_time_splitting()
get_all_targets()
get_all_indicators()
get_target()
get_indicator()
is_valid()
get_analytics_logstore()
get_indicator_calculations()
get_models_with_insights()
cached_models_with_insights()
get_prediction()
add_builtin_models()
cleanup()
default_mlbackend()
get_analytics_classes()
update_default_models_for_component()
load_default_models_for_component()
load_default_models_for_all_components()
validate_models_declaration()
create_declared_model()
model_declaration_identifier()
get_declared_target_and_indicators_instances()
get_potential_context_restrictions()
check_can_manage_models() X-Ref |
Checks that the user can manage models return: void |
check_can_list_insights(\context $context, bool $return = false) X-Ref |
Checks that the user can list that context insights return: void param: \context $context param: bool $return The method returns a bool if true. |
is_analytics_enabled() X-Ref |
Is analytics enabled globally? return bool |
get_all_models($enabled = false, $trained = false, $predictioncontext = false) X-Ref |
Returns all system models that match the provided filters. return: \core_analytics\model[] param: bool $enabled param: bool $trained param: \context|false $predictioncontext |
get_predictions_processor($predictionclass = false, $checkisready = true) X-Ref |
Returns the provided predictions processor class. return: \core_analytics\predictor param: false|string $predictionclass Returns the system default processor if false param: bool $checkisready |
get_all_prediction_processors() X-Ref |
Return all system predictions processors. return: \core_analytics\predictor[] |
reset_prediction_processors() X-Ref |
Resets the cached prediction processors. return: null |
get_predictions_processor_name(\core_analytics\predictor $predictionsprocessor) X-Ref |
Returns the name of the provided predictions processor. return: string param: \core_analytics\predictor $predictionsprocessor |
is_mlbackend_used($plugin) X-Ref |
Whether the provided plugin is used by any model. return: bool param: string $plugin |
get_all_time_splittings() X-Ref |
Get all available time splitting methods. return: \core_analytics\local\time_splitting\base[] |
get_enabled_time_splitting_methods() X-Ref |
get_time_splitting_methods_for_evaluation(bool $all = false) X-Ref |
Returns the time-splitting methods for model evaluation. return: \core_analytics\local\time_splitting\base[] param: bool $all Return all the time-splitting methods that can potentially be used for evaluation or the default ones. |
get_time_splitting($fullclassname) X-Ref |
Returns a time splitting method by its classname. return: \core_analytics\local\time_splitting\base|false False if it is not valid. param: string $fullclassname |
get_all_targets() X-Ref |
Return all targets in the system. return: \core_analytics\local\target\base[] |
get_all_indicators() X-Ref |
Return all system indicators. return: \core_analytics\local\indicator\base[] |
get_target($fullclassname) X-Ref |
Returns the specified target return: \core_analytics\local\target\base|false False if it is not valid param: mixed $fullclassname |
get_indicator($fullclassname) X-Ref |
Returns an instance of the provided indicator. return: \core_analytics\local\indicator\base|false False if it is not valid. param: string $fullclassname |
is_valid($fullclassname, $baseclass) X-Ref |
Returns whether a time splitting method is valid or not. return: bool param: string $fullclassname param: string $baseclass |
get_analytics_logstore() X-Ref |
Returns the logstore used for analytics. return: \core\log\sql_reader|false False if no log stores are enabled. |
get_indicator_calculations($analysable, $starttime, $endtime, $samplesorigin) X-Ref |
Returns this analysable calculations during the provided period. return: array param: \core_analytics\analysable $analysable param: int $starttime param: int $endtime param: string $samplesorigin The samples origin as sampleid is not unique across models. |
get_models_with_insights(\context $context) X-Ref |
Returns the models with insights at the provided context. Note that this method is used for display purposes. It filters out models whose insights are not linked from the reports page. return: \core_analytics\model[] param: \context $context |
cached_models_with_insights(\context $context, int $newmodelid = null) X-Ref |
Returns the models that generated insights in the provided context. It can also be used to add new models to the context. Note that if you use this function with $newmodelid is the caller responsibility to ensure that the provided model id generated insights for the provided context. return: int[] param: \context $context param: int|null $newmodelid A new model to add to the list of models with insights in the provided context. |
get_prediction($predictionid, $requirelogin = false) X-Ref |
Returns a prediction return: array array($model, $prediction, $context) param: int $predictionid param: bool $requirelogin |
add_builtin_models() X-Ref |
Used to be used to add models included with the Moodle core. return: void |
cleanup() X-Ref |
Cleans up analytics db tables that do not directly depend on analysables that may have been deleted. |
default_mlbackend() X-Ref |
Default system backend. return: string |
get_analytics_classes($element) X-Ref |
Returns the provided element classes in the site. return: string[] Array keys are the FQCN and the values the class path. param: string $element |
update_default_models_for_component(string $componentname) X-Ref |
Check that all the models declared by the component are up to date. This is intended to be called during the installation / upgrade to automatically create missing models. return: array \core_analytics\model[] List of actually created models. param: string $componentname The name of the component to load models for. |
load_default_models_for_component(string $componentname) X-Ref |
Return the list of models declared by the given component. return: array The $models description array. param: string $componentname The name of the component to load models for. |
load_default_models_for_all_components() X-Ref |
Return the list of all the models declared anywhere in this Moodle installation. Models defined by the core and core subsystems come first, followed by those provided by plugins. return: array indexed by the frankenstyle component |
validate_models_declaration(array $models) X-Ref |
Validate the declaration of prediction models according the syntax expected in the component's db folder. The expected structure looks like this: [ [ 'target' => '\fully\qualified\name\of\the\target\class', 'indicators' => [ '\fully\qualified\name\of\the\first\indicator', '\fully\qualified\name\of\the\second\indicator', ], 'timesplitting' => '\optional\name\of\the\time_splitting\class', 'enabled' => true, ], ]; param: array $models List of declared models. |
create_declared_model(array $definition) X-Ref |
Create the defined model. return: \core_analytics\model param: array $definition See {@link self::validate_models_declaration()} for the syntax. |
model_declaration_identifier(array $model) X-Ref |
Returns a string uniquely representing the given model declaration. return: string complying with PARAM_ALPHANUM rules and starting with an 'id' prefix param: array $model Model declaration |
get_declared_target_and_indicators_instances(array $definition) X-Ref |
Given a model definition, return actual target and indicators instances. return: array [0] => target instance, [1] => array of indicators instances param: array $definition See {@link self::validate_models_declaration()} for the syntax. |
get_potential_context_restrictions(?array $contextlevels = null, string $query = null) X-Ref |
Return the context restrictions that can be applied to the provided context levels. return: array Associative array with contextid as key and the short version of the context name as value. param: array|null $contextlevels The list of context levels provided by the analyser. Null if all of them. param: string|null $query |