# Format overview

Below is a simple guide to the basic structure of a typical IMS Enterprise data file. Much more information is available on the IMS Enterprise official website.

You may like to read the conformance summary which describes which IMS data elements this plugin can process.

# Basic guide to IMS Enterprise file format

For any IMS-style enrolment you need a <group> tag which specifies the course, a <person> tag which specifies the user account, and a <membership> tag containing <member> tags which specify a person's role within a given course.

Remember that the numeric keys used in the Moodle databases are not the interoperable data - a student data system is never going to know in advance that Joe is the 20th user added to the Moodle database - so those aren't the keys exchanged in this type of data.

Typically a course would have a reference code as well as a name, so let's assume its code is MOODLE101. To define your course you could use

<group>
<sourcedid>
<source>MyDataSystem</source>
<id>MOODLE101</id>
</sourcedid>
<description>
<short>Moodle 101</short>
</description>
</group>

The enrolment script will look for a course with code MOODLE101, and (optionally) create it if it doesn't exist. Similarly for the person - let's assume it's "jmoodle":

<person>
<sourcedid>
<source>MyDataSystem</source>
<id>jmoodle</id>
</sourcedid>
<userid>jmoodle</userid>
<name>
<fn>Joe Moodle</fn>
<n>
<family>MOODLE</family>
<given>JOE</given>
</n>
</name>
</person>

If Joe doesn't already have an account, the script can (optionally) create an account for him.

Let's now look at the membership, adding the person to the course:

<membership>
<sourcedid>
<source>MyDataSystem</source>
<id>MOODLE101</id>
</sourcedid>
<member>
<sourcedid>
<source>MyDataSystem</source>
<id>jmoodle</id>
</sourcedid>
<role roletype="01">
<status>1</status>
<extension><cohort>unit 2</cohort></extension>
</role>
</member>
</membership>

The IMS Enterprise specification does offer a facility for specifying start/end dates for enrolments, so those can be included using the <timeframe> tag if needed.

If a person is already added to a group within the course, the script won't actually modify that. If they are not grouped, however, then the specified grouping will be applied.