Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform Training and Quiz 1 #1887

Closed
wants to merge 23 commits into from

Conversation

harryface
Copy link
Contributor

@harryface harryface commented Feb 18, 2023

This is for the on platform training.

It was a vey big PR and creating this as a way to break it into bits.

This Part 1:

  • Created a new training app, with its model, admin, fixtures etc

The Part 2 will be having this as a Parent and will contain the logic:

  • Population of Training, its quiz and content body via JSON.
  • On major version change, sets all older version training to 30 days expiry, and sends a mail to users.
  • The views logic for displaying and undergoing the training.

To take OP Trainings
Screenshot 2023-02-07 at 08 41 46

To create OP Trainings
Screenshot 2023-02-28 at 07 43 03

@harryface harryface force-pushed the feature/on_platform_training_1 branch from 8508cb6 to 2cdecfb Compare February 20, 2023 18:20
@harryface harryface changed the title create the model, admin and populate fixtures Platform Training and Quiz: create the model, admin and populate fixtures Feb 20, 2023
@harryface harryface changed the title Platform Training and Quiz: create the model, admin and populate fixtures Platform Training and Quiz 1 Feb 20, 2023
@bemoody
Copy link
Collaborator

bemoody commented Feb 21, 2023

This pull request needs a bit more explanation of what you're doing and why.

Uploading images is a complicated subject, and the way you're trying to implement it here is not going to work for a lot of reasons.

Uploading images seems like quite a separate issue from everything else you're trying to do here. Please try to first get the on-platform training feature working by itself, without any special support for images. After that feature is implemented, then we can think about ways to (make it easier to) embed images in the training content.

@harryface harryface force-pushed the feature/on_platform_training_1 branch from 2cdecfb to ec80e43 Compare February 28, 2023 14:33
@amitupreti amitupreti force-pushed the feature/on_platform_training_1 branch 7 times, most recently from 2c5cac6 to 5310de7 Compare March 20, 2023 23:18
@amitupreti
Copy link
Contributor

amitupreti commented Mar 21, 2023

Workflow

Here is the workflow of how to use the feature

Users

  1. Training Admin
    Training Admin(someone with change training access and access to admin console)
    Admin can login to website and visit the Admin console > Training > OP Training.

    Here they can see existing on platform training and create or update an existing training.

    1.1 Creating a new Training
    To Create a new Training, admin will click on the Create/Update Training button, and select Create New Training from dropdown, and upload the training data in .json format.

    create json example

    1.2 Updating an existing Training
    For update process is same, the admin will select the training they want to update in the dropdown and upload the json that contains updated training data

    upload json example

    Quick notes:
    a. For updates please use semantic versioning, if there is a small change, then please increase the version with a patch like 1.0 to 1.1. But if you have made a major change in training please update the main version number like 1.5 > 2.0. When you do a major update, all existing training certificate of users for the updated training will expire after 30 days. users are sent email requesting them to take the training again.
    b. Order works in a very simple way, content and quiz load according to order(for example if a quiz had an order 0, and the content has order 1, the quiz will appear before the order)
    c. Admin can add as many content and quizes as they want.
    d. For every update, admin will need to include all the content,quiz(i.e the implementation will not fetch content or quiz from previous version)

  2. User
    User is anyone who is logged in

    User can login and go to their account settings > Training and select an on platform training and click start to begin training
    Based on the training, users will see a series of content, quizzes and will have an option to submit the training and the end.
    Users can read the content and navigate the training by clicking Next, Back button.
    If a user comes across a quiz, then they will not be able to navigate forward unless they answer the quiz correctly.

    Quick notes
    a. There is no resume feature(which means if the user refreshes the tab, they will lose progress.)

Models

The idea here is that we will use existing user.TrainingType to create a new on platform Training, this lets us add the onplatform training feature without making any changes to existing codebase.

To track the content, quiz for a Training, we have model training.OnPlatformTraining which uses a field version and training_type(foreign key to user.TrainingType)

For example,
Suppose we want to create a onplatform training called PhysioNet CyberSecurity 101, then we will create a new user.TrainingType with name PhysioNet CyberSecurity 101 and then we will create a new training.OnPlatformTraining with version 1.0 and training_type as the newly created user.TrainingType. For content and quiz we will create a new model training.ContentBlock, training.Quiz and training.QuizChoice respectively.

If there is an update to the training PhysioNet CyberSecurity 101, then we will create a new training.OnPlatformTraining with version 2.0 and training_type as the newly created user.TrainingType. For content and quiz we will create a new model training.ContentBlock, training.Quiz and training.QuizChoice respectively.

on the frontend, we will use the user.TrainingType to fetch the latest training.OnPlatformTraining and then use the training.OnPlatformTraining to fetch the related content and quiz.

How is the take training implemented?

For training, when a user loads the training page, we will load all the content, quiz and sort them serially. We will then show the first content or quiz to the user. When the user clicks next, we will show the next content or quiz. If the user clicks back, we will show the previous content or quiz. If the user clicks submit, we will check if the user has completed all the content and quiz, if yes, then we will mark the training as completed and send an email to the user.

Questions

  1. For the resume training feature, do we want to store the user's progress locally or in database?(my guess is Database as it would provide better user experience). if we want to store the progress in database, i think we could have a mode like

class OnPlatformTrainingProgress(models.Model):
    user = models.ForeignKey('user.User',
                             on_delete=models.CASCADE, related_name='op_training_progresses')
    training = models.ForeignKey('training.OnPlatformTraining',
                                 on_delete=models.CASCADE, related_name='progresses')
    completed = models.BooleanField(default=False)

    content_blocks = models.ManyToManyField('training.ContentBlock', related_name='progresses')
    quizzes = models.ManyToManyField('training.Quiz', related_name='progresses')

    class Meta:
        unique_together = ('user', 'training')

