-
Notifications
You must be signed in to change notification settings - Fork 2
Import image data
Paul Walk edited this page Aug 1, 2019
·
10 revisions
- Clone the nims-ngdr repo
- Copy the Imeji xml metadata to /srv/ngdr/data/imeji
- make sure you can access the imeji files. For example:
http://imeji.nims.go.jp/imeji/file/DEIKQkLx77W3Jrlc/39/a9/d8/4d-1841-4c4f-8173-c4dd5474ff24/0/original/6675a2ce75602de2a727198f4a3556e6.bmp
http://imeji.nims.go.jp/imeji/file/8/b0/5a/ac/b0-72da-4a56-833a-15c403f1d344/0/original/b08e0dbe1c3e8dc7bdcdc8ca88623a1f.mp4
If you cannot access them, you need to request access - /srv/ngdr/data is mounted into docker at /data/data
- SSH into docker
docker exec -it nims-hyrax_git_web_1 /bin/bash
- Start the rails console
bundle exec rails c
- Run the importer
- Define the metadata file and require the importer.
# The files are listed here in order of size. # The first 2 files are not that big xml_files = [ '/data/data/imeji/data_export_col_DEIKQkLx77W3Jrlc.xml', '/data/data/imeji/data_export_col_8.xml', '/data/data/imeji/data_export_col_sdZWq3eqN1ivoU60.xml', '/data/data/imeji/data_export_col_PK_GJp0wrrycetcj.xml' ] require 'importers/image_importer/collections' require 'importers/image_importer/parse_xml' require 'importers/image_importer/importer' require 'importers/hyrax_importer' # To import the first of the metadata files metadata_file = xml_files[0]
- To run the import in debug mode
This will produce a log file with the attributes and files. The log file can be found in /srv/ngdr/data/ and is timestamped.
The images are not imported into Hyrax
debug = true p = Importers::ImageImporter::Importer.new(metadata_file, debug) p.perform_create
- To import the images
This produces a log file with the attributes, files and errors, if any. The log file can be found in /srv/ngdr/data/ and is timestamped.
The images are imported into Hyraxdebug = false p = Importers::ImageImporter::Importer.new(metadata_file, debug) p.perform_create
- Define the metadata file and require the importer.