Implementation of a soft grading system for chemistry in a Moodle plugin
Journal of Cheminformatics volume 14, Article number: 72 (2022)
We report a novel approach for grading chemical structure drawings for remote teaching, integrated into the Moodle platform. Typically, existing online platforms use a binary grading system, which often fails to give a nuanced evaluation of the answers given by the students. Therefore, such platforms are unevenly adapted to different disciplines. This is particularly true in the case of chemical structures, where most questions simply cannot be evaluated on a true/false basis. Specifically, a strict comparison of candidate and expected chemical structures is not sufficient when some tolerance is deemed acceptable. To overcome this limitation, we have developed a grading workflow based on the pairwise similarity score of two considered chemical structures. This workflow is implemented as a Moodle plugin, using the Chemdoodle engine for drawing structures and communicating with a REST server to compute the similarity score using molecular descriptors. The plugin (https://github.com/Laboratoire-de-Chemoinformatique/moodle-qtype_molsimilarity) is easily adaptable to any academic user; both embedding and similarity measures can be configured.
Several solutions have been proposed in the past few years for the remote teaching of chemistry. One of the first tools implying using a chemical structure sketcher for organic chemistry online tutorials with automated correction was described by O'Sullivan and Hargarden . The drawing prepared by the student is exported to a canonical SMILES (Simplified Molecular Input Line Entry Specification)  string, followed by the evaluation based on its comparison with an expected answer in SMILES format. Such a solution is realized in the SOCOT platform maintained by the University of Cork and the Dublin Institute of Technology. A similar solution was developed by Flynn et al.  for learning nomenclature in chemistry; it is accessible on the nomenclature101.com web service hosted by the University of Ottawa. Morsh and Lewis  described how the teacher and the students exchange chemistry questions and answers at the University of Illinois–Springfield and at Saint-Louis University, using a touchpad.
OpenOChem  is another tool accessible from several Learning Management Systems (LMS). Therefore, it leaves room for Learning Tools Integration (LTI). Unfortunately, the solutions described in [4, 5] cannot be integrated with Moodle  or Scenari —Scenari is a popular LMS in France. Moreover, these solutions are based on the ChemAxon web services , which are free for academic organizations as long as the company maintains this policy.
Most existing online platforms use a binary grading system, implying a strict comparison of the two canonical SMILES. However, as noticed by Richards-Babb et al. , questions whose solutions are based on a limited number of choices are often ineffective for self-assessment. According to their estimations, about a third of students simply try different suggested choices instead of turning to the course or remediation materials when they do not know the answer. It should also be noted that some questions need smooth grading. A typical example concerns the demand to prepare a chemical structure corresponding to a given SMILES string. The binary assessment results in a grade equal to zero in case of any minor error, whereas the smooth assessment distinguishes the level of students as a function of the number of mistakes in the answer.
Here, we describe a novel software tool able to perform a smooth grading of chemical structures using the Moodle platform. In order to make the tool accessible to any educational institution, we follow the Moodle philosophy , so the plugin and all its components are free and open source. Unlike already existing plugins, our tool doesn’t transform chemical structures into canonical SMILES because the latter can hardly be applied in certain chemistry case studies . Instead, InChI strings and ISIDA fragment descriptors were used for chemical structure encoding, whereas a pairwise Tanimoto similarity score for teacher/student structures was used for a smooth evaluation of students.
A fragmentation scheme, or embedding, is defined by a set of parameters stored in the configuration file; thus, the administrator can tune the parameters if needed. The fragments used to compute the molecular similarity are enumerated from the chemical structure of the teacher’s answer; they are not pre-defined. The default fragmentation scheme supports organic chemical structures, eventually containing inorganic elements. It takes into account lone pairs, radicals, and formal charges. The grading is sensitive to the presence or absence of explicit hydrogens in the structures–the management of the hydrogens being a part of the evaluation.
The pairwise stereochemistry comparison is based on the InChI  strings generated with the help of the InChI v. 1.06 program . The two compared structures without stereo labels must be identical. For them, the algorithm compares the information in related stereo-layers; for example, [/t number_of_atom, stereo_label /m chirality_label], where stereo_label = “ + ” and “−” and chirality_label = “0” and “1”.
The communication security between the Moodle server and the REST server is based on JWT (JSON Web Token) , an industry standard to secure requests between two entities. They contain three different parts: the header, the payload, and the signature. The header specifies the type of algorithm used to encrypt the signature and the type of token. The payload contains data, including the time at which the token has been issued. Both the header and the payload will be Base64Url encoded . The signature is created using both the header, the payload, and a secret shared between Moodle and the REST API. Therefore, an attacker is not able to change the message without knowing the secret, as a given signature matches only one set of header, payload, and secret.
The plugin implementation involves three main steps: (i) formulating a question, (ii) answering a question, and (iii) displaying a teacher’s feedback. In this plugin, the teacher inputs from 1 to N deemed correct answers, allowing for several alternative structures (the plugin does not allow the teacher to define “inexact” answers). For instance, for the question “what is the structure of glucose?” both furanose and pyranose forms of glucose can be accepted as answers.
Thus, for each answer, the teacher needs to draw the expected structure using the Chemdoodle Web Component Ketcher, then click on the ‘Insert given structure as answer/update the answer with the structure’ button in order to insert this structure (Fig. 2, top). In this case, Chemdoodle JSON is used to encode a given chemical structure in MOL format. Both the Molfile and the Chemdoodle JSON will be saved as an answer in JSON format to the Moodle database.
Apart from chemical structures, the teacher can prepare instructions and feedback for the students. Two kinds of feedback are possible: “general” grade-unrelated feedback and “specific” feedback, displayed if a grade is inferior to 1, aiming to help students improve their answers. Upon taking a test, a student follows the teacher’s instructions in order to prepare the required chemical structure (Fig. 2, bottom).
Once submitted, the answer is processed using the same procedure as for the teacher’s question (see above). Then, the answers of both the teacher and the student are sent through a cURL  request to the correction REST API, written in the Pascal Object language . Connections to the REST API are authenticated using the JWT standard. If the REST server does not respond, the Moodle administrator is notified, and the student’s answer is saved and marked as Requires grading. If a request is sent to the correction REST API and the authentication is not validated, the Moodle administrator is noticed that someone attempts to access to the correction REST API and receives related IP address.
Once the request is authenticated, the grade grest based on Tanimoto similarity between the student’s and teacher’s structures is computed on the REST server. Every chemical structure is encoded using the ISIDA molecular descriptors; by default, fragmentation IAB(2–4)FC_UR is used. It stands for sequences of 2–4 atoms and bonds, taking into account formal charges, lone pairs and radicals. It also includes atom count. If there are several structures prepared by the teacher, the highest Tanimoto score and the corresponding pair of student/teacher structures are kept for the upcoming steps. If the stereochemistry analysis is not requested, the grade grest is sent back to Moodle. Otherwise, InChI  strings are used to compare the teacher’s and student’s structures containing stereo-centers (the stereo centers can be either R/S or Z/E). The grest value is computed as the proportion of correctly drawn stereo centers (“\(\#Correct Stereo Center\)”) over the total number of stereo centers in the chemical structure (“\(\#Total Stereo Center\)”), and sent back to Moodle:
Notice that the stereocenter comparison becomes impossible if the structures (without stereo labels) are not identical. For this reason, if the similarity score is not equal to 1, a grest of 0 is returned to Moodle. Typical examples illustrating grading methodology including/excluding stereochemistry analysis are demonstrated in Fig. 3. For instance, if the student confuses an alcohol function with an ether, the Tanimoto similarity score student/teacher structures is 0.8. Therefore, the final grade is either zero, if the stereochemistry is required, or 0.8, otherwise.
Once the grade computed by the REST server is returned to the Moodle server, the final grade g is calculated according to formula (2) where t and α are user-defined parameters. Both parameters (α and t) can be set at the level of the question editor (Fig. 2, top) and can differ from question to question.
The parameter α modulates the teacher’s exigency: more lenient (α < 1) or more severe (α > 1). The t parameter is a threshold under which the grade is set to 0, to avoid attributing points to unacceptable answers.
Finally, the general feedback containing the expected answer is shown to the student, accompanied by the specific feedback if g < 1 (Fig. 4).
In this section, we describe several typical examples which can be realized with the developed plugin.
Example 1. Drawing a Lewis structure
Both lone pairs, radicals and explicit/implicit hydrogens are considered. Since the correction is not binary, it allows students to be awarded some of the points even if some structural details are missed. For example, when asked for the Lewis structure of Nitrosyl Fluoride, forgetting one of the lone pairs on the Fluorine atom would result in a grade of 0.9/1.
Example 2. Identification of the major product of a reaction
The soft grading system better assesses the student’s understanding of the regioselectivity, because the minor products is often similar with the major one. For example, if asked for the major product of 2,3-Dimethyl-2-butanol dehydration by H2SO4, the incorrect result would get a grade of 0.68.
Example 3. Drawing a given configuration (R/S, E/Z) of a molecule
If a compound has multiple stereo-centers but some stereo-centers were not found by the student, the soft grading system can be particularly useful. For instance, the question “what is the structure of glucose?” requires the student to consider stereochemistry. In this case, three structures are legitimate answers: open, furanose, and pyranose forms of glucose. Therefore, the teacher should prepare related structures by adding them as expected answers (see Fig. 5). Moreover, for the open form, the structures with both explicit and implicit hydrogen on the aldehyde group on the aldehyde need to be anticipated (Fig. 5, first line). Finally, the teacher needs to consider the stereo-orientation of the methoxy-substituent of the furanose and pyranose forms. In such a way, all 8 alternative structures of glucose (Fig. 5) must be considered as the correct answer. Let’s suggest that the student prepare the structure shown in Fig. 6, top. Compared to the closest teacher’s structure, s/he has correctly drawn 3 out of 4 stereo-centers. Thus, according to formula (2), his grade is 0.75. Both grade and teacher’s feedback are displayed after examination by the algorithm (Fig. 6, bottom).
It should be noted that the soft grading is “global”, therefore it is presently not possible to give more importance to a given substructure.
A new open source Moodle plugin for the assessment of chemical structures has been developed. It significantly extends an arsenal of chemical questions requiring students to draw chemical structures. A soft grading algorithm was implemented in order to reasonably assess the students’ skills. The tool is provided with the REST API server that can be used in any institution. It is highly secure with an authentication method needed to access the API, and it allows the teacher to ask chemical questions where the student has to draw her/his answer thanks to the implemented soft grading algorithm. This plugin only needs to be installed by the Moodle administrator of the institution, following the same procedure as any other Moodle plugin. It appears as a specific type of question when preparing a test. This work could be enhanced by the addition of several features, such as the possibility to consider wrong answers to give specific feedback to the students (for example, when requested to draw the major product of a reaction, it is desirable to consider the minor product as a wrong answer to provide some specific explanation to the student). The creation of a dedicated tool to automate the editing of questions using a set of chemical structures could be a useful addition–by generating questions in XML format that can be imported into Moodle, for instance. Other options to tune the soft grading are also desirable. For instance, it could be possible to let the teacher build the grade as a weighted sum of the structural similarity and the stereochemistry score. Another improvement could be to let the teacher decide if the module should standardize the protonation of the chemical structures. This work will be improved by the addition of a new layer which enables the asynchronous execution of the evaluation server, on dedicated Docker containers, managed by a RabbitMQ system (Queue message system) . It is fully available from the git of the project: https://github.com/Laboratoire-de-Chemoinformatique/moodle-qtype_molsimilarity.
Availability of data and materials
Software is available on the web page of the project: https://github.com/Laboratoire-de-Chemoinformatique/moodle-qtype_molsimilarity. No additional data has been used.
Project name: molsimilarity.
Project home page: Git: https://github.com/Laboratoire-de-Chemoinformatique/moodle-qtype_molsimilarity
Operating system(s): Linux, Mac & Windows.
Other requirements: Moodle 3.9.
License: GNU GPL v3 or later, IUPAC/InChI-Trust Licence No.1.0.
O’Sullivan TP, Hargaden GC (2014) using structure-based organic chemistry online tutorials with automated correction for student practice and review. J Chem Educ 91:1851–1854. https://doi.org/10.1021/ed500140n
Weininger D (1988) SMILES, a chemical language and information system. 1. Introduction to methodology and encoding rules. J Chem Inf Model 28:31–36. https://doi.org/10.1021/ci00057a005
Flynn AB, Caron J, Laroche J et al (2014) Nomenclature101.com: a free, student-driven organic chemistry nomenclature learning tool. J Chem Educ 91:1855–1859. https://doi.org/10.1021/ed500353a
Morsch LA, Lewis M (2015) engaging organic chemistry students using chemdraw for iPad. J Chem Educ 92:1402–1405. https://doi.org/10.1021/acs.jchemed.5b00054
LeBlond C, Bucholtz E, Muzyka J (2019) OpenOChem: An LMS agnostic chemistry quizzing platform. In: DivCHED CCCE: Committee on Computers in Chemical Education. http://confchem.ccce.divched.org/2019CCCENLP3. Accessed 13 Dec 2021
Moodle home page. https://moodle.org. Accessed 9 Dec 2021
Scenari home page. https://scenari.org/index.html. Accessed 10 Dec 2021
ChemAxon main page. https://chemaxon.com/. Accessed 10 Dec 2021
Richards-Babb M, Curtis R, Georgieva Z, Penn JH (2015) Student perceptions of online homework use for formative assessment of learning in organic chemistry. J Chem Educ 92:1813–1819. https://doi.org/10.1021/acs.jchemed.5b00294
Moodle (2014) Using learning communities to create an open source course management system. In: Dougiamas. https://dougiamas.com/archives/edmedia2003/. Accessed 14, Dec 2021
O’Boyle NM (2012) Towards a universal smiles representation—a standard method to generate canonical smiles based on the InChI. J Cheminform 4:22. https://doi.org/10.1186/1758-2946-4-22
Burger MC (2015) ChemDoodle web components: HTML5 toolkit for chemical graphics, interfaces, and informatics. J Cheminform 7:35. https://doi.org/10.1186/s13321-015-0085-3
Ruggiu F, Marcou G, Varnek A, Horvath D (2010) ISIDA property-labelled fragment descriptors. Mol Inf 29:855–868. https://doi.org/10.1002/minf.201000099
Varnek A, Fourches D, Horvath D et al (2008) ISIDA—platform for virtual screening based on fragment and pharmacophoric descriptors. Curr Comput Aided Drug Des 4:191–198. https://doi.org/10.2174/157340908785747465
Heller SR, McNaught A, Pletnev I et al (2015) InChI, the IUPAC international chemical identifier. J Cheminform 7:23. https://doi.org/10.1186/s13321-015-0068-4
Download page of the InChI Trust. https://www.inchi-trust.org/downloads/. Accessed 11, Dec 2022
Jones M, Bradley J, Sakimura N (2015) JSON Web Token (JWT). Internet Req Comments RFC 7519. https://doi.org/10.17487/RFC7519
Josefsson S (2006) The Base16, Base32, and Base64 Data Encodings. Internet Req Comments RFC4648. https://doi.org/10.17487/rfc4648
cURL website. In: cURL://. https://curl.se/. Accessed 11 Jan 2022
Alekseev E, Chesnokova O, Kucher T (2021) Free Pascal and Lazarus—a textbook on programming. ALT Linux library, Moskow
Wood A (2016) Rabbit Mq for Starters. California, USA
This work has benefited from a state aid managed by the National Research Agency under the program “Investissements d’avenir” with the reference ANR-20-NCUN-0004 DEPHY.
Ethics approval and consent to participate
No competing interest to declare.
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
About this article
Cite this article
Plyer, L., Marcou, G., Perves, C. et al. Implementation of a soft grading system for chemistry in a Moodle plugin. J Cheminform 14, 72 (2022). https://doi.org/10.1186/s13321-022-00645-0