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