and track the question and section the user has completed here. We can use this to show the progress to the user as well(like 10% course completed or 3/10 modules , 2/5 quiz completed completed)

  1. Display the Training content summary on the Training detail page?(example below from tpcs2core)

image

  1. Do we want to grade users with score like 90% or something? and require them to have a minimum passing percentage(Currently, we require them to have 100% scores). Maybe this is something desirable after the first PR.

  2. I remember there was discussion about moving the On platform training outside of settings, What if add a On Platform Training on the Nav bar and have a dedicated page for Training?(i can make a mockup image of somekind)

    4.1 We could show a list of Training Available to user, list their certificates and completion date, expiry date.
    4.2 Users can then take a training from the list

    Maybe something like the Physionet Search page https://physionet.org/content/

TODOS

  1. Resume feature/Track Training progress for a user
  2. Prevent user from taking the test twice(in case they have completed it before) or atleast remind them that they already took the test successfully

Notes from Harry

  • Add a create training type button *
  • View all Training with button beside asking to make it OP *
  • Modify the settings training page to display the latest versions

@amitupreti
Copy link
Contributor

@alistairewj @bemoody @tompollard Ready for feedback/suggestions. Please check the note above

@amitupreti
Copy link
Contributor

Quick note on what i am working on currently

  1. Add modules before content, quizzes(so OnPlatformTraining --> Modules --> Content, Quizzes)
    and update the code to use modules and have a Training detail page that shows the details about training, modules, no of content, quizzes under the modules.
  2. Saving Users Progress and letting them resume training later.

harryface and others added 13 commits March 27, 2023 16:21
Added a serializer to allow admins to create a new training or update the existing training.

To track the updates to training, we are using semantic versioning. If the updated training has a major update eg from 1.9 to 2.0, then all the users who did completed the previous versions will be sent an email asking them to complete the new version of training with x days.
Allows users to take the test from settings.

The quiz.html file loads all the content and questions based on the order. All the data is hidden from user and gradually displayed as users go through the training

We have two level of verifications of answers. the first one is done on quiz.html where users go through the content and they will see the related questions and answer the questions. users can go to next section or skip the question only if they have answered the question correctly.
We also have another verification done on view. here if the users had correctly answered the questions a json string is generated and sent via POST, we will then check the database to verify that the data in json string(question,answer) matched with the database. This should help us stop someone from just sending a post request to complete the training.

Quick note:
1. Users are not able to resume the test if they refresh the browser
2. Users can take the same test multiple times
3. Only multiple choice questions is supported yet.
Currently the training lacks proper organization. We have a OnPlatform Training which holds bunch of content and quizzes under it directly.

On all online learning platforms or physical books, the training/courses are organized under chapter(in books) and modules/lessons and sections. With the idea of having modules under training instructors will be able to organize the training content under appropriate modules.

Also, i didnot squash this commit just in case we want to revert the changes later.
Serializer was updating the existing onplatform training on update, which is not the desired behaviour. On update the desired behaviour is that we should create a new onplatform training with the details provided in json and  link it to the TrainingType of the  OnPlatform Training being updated.
Here i added an about section, a simple table to show module details and progress
Here i created basic links that lets users access the modules, take the training, and submit the modules after completion.

The idea/expectation is that users need to complete the modules sequentially(enforced in code). So when the user submits the last module, we will provide them a certificate.

To complete this, we need to track the progress of the users(which is something we already want). So in the coming few commits, i will add the resume feature and complete TODO's of this commit(Since this commit depends on few unwritten features, i left notes)
Since the training is divided into modules, it makes sense to have a view to update the status. The idea here is that when a user hits the next button and the content/quiz has not be already completed, a post request will be sent to the view, and the view will mark the content or quiz as completed
This commit implements the resume feature on the part where we will use previously saved progress data and show the content to the user to that place in the module.

So this change will kick in when the user loads a module, and following things will happen

1. We will check the the user has completed previous models, if not send them to training page
2. Resume the module to where they left
This will let users skip completed quizs for the given module.
Since the users might revise/review a module, it should be helpful if we can show them the right answer that they had selected earlier when they took the training.
This commit implements 2nd part of resume feature. Here we will mark the progress of users as they go through the content and quizzes, so that next time they reload the module, they will be redirected to the last section they left

When a user clicks next button, then we will temporarily disable the next button and send a post request to backend to update the progress. if the server responds with success we will display next slide. If the server responds with error, we will show an error message and ask them to try again. And finally enable the next button.
Since all the code from here has been successfully
refactored into take_module, it should be safe to clean this view.
1.Actually save module and training progress
 Earlier, the status of module or training progress was not being updated.
2.If the user has completed a module, then we should be sending them to the first content or quiz, but because of a small bug, we were redirecting them to end of module
Here we updated the training home page to display the progress of modules, and dates to user. This should be helpful as users will be able to see which modules have been completed and when.
@amitupreti amitupreti force-pushed the feature/on_platform_training_1 branch from 5310de7 to 3a29de8 Compare March 28, 2023 01:58
@amitupreti amitupreti marked this pull request as draft March 28, 2023 01:58
@amitupreti
Copy link
Contributor

Closing this because we decided to open two new PRs with simplified and squashed commits

PR 1: Add create training from admin console by uploading json
#1950

PR 2: implement take training feature and resume training feature for user
#1951

@amitupreti amitupreti closed this Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants