# Detail report

In Swiss Learning Hub, a detailed report can be created per learning content if the report definition (*report.xml*) and certain SCORM keys (**cmi.objectives.n.x** and **cmi.interactions.n.x** are provided by the learning object.

## Report definition

### File name and location
The XML file must always have the file name **report.xml** and must be stored in the *root* of the respective SCORM package. The detail report can only be created if the Swiss Learning Hub can find and use this file.

### Scheme
The [XSD scheme](https://cdn.swisslearninghub.com/xml/trc/v1.0/report.xsd) can be used to create the report file.

#### Element **report**
Is the root element of the report XML

#### Element **organization**
This element refers to a chapter in the learning object.

Attribute:

* id = unique ID of the chapter (e.g.: chapter_000_010_150)
* name = Name of the chapter (e.g.: Schweizer Quiz)

No hierarchical chapter structures can be mapped. The chapters must be reduced to one level.

*Example:*

* Chapter 1
    * Chapter 1-1
    * Chapter 1-2
* Chapter 2
    * Chapter 2-1

*report.xml*
```xml
<organization name="Chapter 1">
    <item name="Page A" />
</organization>
<organization name="Chapter 1-1">
    <item name="Page B" />
</organization>
<organization name="Chapter 1-2">
    <item name="Page C" />
</organization>
<organization name="Chapter 2">
    <item name="Page D" />
</organization>
<organization name="Chapter 2-1">
    <item name="Page E" />
</organization>
```

#### Element **item**
This element refers to a learning object page within a chapter.

Attribute:

* id = unique ID of the learning object page (e.g.: item_000_010_010_de)
* name = Page title (z.B.: Testbeginn / Sprachen / Hauptstadt)
* type = Type of learning object page (e.g.: dynamicFrames / multipleChoice / testInteraction, dynamicFrames)

#### Element **question**
This element refers to a question within a learning object (*item*).

Attribute:

* name = Question text (e.g.: Zu welchem Kontinent gehört die Schweiz? Wählen Sie die korrekte Antwort.)
* type = Question type (e.g.: multipleChoice / matchingDragAndDrop / matching / matrix)
* maxScore = Maximum number of points for this question (for example: 1)

#### Element **answer**
This element refers to an answer option of a question.

Attribute:

* id = unique ID of the answer choice (e.g.:  A / 1.A / usw.)
* name = Description of the answer choice (e.g.: Afrika / Tennisspieler / Schweiz / Nicht Schweiz / usw.)
* correct = Indicates whether the answer choice is correct or not (e.g.: true / false)

## SCORM keys
The learning object must send data to the following SCORM keys according to [SCORM 1.2](https://adlnet.gov/projects/scorm/) (Specification SCORM 1.2 RunTimeEnv).

* cmi.objectives.n.id
* cmi.objectives.n.score.raw
* cmi.objectives.n.score.min
* cmi.objectives.n.score.max
* cmi.objectives.n.status
* cmi.interactions.n.id
* cmi.interactions.n.objectives.n.id
* cmi.interactions.n.objectives.n.type
* cmi.interactions.n.objectives.n.time
* cmi.interactions.n.correct_responses.n.pattern
* cmi.interactions.n.weighting
* cmi.interactions.n.student_response
* cmi.interactions.n.result
* cmi.interactions.n.latency

## Mapping SCORM keys and the report XML
The SCORM key **cmi.interactions.n.id** (value e.g.: item_000_010_020_en) can be used to determine which question is involved in the report XML. All further SCORM keys for this interaction can be read out using the index (n). The same logic is used for the SCORM keys **cmi.objectives.n.x**. The index (n) for cmi.objectives.n.x and cmi.interactions.n.x does not necessarily have to have the same value per learning object page, nor is the order of the indexes necessarily the same as the page order of the learning object.  

*Example (report.xml)*
```xml
<item id="item_000_010_020_de" name="Geographie" type="multipleChoice">
    <question name="Zu welchem Kontinent gehört die Schweiz? Wählen Sie die korrekte Antwort." type="multipleChoice" maxScore="1">
        <answer id="A" name="Afrika" correct="false"/>
        <answer id="B" name="Amerika" correct="false"/>
        <answer id="C" name="Asien" correct="false"/>
        <answer id="D" name="Europa" correct="true"/>
    </question>
</item>
```
The SCORM key **cmi.interactions.n.student_response** (value e.g.: D) can be used to read out which response option the learner has selected.

*Example (report.xml)*
```xml
<question name="Zu welchem Kontinent gehört die Schweiz? Wählen Sie die korrekte Antwort." type="multipleChoice" maxScore="1">
    <answer id="A" name="Afrika" correct="false"/>
    <answer id="B" name="Amerika" correct="false"/>
    <answer id="C" name="Asien" correct="false"/>
    <answer id="D" name="Europa" correct="true"/>
</question>
```
The SCORM key **cmi.objectives.n.score.raw** (value e.g.: 1) can be used to determine how many points the learner has achieved in this question. The SCORM key **cmi.interactions.n.result** (value: correct / incorrect) shows whether the learner has solved the question completely correctly.

## Example

### XML
File name: report.xml
XML scheme: https://cdn.swisslearninghub.com/xml/trc/v1.0/report.xsd
```xml
<?xml version="1.0" encoding="utf-8"?>
<report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://cdn.crealogix.com/xml/trc/v1.0/report"
        xsi:schemaLocation="http://cdn.crealogix.com/xml/trc/v1.0/report http://cdn.crealogix.com/xml/trc/v1.0/report.xsd">
    <organization id="chapter_1" name="Kapitel 1">
        <item id="page_A" name="Seite A" type="dynamicFrames" />
    </organization>
    <organization id="chapter_1_1" name="Kapitel 1-1">
        <item id="question_1" name="Geographie" type="multipleChoice">
            <question name="Zu welchem Kontinent gehört die Schweiz? Wählen Sie die korrekte Antwort." type="singleChoice" maxScore="1">
                <answer id="A" name="Afrika" correct="false"/>
                <answer id="B" name="Amerika" correct="false"/>
                <answer id="C" name="Asien" correct="false"/>
                <answer id="D" name="Europa" correct="true"/>
            </question>
        </item>
    </organization>
    <organization id="chapter_1_2" name="Kapitel 1-2">
        <item id="question_2" name="Geographie" type="multipleChoice">
            <question name="Welcher Kontinent liegt ganz auf der Südhalbkugel? Wählen Sie die korrekten Antworten." type="multipleChoice" maxScore="1">
                <answer id="A" name="Afrika" correct="false"/>
                <answer id="B" name="Australien" correct="true"/>
                <answer id="C" name="Asien" correct="false"/>
                <answer id="D" name="Europa" correct="false"/>
                <answer id="E" name="Antarktika" correct="true"/>
            </question>
        </item>
    </organization>
    <organization id="chapter_2" name="Kapitel 2">
        <item id="page_B" name="Seite B" type="dynamicFrames" />
    </organization>
    <organization id="chapter_2_1" name="Kapitel 2-1">
        <item id="question_2" name="Geographie" type="multipleChoice">
            <question name="Welcher Kontinent liegt ganz auf der Nordhalbkugel, ganz auf der Südhalbkugel oder auf beiden? Wählen Sie die korrekten Antworten." type="matrix" maxScore="1">
                <answer id="1.A" name="Afrika / Nordhalbkugel" correct="false"/>
                <answer id="1.B" name="Afrika / Südhalbkugel" correct="false"/>
                <answer id="1.C" name="Afrika / auf beiden" correct="true"/>
                <answer id="2.A" name="Europa / Nordhalbkugel" correct="true"/>
                <answer id="2.B" name="Europa / Südhalbkugel" correct="false"/>
                <answer id="2.C" name="Europa / auf beiden" correct="false"/>
            </question>
        </item>
    </organization>
</report>
```