Google Summer of Code 2020 with Oppia

Prayush Dawda
5 min readAug 28, 2020

--

Oppia logo

Oppia is a platform that allows people to learn from and create interactive lessons on various topics. It provides an extremely intuitive experience for learners. Playing through the lessons feels like talking and learning from a friend! Apart from that, what I find unique is that Oppia provides a versatile platform for the creators. Here they can illustrate their ideas in the form of interactive lessons. Thus, having features with sufficient functionality is imperative in order to ensure the high quality of these interactive lessons.

Unfortunately, the state of one of the most important features, the Math Expression Input Interaction, was not great. This is where my project comes in. My project replaced the old math interaction with 3 new interactions, one for numeric expressions, one for algebraic expressions, and one for equations.

Each of these new interactions has capabilities of detecting various kinds of answers from the learner so that the lesson creator can provide genuinely helpful feedback instead of just saying that the answer is correct/incorrect.

Demo lesson playthrough using the new interactions

Take a look at my accepted proposal here.

Milestone 1

My target for the first milestone was to add the algebraic expression and math equation interactions with 2 rules. One for detecting if the learner’s answer is exactly equal to the creator’s answer, and the other for detecting if the learner’s answer is equivalent to the creator’s answer.

Since eventually, the plan was to completely remove the old interaction from the codebase, all the lessons that used the old interaction had to be upgraded to one of the new interactions. To do this, I wrote a map-reduce job that audited the data and made necessary changes in order to make it compatible with the new interactions.

Pull requests

1.1: Added nerdamer library (link)

Nerdamer is a symbolic math expression evaluator written in JavaScript. In the project, it is used to parse, validate, and operate on the answers provided by the user and thereby allowing us the show relevant warnings to the user.

1.2: Added math objects with validators (link)

Objects for storing these expressions and equations in the backend were added in this PR. I also wrote a top-down math expression parser for syntactic validation. This would make sure that any expression/equation that gets stored in the backend is syntactically valid based on a custom grammar that ensured the syntax checks were consistent between the frontend and backend.

1.3: Added position-of-terms and math editor directives (link)

In this PR, I added frontend templates in Angular for the objects that were added in the previous PR.

1.4: Added Algebraic Expression Input Interaction (link)

1.5: Added Math Equation Input Interaction (link)

1.6: Added a one-off job for math expression input validation (link)

In this PR, I wrote a map-reduce job that audited all the data on the production server. It also classified each answer into a category that indicates the type of interaction that answer needs to be upgraded to (numeric, algebraic, or equation). All syntactically invalid data was either programmatically or manually corrected.

Milestone 2

My target for the second milestone was to add the numeric expression interaction with 4 rules. These rules detect if the learner’s answer:

  • Matches exactly with the creator’s answer
  • Is equivalent to the creator’s answer
  • Contains some of the terms present in the creator’s answer
  • Omits some of the terms present in the creator’s answer

I also added a map-reduce job to migrate old data to the new interactions. Lastly, this milestone involved adding an on-screen keyboard for mobile compatibility.

Pull requests

2.1: Added Numeric Expression Input Interaction (link)

2.2: Upgrade explorations that use the old math interaction (link)

A map-reduce job was added for the state migration of upgrading the old interaction data to the new one.

2.3: Added an on-screen keyboard for math interactions (link)

Demo of the on-screen keyboard
Demo of the on-screen keyboard

Note that the letters that the learner can use are customizable, i.e., the creator can mention what letters should be displayed to the learner. This is to ensure that learners, especially younger ones, don’t get confused and overwhelmed with too many letters (roman and greek).

Milestone 3

My target for the third milestone was to add 3 new rule types to the algebraic expression and math equation interactions. These three rules detect if the learner’s answer:

  • Contains some of the terms present in the creator’s answer
  • Omits some of the terms present in the creator’s answer
  • Matches with the general form (provided by the creator). For eg, the general form could be like y=mx+c with placeholders as m and c. If the learner enters something like y=4x+5, it would get matched.

I also added a customization option for the creators to be able to mention the letters that will be displayed to the learner when they are using the on-screen keyboard. Lastly, after finishing all this, I stably deprecated the old interaction and completely removed all code referencing it from the codebase.

Pull requests

3.1: Added 3 rules to Algebraic Expression Input and Math Equation Input (link)

3.2: Removed the old math interaction (link)

3.3: Added a customization arg for math interactions (link)

Demo of the customization option
Demo of the customization option

3.4: Miscellaneous bug fixes (link)

Future Plans

There is a lot of potential for adding more functionalities to these interactions. Some of the enhancements/additions that I’ve envisioned for these interactions include:

  • Authoring new lessons that leverage the features that these newly added interactions provide.
  • Changing the RTE math editor to use guppy for an intuitive experience instead of forcing the learner/creator to enter a LaTeX string.
  • Adding a customization argument that would support swappable variables. For instance, if the correct answer is pi*r^2 and the learner enters pi*x^2, it should be validated as correct.
  • Add rules to support inputs on more advanced topics such as calculus, matrices, etc.

Conclusion

I would like to thank my mentor, Akshay Anand, for guiding me, especially through the difficult phases of the project, and making sure I was on the right track. I learned a lot of useful skills from him, and it was really fun to work under his guidance!

Moreover, I would like to thank all the members of Oppia’s community for being so inviting to newcomers and helping each other grow in every way possible. I’ve had a lot of fun working on this project and I would love to keep contributing to the organization in the future as well!

--

--