Data Hub Basic

6 Importing Course Information

The Course tab is where you can set the import parameters for course information.

We can set the name of the csv file, as well as the file type (though currently only csv is supported). The file name entered here is the file name that Data Hub will process from the 'Import file location'.

Data Hub Basic course tab picture 1

The course properties mapping table enables you to map the names of course properties from your export file to properties in DH. Any of these parameters can be set or updated via the DH import file.

Data Hub Basic course tab picture 2

If you make changes to the property values, be sure to save your changes with one of the save buttons on the bottom of the screen.

The properties that can be set via the course csv file are listed below with brief descriptions:

category: The course category, e.g., miscellaneous.

format: The course format, e.g., topics or weeks.

fullname: The fullname of the course.

guest: Enter yes or no for guest access to the course.

idnumber: The course id number.

lang: Set the course language. Enter the language as it is shown in the Moodle course, e.g., English (en_us). Currently the site default will be used for this setting, not the value entered in the file for this field.

maxbytes: The maximum upload size for files in the course. Currently the site default will be used for this setting, not the value entered in the file for this field.
metacourse: Enter yes or no.

newsitems: Enter how many news items will be shown, 0-10.

notifystudents: Enter yes or no.

numsections: The number of topics or weeks. If this optional field is used in the csv file, a value must be put in for each course.

password: Enter password if one is used.

shortname: The course shortname.

showgrades: Enter yes or no.

showreports: Enter yes or no.

sortorder: Enter the order of the courses, e.g., if there are five courses assigned a value between 1 and 5, the course with value 1 will be the first course in the list. Currently the sort order doesn't work in sub-categories.

startdate: Enter the start date, e.g., 09/05/2010.

summary: Enter the summary.

timecreated: Time created.

visible: Enter yes or no in the visible column to set the course visibility or availability.

link: Enter the shortname of the template course in the link column of the csv file, if a template course is being used. The next page has more information about creating courses using templates.

action: The actions for courses are create, delete, or update.

The required fields for courses are:
  1. category
  2. fullname
  3. shortname
  4. execute/action
Additionally, you need to specify the topic (format) and number of sections (numsections) for the course(s).

Data Hub Actions

DH tells Moodle what needs to be done with imported data via the Actions column. The following actions can be performed for courses:
  1. create - create a course
  2. delete - delete a course
  3. update - update a course.
In the following example row 2 is updating a course. Rows 3 and 4 are creating courses using the course from row 2 as the template. Row 4 is deleting a course.

In the Category column, /, designates a sub-category. For example, in row 3, Test 2863 is a sub-category of Spacely Sprockets

Data Hub Basic course file

When deleting courses all 4 of the required fields must be included. Line 5 of the in the image is deleting a course.

Select this link to download the file shown in the image above. Note that the courses in rows 2 and 5 were added to the site before the file was processed.


Courses can be added to sub-categories and sub-categories can be automatically created via Data Hub Basic.
  • The default column header for this entry is "category". This is configurable in the Course property map.
  • The category and sub-category names are separated by a / in the csv file. For example, if your adding a course to the Spring 2011 category and the Math sub-category, enter "Spring 2011/Math".
  • Sub-categories in the file that don't exist on the site will be automatically created by the file. For example, if the file entry is "Spring 2011/Science", then the Science sub-category will be created if it hasn't been already.
Example file creating a course with sub-categories

Course CSV file FAQ:

  • Does the .csv file have to contain all headers/columns?
    No, just the required headers and the headers for data you want to change.

  • If we leave a field blank, does it override current data or ignore it?
    Blank fields in non-required columns are ignored.

  • Can we use the course ID number for the course template feature or does it have to be the short name?
    The template course's shortname is what is used for identifying the template course.

  • Can we include assigning the teacher to that role in the course to this file, or does it have to be a separate file?
    All role assignments are done via the enrol.csv file, and not by the course.csv file.
  • Can we create courses that are not enroll-able?
    Currently there isn't a method to set courses as not-enroll-able via Data Hub - instead you can create courses and set them to invisible, then run an update and make them visible.

Importing/Processing Data Hub Files

The 'Import file location', specified in the Data Hub block settings, is where the files should be uploaded for processing by Data Hub. To complete the import process for the example above I will follow these steps:
  1. Name the CSV file, for this example it's named 'course.csv'. Make sure the file name shown on the Course tab screen is the same, course.csv.
  2. Load the file to the 'Import file location'. The files are automatically processed every 24 hours.
  3. To process the file immediately, select the Save and Process button from the bottom of the screen on the Course tab.
A complete log of all actions is kept in the logs file, as well as (optionally) emailed to an address or addresses each time the DH script runs. The log file location is shown on the settings screen for the Data Hub block.