-
Functional Test
-
Minor
-
Moodle 4.0
Prerequisites
- Install https://github.com/dmonllao/moodle-local_testanalytics
- Install the Python ML backend as specified in the documentation Analytics. (If you already have it installed you will need to update it to the latest version (pip install -I moodlemlbackend==0.37.0).)
- Enable analytics and make sure everything is working.
- Go to Site admin / Analytics / Analytics settings. Disable 'onlycli' option and ensure that 'Default predictions processor' is set to 'PHP machine learning backend'.
Export
- Go to Site admin / Analytics / Analytics models.
- Run "Execute scheduled analysis" for "Inactive users" model.
- Return to the models list page and expand "Inactive users" model actions' menu.
- Confirm that there is a "Delete" option but no "Export configuration" option.
- Run "Execute scheduled analysis" for "Binary" model.
- Return to the models list page and expand "Binary" model actions' menu.
- Confirm that there is an "Export configuration" option. Click on it and download the ZIP file.
- Confirm that the ZIP contains a JSON file and a mlbackend directory with a model.ser file inside.
- Open the JSON file in it and confirm that it contains something like this (ignore the numbers under dependencies>xxx)
{"target":"\\local_testanalytics\\analytics\\target\\binary_example","timesplitting":"\\core\\analytics\\time_splitting\\single_range","indicators":["\\local_testanalytics\\analytics\\indicator\\set_setting"],"dependencies":{"local_testanalytics":2017051501,"core":2019011800}}
- Return to the models list page and select "Edit" from "Binary" model actions' menu.
- Set "Predictions processor" to "Python machine learning backend" and save changes.
- Run "Execute scheduled analysis" for "Binary" model.
- Run "Export configuration" for "Binary" model.
- Confirm that the ZIP contains a JSON file and a mlbackend directory with a model.json file inside. Open it and confirm that it contains a serialised object (mostly float numbers).
- Return to the models list page and select "Edit" from "Binary" model actions' menu.
- Untick "Enabled", set "Analysis interval" to empty and save changes.
- Return to the models list page and expand "Binary" model actions' menu. Confirm that there is no "Export configuration" option.
- Run "Actions > Edit" for "Discrete" model, change the "Predictions processor" option from "Default..." to "PHP machine learning backend" and save changes.
- Run "Actions > Export configuration" for the following models: discrete, users without pic and linear.
Delete
- Try deleting all your models by clicking on "Actions > Delete" and confirm the deletion.
Import
- Go to Site admin / Analytics / Analytics models and press the "Import model" button
- Make sure the file area allows only .zip files.
- Import all five configuration files you previously exported (including the two Binary models you first exported).
- Confirm that you don't get any error, but instead see a nice and green "The model has been successfully imported." message.
- For each of them click on "Actions > Edit", confirm that "Enabled" is not ticked, that a "Analysis interval" is selected, that there is at least one indicator and that the predictions processor is different than "Default...".
- Open the model-config.json files inside one of the zip files you downloaded and change one of the versions under "dependencies".
- Go to Site admin / Analytics / Analytics models / Import model and upload the modified file.
- "Ignore version mismatches" should be disabled by default.
- You should see an error message stating something like this: "The version of the following components differ from the version installed in this site: local_testanalytics (20170515031). You can use "Ignore version mismatches" option to ignore these differences."
- Upload the same file and now tick "Ignore version mismatches".
- The model should now be successfully imported (green message for the win).
Create
- Go to Site admin / Analytics / Analytics models / Create model".
- In the Target drop-down menu, confirm that "No teaching" is not an option.
- Select "Students at risk of dropping out" as a "Target", "Read actions amount" as "Indicators" and save changes.
- Return to the models list page and select "Actions > Edit" for "Students at risk of dropping out" model.
- Confirm that there is no option to modify the "Target" field.
- is a QA test written for
-
MDL-60944 Allow models to be created, deleted, imported and exported
- Closed