3 This file has been replaced by UPGRADING.md. See MDL-81125 for further information.
6 This files describes API changes in analytics sub system,
7 information provided here is intended especially for developers.
11 * The following analytics target classes, renamed since 3.7, have now been removed completed:
12 - `\core\analytics\target\course_dropout`
13 - `\core\analytics\target\course_competencies`
14 - `\core\analytics\target\course_completion`
15 - `\core\analytics\target\course_gradetopass`
16 - `\core\analytics\target\no_teaching`
20 * Final deprecation get_enabled_time_splitting_methods. Method has been removed. Use
21 get_time_splitting_methods_for_evaluation instead.
22 * Final deprecation add_builtin_models. Method has been removed. The functionality
23 has been replaced with automatic update of models provided by the core moodle component.
24 There is no need to call this method explicitly any more. Instead, adding new models can be achieved
25 by updating the lib/db/analytics.php file and bumping the core version.
26 * Final deprecation - get_analysables(). Please see get_analysables_interator() instead.
27 get_analysables_iterator() needs to be overridden by the child class.
28 * A new function get_executed_actions() has been added to \core_analytics\prediction class
29 to get all (or filtered by action name) executed actions of a prediction
33 * "Time-splitting method" have been replaced by "Analysis interval" for the language strings that are
34 displayed in the Moodle UI. The name of several time-splitting methods have been updated according
35 to the new description of the field.
36 * A new target::can_use_timesplitting method must be implemented to discard time-splitting methods that can not
38 * Targets can now implement get_insight_body and get_insight_body_for_prediction to set the body of the insight.
39 * Indicators can add information about calculated values by calling add_shared_calculation_info(). This
40 data is later available for targets in get_insight_body_for_prediction(), it can be accessed
41 appending ':extradata' to the indicator name (e.g. $sampledata['\mod_yeah\analytics\indicator\ou:extradata')
42 * A new \core_analytics\local\time_splitting\past_periodic abstract class has been added. Time-splitting
43 methods extending \core_analytics\local\time_splitting\periodic directly should be extending past_periodic
44 now. 'periodic' can still be directly extended by implementing get_next_range and get_first_start methods.
45 * Targets can now specify a list of bulk actions in bulk_actions(). core_analytics\prediction_action is now
46 extending core_analytics\action and a new core_analytics\bulk_action class has been added. Actions can now
47 specify a type in its constructor: core_analytics\action::TYPE_POSITIVE, TYPE_NEUTRAL or TYPE_NEGATIVE. A list
48 of default bulk actions is available in \core_analytics\default_bulk_actions.
49 * The default suggested actions provided to users changed:
50 * For targets with one single sample per analysable (e.g. upcoming activities due) the default actions are
51 Useful and Not useful.
52 * For targets with multiple samples per analysable (e.g. students at risk) the default actions are
53 Accept, Not applicable and Incorrectly flagged.
54 * The suggested actions for the existing models have been reworded:
55 * Predictions flagged as "Acknowledged" in models whose targets use analysers that provide one sample per
56 analysable (e.g. upcoming activities due) have been updated to "Useful" flag.
57 * Predictions flagged as "Not useful" in models whose targets use analysers that provide multiple samples
58 per analysable (e.g. students at risk or no teaching) have been updated to "Incorrectly flagged".
59 * \core_analytics\predictor::delete_output_dir has a new 2nd parameter, $uniquemodelid.
60 * Analyser's get_analysables_iterator and get_iterator_sql have a new $contexts parameter to limit the returned analysables to
61 the ones that depend on the provided contexts.
62 * Analysers can implement a context_restriction_support() method to restrict models to a subset of the
63 contents in the site. Only CONTEXT_COURSE and CONTEXT_COURSECAT are supported.
67 * \core_analytics\regressor::evaluate_regression and \core_analytics\classifier::evaluate_classification
68 have been updated to include a new $trainedmodeldir param. This new param will be used to evaluate the
69 existing trained model.
70 * Plugins and core subsystems can now declare default prediction models by describing them in
71 their db/analytics.php file. Models should not be created manually via the db/install.php
73 * The method \core_analytics\manager::add_builtin_models() has been deprecated. The functionality
74 has been replaced with automatic update of models provided by the core moodle component. There
75 is no need to call this method explicitly any more. Instead, adding new models can be achieved
76 by updating the lib/db/analytics.php file and bumping the core version.
77 * \core_analytics\model::execute_prediction_callbacks now returns an array with both sample's contexts
78 and the prediction records.
79 * \core_analytics\model::export() now expects the renderer instance as an argument.
80 * Time splitting methods:
81 * \core_analytics\local\time_splitting\base::append_rangeindex and
82 \core_analytics\local\time_splitting\base::infer_sample_info are now marked as final and can not
84 * Can now overwrite include_range_info_in_training_data() and
85 get_training_ranges() methods. They can be used to create time splitting methods with a pre-defined
87 * Can now overwrite cache_indicator_calculations(). You should return false if the time frames generated
88 by your time-splitting method are unique and / or can hardly be reused by further models.
89 * Can now overwrite valid_for_evaluation(). You can return false if the time-splitting method can not be
90 used to evaluate prediction models or if it does not make sense to evaluate prediction models with it,
91 as for example upcoming_periodic children classes.
92 * \core_analytics\local\analyser\base::get_most_recent_prediction_range has been moved to
93 \core_analytics\local\time_splitting\base::get_most_recent_prediction_range and it is not overwritable
94 by time splitting methods.
96 * The visibility of the following methods must now be public: ignored_predicted_classes()
97 and get_insights_users()
98 * Prediction_actions() has now a 3rd parameter $isinsightuser. This parameter is true
99 when we are listing actions for the user that will receives the insight.
100 * Can now implement a always_update_analysis_time() method so analysable elements' timeanalysed is
101 only updated when analysable elements have been successfully evaluated. It is useful for lightweight targets.
102 * Can not implement two new methods to tune the insights generated by the model: get_insight_subject()
103 and get_insight_context_url().
105 * The visibility of get_all_samples() method must now be public.
106 * get_analysables() method has been deprecated in favour of a new get_analysables_interator()
107 for performance reasons.
108 * Can overwrite a new one_sample_per_analysable() method if the analysables they use only have
109 one sample. The insights generated by models will then include the suggested actions in
114 * There are two new methods for analysers, processes_user_data() and join_sample_user(). You
115 need to overwrite them if your analyser uses user data. As a general statement, you should
116 overwrite these new methods if your samples return 'user' data. These new methods are used
117 for analytics' privacy API implementation.