Skip to content

Importing institutions and training

Yannick Warnier edited this page Jan 28, 2022 · 1 revision

In order to speed up the initial setup of a fully usable system, we have developed an import mechanism based on a JSON file.

File filling and importing process

Locate the src/DataFixtures/JSON/sample_import.json.dist file and make a copy under sample_import.json, in the same directory.

Open the file for editing. You will find two sections (documented below): institution and training. Fill the institution section first. You will need the email field to reference them from the training section.

There are two records in each section in the template file: a "very empty" record, and a "very complete" record. These are examples to help you understand the format.

Repeat each institution or training block as many times as you want.

Once the file is filled, go back to the root of you SILKC platform installation, on the command line, and launch:

php bin/console doctrine:fixtures:load --group=InstitutionImportFixtures --append --env dev
php bin/console doctrine:fixtures:load --group=TrainingImportFixtures --append --env dev

Errors

The import process will stop on errors and try to tell you what's wrong (usually one of the fields has data that doesn't match the database table format). Once you've fixed what's wrong, you can resume the insertion by just repeating the command.

JSON format description

Institution

The institution array offers institution records like the following:

    {
      "username": "Mon organisme 2",
      "email": "[email protected]",
      "homepage": "https://www.monhomepage.com",
      "dateOfBirth": "2010-09-01 10:05",
      "address": "rue de la Paix 75000 Paris"
    }
Field name Field type Description Possible values
username string The name of the institution "string"
email email A unique e-mail address for the whole system. This will also be the common identifier that matches one training to an institution "string"
homepage URL The main URL of the institution "string" or null
dateOfBirth date If you know it, the foundation date of the institution "yyyy-mm-dd HH:ii" or null
address string At a minimum, the city and country, or a more detailed address if you have it "address" or null

Training

The training array offers training records like the following:

    {
      "institution_email": "[email protected]",
      "occupation_concept_uri": "http://data.europa.eu/esco/occupation/0b1d8dcb-d941-4d79-99bf-fc10c1806c43",
      "name": "Ma formation AZERTY",
      "location": "4 rue Saint-Martin 75003 PARIS",
      "longitude": "-1.6673405659541642",
      "latitude": "48.109606538309016",
      "duration_value": 10,
      "duration_unity": "hours",
      "duration_details": "Mondays and Tuesdays from 8 a.m. to 10 a.m.",
      "description": "Good formation",
      "price": "2000",
      "currency": "euro",
      "start_at": "2021-08-01 07:00:00",
      "end_at": "2021-08-08 07:00:00",
      "is_online": true,
      "is_online_monitored": true,
      "is_presential": true,
      "url": "https://www.maformationazerty.com"
    }
Field name Field type Description Possible values
institution_email email The unique institution e-mail defined in the institution import string
occupation_concept_uri URL The precise URL of an occupation from the ESCO framework at https://ec.europa.eu/esco/portal/occupation string
name string The title of the training
location string A string identifying a postal address "address" or "online" if only online
longitude coordinates The longitude for the address. This is usually calculated by OpenStreetMaps based on the location field when editing the training in the web interface, but it can be provided here too. "-44.23243553" or null
latitude coordinates The latitude for the address. This is usually calculated by OpenStreetMaps based on the location field when editing the training in the web interface, but it can be provided here too. "+14.23243553" or null
duration_value integer The number of hours, days, weeks or months for the duration of the training integer or null
duration_unity select box Can be either hours, days, weeks or months. These are units understood by the system to be able to compare different training durations hours, days, weeks or months
duration_details string A free description of the duration. If the duration is "2 weeks", maybe you want to specify a schedule here, like "Monday to Friday from 8:00 to 15:00" string or null
description string A free description of the training, explaining what it teaches, to whom, etc. If not provided, it is expected the URL will give all the required information. string or null
price float The full price of the training, in the currency specified in currency float or null if unknown
currency string The name of the currency for the price (currently euro or złoti) euro or złoti
start_at date The start date for this particular training session. Another session can be created later by duplicating this entry from the interface. "yyyy-mm-dd" or null
end_at date The end date for this training session. "yyyy-mm-dd" or null
is_online bool Whether this training is online or not true or false
is_online_monitored bool Whether this training is online and monitored by a tutor or not true or false
is_presential bool Whether this training is "in person" or not (usually, but not always, opposed to is_online) true or false
url string The URL for the description of the training "URL"