Download the PHP package learnosity/learnosity-qti without Composer
On this page you can find all versions of the php package learnosity/learnosity-qti. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download learnosity/learnosity-qti
More information about learnosity/learnosity-qti
Files in learnosity/learnosity-qti
Package learnosity-qti
Short Description Learnosity QTI Conversion Library
License GPL-2.0
Informations about the package learnosity-qti
Notice
This library is open source and currently is not actively maintained by Learnosity.
Users should fork this repository to fix any issues found or feature requests required.
--
Learnosity QTI
This package converts between QTI 2.1 Assessment Items and Learnosity JSON.
You can choose between 2 main jobs:
convert:to:learnosity
- Converts QTI v2.1 to Learnosity JSONconvert:to:qti
- Converts Learnosity JSON to QTI v2.1
Installation via Composer
Using Composer is the recommended way to install Learnosity QTI for PHP. In order to use the package with Composer, you must add "learnosity/learnosity-qti" as a dependency in your project's composer.json file.
Then, install your dependencies
Or just do:
For bleeding edge:
Make sure to add $HOME/.composer/vendor/bin directory to your $PATH so the mo
executable can be located by your system. If not, simply replace all mo
commands below with ./bin/mo
(from the root of the project).
This package has been tested on PHP 7.4+
Usage
The mo
command line runner
Use the command line tool, mo
to run conversion jobs. To see all jobs, run mo list
:
Converting QTI to Learnosity JSON
By default, Learnosity QTI expects a QTI content package, including an imsmanifest.xml.
To convert QTI 2.1 to Learnosity JSON, run the following:
organisation_id
is a mandatory option, where the value is an integer of your Learnosity item bank (organisation).
By default this will look for content packages inside the ./data/input
directory, and output raw results to ./data/output/raw
and final item JSON to ./data/output/final
. A job manifest file will be written to ./data/output/log
, indicating errors or warnings found during the conversion.
Note that only the data
folder is present in this repository, you can create the data/input
folder to add content packages there. The data/output
path will be created automatically if you don't override via input options.
Conversion options
If you want to use different input and/or output paths you can use options:
All supported input options are as follows:
Option | Default | Description |
---|---|---|
‑‑organisation_id | [Mandatory] Which Learnosity item bank to use, contact Learnosity for your organisation_id value |
|
--input | ./data/input |
File system path to the source content being converted |
--output | ./data/output |
File system path to where the converted content will be written |
‑‑item-reference-source | item |
Where to retrieve each items unique identifier from the QTI.
|
--passage-only-items | No |
Whether HTML passages should be created as separate, passage-only, items.
|
--single-item | No |
To convert a single QTI <assessmentItem> instead of a full content package, pass Yes and a path to a single XML file to --input |
Assets
The conversion library will update any asset URL inside QTI content to use the fololwing Learnosity CDN address:
https://assets.learnosity.com/organisations/[integer]/[filename]
The organisation
value is taken from the --organisation_id
input parameter passed to the command line.
Supported file types include:
- images
- audio files (mp3)
- video files (mp4)
When importing content using the Data API, you can add files using the Upload Assets endpoint.
Metadata (LOM)
Metadata will be taken from the content package manifest and converted to Learnosity tags. The format is assumed to be:
This will be converted to the following Learnosity JSON (snippet only):
Note that <imsmd:source>
translates to Learnosity tag types, and <imsmd:taxon>
translates to tag names.
Supported Interactions - QTI to Learnosity
The following QTI v2.1 interactions are supported:
QTI Interaction | Learnosity Question Type | Learnosity Widget Value |
---|---|---|
ChoiceInteraction | Multiple Choice Question | mcq |
ExtendedTextInteraction | Essay | longtextV2 |
GraphicGapMatchInteraction | Image Association | imageclozeassociationV2 |
GapMatchInteraction | Cloze Association | clozeassociation |
HottextInteraction | Token Highlight | tokenhighlight |
InlineChoiceInteraction | Cloze Dropdown | clozedropdown |
MatchInteraction | Choice Matrix | choicematrix |
OrderInteraction | Order List | orderlist |
TextEntryInteraction | Cloze Text | clozetext |
HotspotInteraction | Hotspot | hotspot |
Rubrics
<rubricBlock>
elements are commonplace in QTI documents. Learnosity can treat these as:
- passages
- distractor rationale
- rating question types (for scoring)
Passages
Learnosity has the concept of a Passage, which is a separate HTML fragment that can be added to single items, or shared across multiple items. By default, the conversion library looks for the following QTI to be converted into a passage:
In the example above, the contents of the passage come from an external file in the content package. You can also include the passage contents inline (inside the <rubricBlock>
element).
Note that the use
attribute must be context
, and the view
attribute must include candidate
.
The Learnosity JSON generated would contain 2-columns, the passage(s) in the left and the question(s) in the right.
Multiple passages
If 2 passages are found in a QTI item, a tabbed interface will appear in the converted JSON (in the left-column).
If 3 (or more) passages are found, they will be stacked vertically in the UI (no tabs).
"Shared" Passages
In the converted results, the Learnosity reference (unique identifier) to a passage is generated from a hash of the passage body. So, we automatically "share" a passage if an exact match is found based on the contents of the passage.
Distractor rationale
Students
If the use
attribute of a <rubricBlock>
element is rationale
, and the view
attribute contains candidate
, the conversion library will generate distractor_rationale_response_level
inside the question metadata.
The contents of the <rubricBlock>
will be broken down by block elements, one for each array element of distractor_rationale_response_level
. Eg:
Would generate the following JSON:
If <feedbackInline>
elements are found, they will be converted to distractor_rationale_response_level
. Eg with the following for a choice interaction:
The feedbackInline
contents will be converted to distractor_rationale_response_level
array elements.
Graders
If the class
attribute of a <rubricBlock>
element is DistractorRationale
, and the view
attribute contains author
, the conversion library will generate distractor_rationale_scorer
as a custom metadata field inside the question metadata.
The contents of the <rubricBlock>
will be used, eg:
Would generate the following JSON:
It would up to the host page calling the Assessment API to render this content to a grader.
Unsupported
Learnosity QTI does not support:
<assessmentItem>
with no interactions (passage-only or rubric-only)- Custom CSS stylesheets. These must be loaded separately at run time for the host page initialising the Assessment API.
Note that only <assessmentItem>
are supported, no other QTI elements like <assessmentTest>
.
Help
Remember you can ask for help
:
Importing into Learnosity
Once you have Learnosity JSON (the final
folder), you can use the Data API to import into your Learnosity hosted item bank.
Example of the output format is:
Loop over all item objects inside qtiitems
.
Inside each item object, import the questions (setQuestions) and features (setFeatures) first, then the item (setItems). Setting items will automatically import any tags that were in the manifest.
Converting Learnosity JSON to QTI
To convert Learnosity JSON to QTI 2.1, run the following:
By default this will look for content packages inside the ./data/input
directory, and output raw results to ./data/output/raw
. A manifest file will be written to ./data/output/log
.
Note that only the data
folder is present in this repository, you can create the data/input
folder to add content packages there. The data/output
path will be created automatically if you don't override via input options.
Conversion options
If you want to use different input and/or output paths you can use options:
All supported input options are as follows:
Option | Default | Description |
---|---|---|
--input | ./data/input |
File system path to the source content being converted |
‑‑output | ./data/output |
File system path to where the converted content will be written |
‑‑format | qti |
A flag to choose how to format the QTI output content package, from a list of supported formats. This option supports the following possible values: (canvas, qti). Pass the canvas option to export. QTI content that is compatible with Canvas LMS. The default is qti, which outputs non LMS-specific QTI. |
Learnosity JSON format
This conversion tool expects to be given JSON in the format that is returned by the offline package endpoint of the Data API. The Data API itembank/offlinepackage
endpoint returns Activities/Items/Questions/Features in a single directory. It also contains any assets, including images, audio or video, that are part of the content.
The directory returned from the itembank/offlinepackage endpoint contains the following files:
Each JSON file within the items folder is named from a (lower case) MD5 hash of the item reference. The contents of each item file will be something like:
Supported Question Types - Learnosity to QTI
The following Learnosity question types are supported:
Learnosity Question Type | Learnosity Widget Value | QTI Interaction |
---|---|---|
Choice Matrix | choicematrix | MatchInteraction |
Cloze Association | clozeassociation | GapMatchInteraction |
Cloze Dropdown | clozedropdown | InlineChoiceInteraction |
Cloze Text | clozetext | TextEntryInteraction |
Essay | longtext | ExtendedTextInteraction |
Essay with rich text | longtextV2 | ExtendedTextInteraction |
Hotspot | hotspot | HotspotInteraction |
Image Cloze Association | imageclozeassociation | GraphicGapMatchInteraction |
Image Cloze Association V2 | imageclozeassociationV2 | GraphicGapMatchInteraction |
Multiple Choice Question | mcq | ChoiceInteraction |
Order List | orderlist | OrderInteraction |
Passage | sharedpassage | N/A |
Plain Text | plaintext | ExtendedTextInteraction |
Short Text | shorttext | TextEntryInteraction |
Token Highlight | tokenhighlight | HottextInteraction |
Known limitations
General
You cannot use <u>
elements in QTI 2.1. We suggest using a <span>
with a CSS classname instead.
All template
fields must be wrapped in a block element.
Cloze Association
Cannot use the group possible responses option.
Help
Remember you can ask for help
:
All versions of learnosity-qti with dependencies
symfony/config Version ^3.4
symfony/console Version ^3.4
symfony/dependency-injection Version ^3.4
symfony/http-foundation Version ^5
symfony/finder Version ^3.4
symfony/yaml Version ^3.4
qtism/qtism Version ^19.0
learnosity/learnosity-sdk-php Version >=1