-
Notifications
You must be signed in to change notification settings - Fork 65
Import tool
This tool allows to import resources and organizations from a CSV file.
Change the admin/configuration.ini file to specify on which input columns should the IsbnOrIssn be deduped for the import tool:
[settings]
importISBNDedupingColumns="ISSN,EISSN,PrintISSN,OnlineISSN,Print ISSN,Online ISSN,ISBN,EISBN"
For a resource in the csv file, if there is a value in one of these column that match an existing isbnOrIssn, the resource won't be imported.
The first line of the CSV file must be column headers, not data.
Example:
titleText,resourceURL,ISSN,EISSN,organization,role,parentResource
Then, each line is a resource.
The user must choose the file to upload and the CSV separator (comma, semi-column or pipe).
The user must choose which columns of the CSV file are to be used for import. If a column header name matches a database column name, it will be automatically selected accordingly.
It's a report of:
- the number of resources processed
- the number of resources imported
- the number of parents imported
- the number of resources that have been attached to an existing parent
- the number of organizations created
- the number of resources that have been attached to an existing organization.
- Resources are only created. If a resource already exists in Coral, it will not be updated
- If an organization is specified for a given resource, the import tool will check if the organization already exists. If not, it will be created. In both cases, the resource will be attached to it.
- Organizations import works wheter the organization module is used or not.
- If multiple organizations with the same name exists in Coral, the import tool will not attach the resource, and a warning will be issued.
- A role can be specified.
- If a parent resource is specified for a given resource, the import tool will check if the parent resource already exists. If not, it will be created. In both cases, the resource will be attached to it.
Improvement: When a resource is imported, it is created if it doesn't already exist with the same parent. So a resource can be duplicated.
Import tool is common for all types of import (csv and GOKb for now).
To use it, you need to operate a pretreatment on your data to call ImportTool->addResource($datas, $identifiers).
-
$datas must be an array in which keys are resource attributes names and values are corresponding text, except for organizations, aliases, parent and resource type (see following section).
-
$identifiers must be an array in which keys are the identifier type (optionnal), if there is no key, identifiers will be treated as ISxN.
All resource object attributes can be considered as key in this array and values as the content of this attributes, except organization and aliases. example : $datas['titleText'] = "name of the resource";
Organizations and aliases treatement are pretty different: $datas['organization'] and $datas['alias'] are arrays:
This array has to be like that: 'role' => "org name"
example: $datas['organization'] = array [ 'provider' => "provider name" , 'platform' => "platform name"];
This array has to be like that: 'type of alias' => array ["name"]
example: $datas['alias'] = array [ 'alternateName' => array [ "alternate name 1" , "alternate name 2" ], 'nameChange' => array [ "old name 1" , "old name 2" ] ]
resource->parentResource doesn't exist as an attribute but, if there is a parent, you must add it in $datas like this : $datas['parentResource'] = "parent name";
Same as parent, resource->resourceType doesn't exist as an attribute but you must add it in $datas like this : $datas['resourceType'] = "type of the resource";