# Implementation of a soft grading system for chemistry in a Moodle plugin

Louis Plyer, Gilles Marcou, Céline Perves, Rachel Schurhammer, Alexandre Varnek

► To cite this version:

Louis Plyer, Gilles Marcou, Céline Perves, Rachel Schurhammer, Alexandre Varnek. Implementation of a soft grading system for chemistry in a Moodle plugin. Journal of Cheminformatics, 2022, 14 (1), pp.72. 10.1186/s13321-022-00645-0. hal-04887384

HAL Id: hal-04887384

https://hal.science/hal-04887384v1

Submitted on 14 Jan 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
SOFTWARE

Open Access

<figure><img src="image_2.png" /></figure>

Check for
updates

# Implementation of a soft grading system for chemistry in a Moodle plugin

Louis Plyer¹, Gilles Marcou<fnref n="2" />*, Céline Perves³, Rachel Schurhammer¹ and Alexandre Varnek<fnref n="2" />

**Abstract**

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.

**Keywords:** Educational chemistry, Softgrading, Moodle, Plugin

**Introduction**

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 [1]. The drawing prepared by the student is exported to a canonical SMILES (Simplified Molecular Input Line Entry Specification) [2] 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. [3] for learning nomenclature in chemistry; it is accessible on the nomenclature101.com

web service hosted by the University of Ottawa. Morsh and Lewis [4] 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 [5] 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 [6] or Scenari [7]—Scenari is a popular LMS in France. Moreover, these solutions are based on the ChemAxon web services [8], 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. [9], 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

<footnote>*Correspondence: g.marcou@unistra.fr</footnote>

<footnote n="2">² Laboratory of Chemoinformatics-UMR7140, University of Strasbourg, Strasbourg, France
Full list of author information is available at the end of the article</footnote>
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 [10], 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 [11]. 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.

## Development

A workflow used by the developed plugin is shown in Fig. 1. In this implementation, we use an in-house correction algorithm hosted on a REST server. It computes the similarity between the student's and teacher's

chemical structures. A REST server is, in our opinion, the most relevant technology in this context. It can be managed as suited by the end user—for instance, it can be installed on the same server as Moodle, encapsulated in a virtual machine or a different machine. The server uses little computing power. It doesn't store any data and communicates exclusively with the Moodle server. Data is exchanged using the JSON (JavaScript Object Notation) [12] format, which is a standard in web applications and server transfers. The user interface is built using Chemdoodle Web Component [13], an open source JavaScript library providing a sketcher to draw chemical structures. It can export structures in both SDF (Structure Data File) and Chemdoodle JSON Format. The sketcher can also be used to import a MOL file instead of drawing the molecule. Some services of the sketcher, such as the support of other molecular file formats, have been disabled because they required connections to a foreign server. A pairwise Tanimoto similarity was computed using the ISIDA fragment descriptors [14, 15] generated with the help of the ISIDA Fragmentor2021 tool. ISIDA descriptors represent counts of subgraphs (fragments) of a molecular graph with defined topology and size, contrasting with fingerprint representations, in which a feature appears either present or absent.

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.

<figure><img src="image_3.png" /></figure>
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 [16] strings generated with the help of the InChI v. 1.06 program [17]. 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) [18], 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 [19]. 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.

## Implementation

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 [20] request to the correction REST API, written in the Pascal Object language [21]. 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 $g_{rest}$ 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 $g_{rest}$ is sent back to Moodle. Otherwise, InChI [16] 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 $g_{rest}$ value is computed as the proportion of correctly drawn stereo centers ("#CorrectStereoCenter") over the total number of stereo centers in the chemical structure ("#TotalStereoCenter"), and sent back to Moodle:

$$g_{rest} = \begin{cases} \frac{\#\text{Correct Stereo Center}}{\#\text{Total Stereo Center}}, & \text{if similarity score} = 1 \\ 0, & \text{if similarity score} \neq 1 \end{cases} \qquad (1)$$
<figure><img src="image_4.png" /><figcaption>**Fig. 2** (Top) Drafting of the question by the teacher. The “Insert given structure as answer / update the answer with the structure” button inserts the current drawing as answer. The “View structure in the editor” button loads the data of the given answer to the sketcher. The “Clear the answer” button removes the answer. (bottom) Interface for the student to answer the question. The teacher’s instructions are displayed above the sketcher</figcaption></figure>
<figure><img src="image_5.png" /></figure>

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 g<sub>rest</sub> 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.

$$g = \begin{cases} (g_{\text{rest}})^{\alpha}, & \text{if } (g_{\text{rest}})^{\alpha} \ge t \\ 0, & \text{otherwise} \end{cases} \qquad (2)$$

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).

## Question examples

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 hydrogen 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
<figure><img src="image_6.png" /></figure>

Draw the molecule of Benzylpenicillin.

Answer:

<figure><img src="image_7.png" /></figure>

Watch out for the spatial arrangement of the atoms !

Benzylpenicillin, also known as penicillin G or BENPEN, is an antibiotic used to treat a number of bacterial infections.

<figure><img src="image_8.png" /></figure>

The correct answer is:

<caption>**Fig. 4** Interface of the feedback shown to the student once her/his answer has been corrected. Above is the answer of the student, below the expected answer with the teacher's feedback. The mark of this question is displayed on the top left corner</caption>

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).

## Comments

It should be noted that the soft grading is “global”, therefore it is presently not possible to give more importance to a given substructure.

## Conclusion

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
<figure><img src="image_9.png" /><figcaption>**Fig. 5** Eight possible answers expected by the teacher: 2 open structures (with and without explicit hydrogen); 3 furanoses and 3 pyranoses for the α-, β- and undefined isomers</figcaption></figure>

plugin only needs to be installed by the Moodle admin-
istrator 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 addi-
tion–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 stereo-
chemistry 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) [22]. It is fully available
from the git of the project: https://github.com/Labor
atoire-de-Chemoinformatique/moodle-qtype_molsi
milarity.
**Question 1**

Partially correct

Mark 0.75 out of
1.00

What is the structure of glucose ?

Answer:

<figure><img src="image_10.png" /></figure>

Think about the stereochemistry !

Both the open, furanose and pyranose forms of glucose are legitimate answers !

<figure><img src="image_11.png" /></figure>

The correct answer is:

<caption>**Fig. 6** (top) The open form of glucose with explicit hydrogen on the carbonyl fragment and erroneous stereochemistry chosen by the student; (bottom) specific feedback and correct structure</caption>

**Acknowledgements**

Not applicable

**Author contributions**

LP, GM and AV are the main contributors to the manuscript and figures. GM and RS contributed to concept and design of the project. LP, GM, CP contributed to code and software development. GM, RS and AV contributed to fund management and fund raising. CP contributed to expertise with LMS, specifically on Moodle. AV, RS and GM contributed to pedagogical expertise. All authors have contributed the final manuscript. All authors read and approved the final manuscript.

**Funding**

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.

**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.

Programming language: PhP, JavaScript, Pascal Object.

Other requirements: Moodle 3.9.

License: GNU GPL v3 or later, IUPAC/InChI-Trust Licence No.1.0.

**Declarations**

**Ethics approval and consent to participate**

Not applicable.
**Competing interests**

No competing interest to declare.

**Author details**

Received: 21 March 2022 Accepted: 17 September 2022

Published online: 26 October 2022

**References**

1. 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

2. 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

3. 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

4. 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

5. 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/2019CCENLNP3. Accessed 13 Dec 2021

6. Moodle home page. https://moodle.org. Accessed 9 Dec 2021

7. Scenari home page. https://scenari.org/index.html. Accessed 10 Dec 2021

8. ChemAxon main page. https://chemaxon.com/. Accessed 10 Dec 2021

9. 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

10. Moodle (2014) Using learning communities to create an open source course management system. In: Dougiamas. https://dougiamas.com/archives/edmedia2003/. Accessed 14, Dec 2021

11. 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

12. Bray T (2014) The JavaScript Object Notation (JSON) data interchange format. Internet Requests for Comments RFC7159. https://doi.org/10.17487/rfc7159

13. 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

14. 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

15. 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

16. 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

17. Download page of the InChI Trust. https://www.inchi-trust.org/downloads/. Accessed 11, Dec 2022

18. Jones M, Bradley J, Sakimura N (2015) JSON Web Token (JWT). Internet Req Comments RFC 7519. https://doi.org/10.17487/rfc7519

19. Josefsson S (2006) The Base16, Base32, and Base64 Data Encodings. Internet Req Comments RFC4648. https://doi.org/10.17487/rfc4648

20. cURL website. In: cURL/. https://curl.se/. Accessed 11 Jan 2022

21. Alekseev E, Chesnokova O, Kucher T (2021) Free Pascal and Lazarus—a textbook on programming. ALT Linux library, Moskow

22. Wood A (2016) Rabbit Mq for Starters. California, USA

**Publisher's Note**

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Ready to submit your research? Choose BMC and benefit from:

* fast, convenient online submission

* thorough peer review by experienced researchers in your field

* rapid publication on acceptance

* support for research data, including large and complex data types

* gold Open Access which fosters wider collaboration and increased citations

* maximum visibility for your research: over 100M website views per year

At BMC, research is always in progress.

Learn more biomedcentral.com/submissions

<figure><img src="image_12.png" /></figure>

<footnote n="1">¹Faculté de Chimie, University of Strasbourg, Strasbourg, France. ²Laboratory of Chemoinformatics-UMR7140, University of Strasbourg, Strasbourg, France.</footnote>

<footnote n="3">³Direction du Numérique (DNUM), University of Strasbourg, Strasbourg, France.</footnote>