Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-64739

Restrict predictive models to specific contexts

    XMLWordPrintable

    Details

      Description

      MDL-60944 is scheduled for 3.7, it will allow people to create as many prediction models as they want, reusing the same target.

      A new "Restrict model to the following contexts" option would allow people to set up separate predictive models for different course categories or courses. A model restricted to a set of contexts (just CONTEXT_COURSE and CONTEXT_COURSECAT) would limit the analysable elements used by the model to analysable elements whose context is equal to, or a child of, any of the contexts specified in "Restrict to the following contexts".

      The required changes to core could be summarized here:

      1. A new field to 'models' db table (e.g. contexts)
      2. A new field in the edit model form (e.g. an autocomplete field with a list of courses and course categories)
      3. A new \core_analytics\local\analyser\base::supports_context_filtering() method to show/hide the new field (the point right above this one)
      4. Modifications to the analytics API to pre-fill options['filter'] with the list of contexts
      5. Modifications to core's get_analysables_iterator() implementations (core_analytics\local\analyser\by_course and core\analytics\analyser\users) to receive $this->options['filter'] as a parameter and take it into account
      6. A new helper method somewhere in core_analytics to return an SQL that joins with the context table and uses the ctx.path value of the provided context to filter out analysables that do not fit into the restricted list of contexts for the model. This method will be called by get_analysables() implementations where supports_context_filtering == true
      7. A modification to the current evaluation process, which supports a filter by course option. I would vote to just replace this filter by course for the filter by contextid/s
      8. A review of the analytics caching system to ensure we don't break anything
      9. Unit tests should be added to test everything. Specially helpful to detect possible issues in the point right above this one

      I may be missing extra stuff, but those are the most critical points we need to cover.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dmonllao David Monllaó
                Reporter:
                dmonllao David Monllaó
                Participants:
                Component watchers:
                Elizabeth Dalton, David Monllaó
              • Votes:
                2 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: