Angular Reactive Form Custom Validator for ORCID (plus Laravel rule)

Since I struggled a bit with putting this together, thought it might be useful to document it.

ORCID provides a handy guide to the Structure of the ORCID Identifier which includes a little function that calculates the 16th ‘checksum’ character of every ORCID id. This is a great way to check that a user hasn’t mis-typed/mis-copied their ORCID id into a form.

Our Angular validator for reactive forms is shown below:

All this really does is wrap that check digit generator from the ORCID website. To use this in a reactive form, the relevant bits of code are shown below:

If anyone can write me a bit of regex to check that the rest of the URL, after is xxxx-xxxx-xxxx-xxxx, I’d be very grateful!

Finally, in the html (note am using Angular Material here), check for errors on the orcid FormControl (available like this  because of line 20 above) and display the approprioate <mat-error>.

…and if you’re saving your ORCID ID in a Laravel api backend as I am, the same checksum validation as a Laravel Rule:

…and in the update method of my UserController, the validation rules look like:

Note: the ignore clause on the unique rule would not be required in the store method as this user’s id and ORCID id would not be expected to already exist

Any suggestions for improvements gratefully received.



ical/ics feed from Rapla

We’ve been using Rapla resource booking system for years now to manage room (and associated resources such as laptops, furniture, etc) bookings and have been using the Export2iCal plugin to pull data from Rapla and display it in various other ways. I thought it would be useful to just jot down a couple of features of Rapla/iCal that may not be obvious for anyone else thinking of doing this.

  1. The url for the ical feed is:


    • username is the name of the user who has published a view on Rapla
    • fileName [for the optional file parameter] is the name of the view to return. If the file parameter is omitted, it will return the Default view.

    The thing to note here is that the ical feed returned contains the events for those resources that are shown in the Default or other named view for the user, username.

  2. In order to access a view via ical, it must first be published. This is achieved by selecting the desired view (or Default) and then clicking the Publish button, and ticking the ICAL Publish checkbox.
  3. To set which resources are shown in a given view, simply Ctrl-click to highlight them then click the Save button for the view.




New assessment services for maths, statistics and free text from MSDLT


Mobile MedLearn
A view of MedLearn in Moodle, shown on a phone screen

MSDLT can now offer formative assessments in mathematics and statistics. To overcome the common criticism of multiple choice questions – that the answer is on the screen – our new service marks typed algebraic and numerical answers, understanding concepts such as simplification, significant figures, decimal places, etc.

Our aim is to improve students’ understanding of the criteria against which they are assessed – an area highlighted by students in the 2016 National Student Survey – without a corresponding increase in academic marking time. Computer-marked self-assessment should enable them to obtain feedback on their performance over a wider cross-section of their course’s learning objectives.

Cancelling Algebraic Fractions
Cancelling algebraic fractions. The CAS generates random numbers for the questions, and uses them to mark and display the worked answers.

Behind the scenes our service connects to a Computer Algebra System so questions can use random variables and can address probability, inference and descriptive statistics. Quizzes launch from seamlessly from WebLearn, without requiring a separate login.

As well as the algebraic and numeric questions, we can offer ordering; drag and drop; and a variety of multiple choice questions. We are currently also piloting computer marking of phrases and sentences with Experimental Psychology.

Embryo Grading Exercise
Video of embryos with questions and cue points

The system has already delivered a maths bridging course for incoming Biochemistry students over summer 2016. It has also enabled students on the MSc in Clinical Embryology to take a novel ‘authentic’ assessment of their ability to assess the viability of embryos for implantation.

“Excellent practice, Thanks!” – Student on MSc in Clinical Embryology

Self-test questions in Moodle

In an earlier post I outlined plans for migration of MedLearn to Moodle. The technical work is now done except for editor plugins. The migration is well underway.

The tricky bit was getting the self test questions to work. The purpose of self test questions is to enliven content and enhance learning. They are not intended to be an assessment, although it may be useful to record the answers.

The Quiz activity provides the best range of question types but it also forces questions into an assessment with a very specific workflow (start attempt; answer questions; finish; submit; review). We wanted a much looser workflow which did not present questions as a quiz. The answer (suggested by Tim Hunt) was to embed a preview question in an iFrame. We chose the Book module for the content into which the questions were embedded.

Students log in to our VLE (Sakai). They then launch an LTI tool which automatically provisions them in Moodle. They are assigned an adapted set of permissions to avoid the issues highlighted by Tim Hunt in this post. The LTI provider plugin does all the provisioning, including the assignment of the role with the permissions.

Questions are inserted into the book content using Generico filter and Atto plugin. I’ve defined a template which just takes the question number and applies the correct iFrame. A Javascript frame resize script triggers on load (and on change) so that the question appears seamlessly in the content. The plugin also has an Atto editor plugin to simplify editing.

I have modified the preview PHP so that the title and config have been stripped off, leaving just bare question with answer box and ‘check’ button. The preview PHP still accepts the querystring configuration so I passed &correctness=0&marks=0&markdp=0&feedback=1&generalfeedback=1&rightanswer=1&history=0 to it in the Generico template.

The script tag to load the JavaScript resize code is in AdditionalHTML config.

We’ve also made the content more mobile friendly using Bas Brand’s Bootstrap  3 theme and more semantically relevant HTML5 tags such as <figure>, <cite>, <dfn> and <dl>. We are about to start authoring Atto plugins to support these tags. JQuery is used to for image swaps, replacing the mouseovers and flash which aren’t mobile friendly.

The only missing feature which would be really nice to have is a way of browsing the questions from the question bank for insertion. It’s currently a little clunky to find the question ID for use in the Generico Atto plugin.

My thanks go to Tim Hunt, Juan Leyva (LTI Provider) and Justin Hunt (Generico) for making the tools which underpin this integration.