Migrate data to CollectionSpace from CSV.
2.9K
Migrate data into CollectionSpace from CSV files.
The converter tool is a Ruby on Rails application.
See .ruby-version for the recommended version of Ruby. The database backend is
MongoDB (v3.2).
Install Ruby and bundler then run:
bundle install
There is a default .env file that provides example configuration. Override it
by creating a .env.local file with custom settings.
# DEVELOPMENT .env
export CSPACE_CONVERTER_DB_HOST=127.0.0.1
export CSPACE_CONVERTER_BASE_URI=http://localhost:1980/cspace-services
export CSPACE_CONVERTER_DOMAIN=core.collectionspace.org
export CSPACE_CONVERTER_LOG_LEVEL=debug
export CSPACE_CONVERTER_MODULE=Core
export [email protected]
export CSPACE_CONVERTER_PASSWORD=Administrator
Before the cspace-converter tool can import CSV data into CollectionSpace, it first "stages" the data from the CSV files into a MongoDB database.
Create a data directory and add the CSV files. For example:
data/core/
├── cataloging.csv # custom CSV data file
└── ppsobjectsdata.csv # Past Perfect objects data file
Run Mongo using Docker:
docker run --name mongo -d -p 27017:27017 mongo:3.2
You should be able to access MongDB on http://localhost:27017.
If you prefer to run Mongo traditionally follow the installation docs online.
To match csv fields to existing CollectionSpace authority and vocabulary terms:
# clear things out if starting over
bundle exec rake db:nuke
bundle exec rake cache:download_vocabularies
bundle exec rake cache:download_authorities
The general format for the command is:
./import.sh [FILE] [BATCH] [PROFILE]
FILE: path to the import fileBATCH: import batch label (for future reference)PROFILE: profile key from config (config.yml registered_profiles)For example:
./import.sh data/core/cataloging_core_excerpt.csv cataloging1 cataloging
./import.sh data/core/mediahandling_core_all.csv media1 media
./bin/rails s
Once started, visit http://localhost:3000 with a web browser.
To execute "transfer" jobs created using the UI server, run this command:
./bin/rake jobs:work
Or from the command line:
./transfer.sh Person person1 # record type, batch name
# provides a list of records
bundle exec rake remote:get[media]
# get a record
bundle exec rake remote:get[/media/$CSID] # i.e.
bundle exec rake remote:get[/media/bd775076-05c8-4afd-8b58]
# ./bin/rails c
p = DataObject.first
puts p.inspect
bundle exec rake db:nuke
Or use 'Nuke' in the ui. Warning: this deletes all data, including failed jobs.
Note, MongoDB must be running:
bundle exec rspec
The converter can be easily deployed to Amazon Elastic Beanstalk (account required).
cp Dockerrun.aws-example.json Dockerrun.aws.json
Replace the INSERT_YOUR_VALUE_HERE values as needed. Note: for a production
environment the username and password should be for a temporary account used
only to perform the migration tasks. Delete this user from CollectionSpace when
the migration has been completed.
Follow the AWS documentation for deployment details:
Summary:
t2.small for instance type (everything else optional)The project is available as open source under the terms of the MIT License.
Content type
Image
Digest
Size
123.3 MB
Last updated
about 7 years ago
docker pull lyrasis/cspace-converter