zizia 4.2.0.alpha.01 → 4.3.1.alpha.01
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/config/usage.yml +1 -0
- data/app/controllers/zizia/metadata_details_controller.rb +1 -1
- data/app/models/zizia/csv_import.rb +1 -1
- data/app/models/zizia/csv_import_detail.rb +1 -1
- data/app/models/zizia/pre_ingest_file.rb +1 -1
- data/app/models/zizia/pre_ingest_work.rb +1 -1
- data/app/views/zizia/csv_imports/_record_count.html.erb +0 -1
- data/lib/zizia.rb +1 -0
- data/lib/zizia/hyrax/based_near_attributes.rb +49 -0
- data/lib/zizia/hyrax/hyrax_record_importer.rb +2 -39
- data/lib/zizia/version.rb +1 -1
- data/spec/dummy/config/initializers/hyrax.rb +1 -1
- metadata +3 -4
- data/app/controllers/zizia/application_controller.rb +0 -6
- data/app/models/zizia/application_record.rb +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f7738ad4f5ddf617123e02b0c30426c937b8a6e1a9ac343cdc1f526db6022977
|
|
4
|
+
data.tar.gz: 11ef2ee8fd0f01df8a430847383a3f1aff3d2c5c026d30fab2892a00d183bad6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a83df339c9be7d6aba456040d7c9be5cc260a825f0c46ff0a5daffdef9b1f57046289da88cadaae9c89ce01b6cfc46b099fd138740f32f4d794a0aef228f420
|
|
7
|
+
data.tar.gz: 69269d92ffc9743b271e53b5d9886b1408c125b0d6d5fdbb0650032c563644dfffdfe7225295c8c7fc47cd6e06ed4070af4b1f3954f79c9fa9224db5f810afda
|
data/app/config/usage.yml
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
arkivo_checksum: "-- system field - not directly editable --"
|
|
6
6
|
based_near: " A location that something is based near, for some broadly human notion of near."
|
|
7
7
|
contributor: "Identifies contributors to the material; can be used very broadly if exact contributions aren't known"
|
|
8
|
+
create_date: "-- system field - not directly editable --"
|
|
8
9
|
creator: "Identifies the primary Creator(s) of the material"
|
|
9
10
|
date_created: "The date the material was created"
|
|
10
11
|
date_modified: "-- system field - not directly editable --"
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<div class="col-md-8">
|
|
3
3
|
<div class="alert alert-success">
|
|
4
4
|
<p> This import will create or update <%= @csv_import.manifest_records %> records. </p>
|
|
5
|
-
<p> If you only want to import new records you will be able to choose that option after continuing. </p>
|
|
6
5
|
</div>
|
|
7
6
|
</div>
|
|
8
7
|
</div>
|
data/lib/zizia.rb
CHANGED
|
@@ -36,6 +36,7 @@ module Zizia
|
|
|
36
36
|
require 'zizia/metadata_mapper'
|
|
37
37
|
require 'zizia/hash_mapper'
|
|
38
38
|
require 'zizia/hyrax/hyrax_basic_metadata_mapper'
|
|
39
|
+
require 'zizia/hyrax/based_near_attributes'
|
|
39
40
|
require 'zizia/importer'
|
|
40
41
|
require 'zizia/record_importer'
|
|
41
42
|
require 'zizia/hyrax/hyrax_record_importer'
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Zizia
|
|
4
|
+
class BasedNearAttributes
|
|
5
|
+
attr_accessor :based_near
|
|
6
|
+
|
|
7
|
+
def initialize(based_near)
|
|
8
|
+
@based_near = based_near
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
##
|
|
12
|
+
# When submitting location data (a.k.a. the "based near" attribute) via the UI,
|
|
13
|
+
# Hyrax expects to receive a `based_near_attributes` hash in a specific format.
|
|
14
|
+
# We need to take geonames urls as provided by the customer and transform them to
|
|
15
|
+
# mimic what the Hyrax UI would ordinarily produce. These will get turned into
|
|
16
|
+
# Hyrax::ControlledVocabularies::Location objects upon ingest.
|
|
17
|
+
# The expected hash looks like this:
|
|
18
|
+
# "based_near_attributes"=>
|
|
19
|
+
# {
|
|
20
|
+
# "0"=> {
|
|
21
|
+
# "id"=>"http://sws.geonames.org/5667009/", "_destroy"=>""
|
|
22
|
+
# },
|
|
23
|
+
# "1"=> {
|
|
24
|
+
# "id"=>"http://sws.geonames.org/6252001/", "_destroy"=>""
|
|
25
|
+
# },
|
|
26
|
+
# }
|
|
27
|
+
# @return [Hash] a "based_near_attributes" hash as
|
|
28
|
+
def to_h
|
|
29
|
+
original_geonames_uris = based_near
|
|
30
|
+
return if original_geonames_uris.empty?
|
|
31
|
+
based_near_attributes = {}
|
|
32
|
+
original_geonames_uris.each_with_index do |uri, i|
|
|
33
|
+
based_near_attributes[i.to_s] = { 'id' => uri_to_sws(uri), "_destroy" => "" }
|
|
34
|
+
end
|
|
35
|
+
based_near_attributes
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
#
|
|
39
|
+
# Take a user-facing geonames URI and return an sws URI, of the form Hyrax expects
|
|
40
|
+
# (e.g., "http://sws.geonames.org/6252001/")
|
|
41
|
+
# @param [String] uri
|
|
42
|
+
# @return [String] an sws style geonames uri
|
|
43
|
+
def uri_to_sws(uri)
|
|
44
|
+
uri = URI(uri)
|
|
45
|
+
geonames_number = uri.path.split('/')[1]
|
|
46
|
+
"http://sws.geonames.org/#{geonames_number}/"
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -140,44 +140,6 @@ module Zizia
|
|
|
140
140
|
filepath
|
|
141
141
|
end
|
|
142
142
|
|
|
143
|
-
##
|
|
144
|
-
# When submitting location data (a.k.a. the "based near" attribute) via the UI,
|
|
145
|
-
# Hyrax expects to receive a `based_near_attributes` hash in a specific format.
|
|
146
|
-
# We need to take geonames urls as provided by the customer and transform them to
|
|
147
|
-
# mimic what the Hyrax UI would ordinarily produce. These will get turned into
|
|
148
|
-
# Hyrax::ControlledVocabularies::Location objects upon ingest.
|
|
149
|
-
# The expected hash looks like this:
|
|
150
|
-
# "based_near_attributes"=>
|
|
151
|
-
# {
|
|
152
|
-
# "0"=> {
|
|
153
|
-
# "id"=>"http://sws.geonames.org/5667009/", "_destroy"=>""
|
|
154
|
-
# },
|
|
155
|
-
# "1"=> {
|
|
156
|
-
# "id"=>"http://sws.geonames.org/6252001/", "_destroy"=>""
|
|
157
|
-
# },
|
|
158
|
-
# }
|
|
159
|
-
# @return [Hash] a "based_near_attributes" hash as
|
|
160
|
-
def based_near_attributes(based_near)
|
|
161
|
-
original_geonames_uris = based_near
|
|
162
|
-
return if original_geonames_uris.empty?
|
|
163
|
-
based_near_attributes = {}
|
|
164
|
-
original_geonames_uris.each_with_index do |uri, i|
|
|
165
|
-
based_near_attributes[i.to_s] = { 'id' => uri_to_sws(uri), "_destroy" => "" }
|
|
166
|
-
end
|
|
167
|
-
based_near_attributes
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
#
|
|
171
|
-
# Take a user-facing geonames URI and return an sws URI, of the form Hyrax expects
|
|
172
|
-
# (e.g., "http://sws.geonames.org/6252001/")
|
|
173
|
-
# @param [String] uri
|
|
174
|
-
# @return [String] an sws style geonames uri
|
|
175
|
-
def uri_to_sws(uri)
|
|
176
|
-
uri = URI(uri)
|
|
177
|
-
geonames_number = uri.path.split('/')[1]
|
|
178
|
-
"http://sws.geonames.org/#{geonames_number}/"
|
|
179
|
-
end
|
|
180
|
-
|
|
181
143
|
private
|
|
182
144
|
|
|
183
145
|
# Update an existing object using the Hyrax actor stack
|
|
@@ -218,7 +180,8 @@ module Zizia
|
|
|
218
180
|
# since this is reserved for Hyrax and is where uploaded_files will be attached
|
|
219
181
|
attrs.delete(:files)
|
|
220
182
|
based_near = attrs.delete(:based_near)
|
|
221
|
-
attrs.merge(based_near_attributes:
|
|
183
|
+
attrs = attrs.merge(based_near_attributes: Zizia::BasedNearAttributes.new(based_near).to_h) unless based_near.nil? || based_near.empty?
|
|
184
|
+
attrs
|
|
222
185
|
end
|
|
223
186
|
|
|
224
187
|
# Create an object using the Hyrax actor stack
|
data/lib/zizia/version.rb
CHANGED
|
@@ -105,7 +105,7 @@ Hyrax.config do |config|
|
|
|
105
105
|
|
|
106
106
|
# Location autocomplete uses geonames to search for named regions
|
|
107
107
|
# Username for connecting to geonames
|
|
108
|
-
|
|
108
|
+
config.geonames_username = ENV['GEONAMES_USERNAME']
|
|
109
109
|
|
|
110
110
|
# Should the acceptance of the licence agreement be active (checkbox), or
|
|
111
111
|
# implied when the save button is pressed? Set to true for active
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zizia
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.3.1.alpha.01
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Data Curation Experts
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-10-
|
|
11
|
+
date: 2019-10-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: active-fedora
|
|
@@ -644,7 +644,6 @@ files:
|
|
|
644
644
|
- app/assets/stylesheets/zizia/application.css
|
|
645
645
|
- app/assets/stylesheets/zizia/zizia.scss
|
|
646
646
|
- app/config/usage.yml
|
|
647
|
-
- app/controllers/zizia/application_controller.rb
|
|
648
647
|
- app/controllers/zizia/csv_imports_controller.rb
|
|
649
648
|
- app/controllers/zizia/metadata_details_controller.rb
|
|
650
649
|
- app/helpers/zizia/application_helper.rb
|
|
@@ -655,7 +654,6 @@ files:
|
|
|
655
654
|
- app/lib/zizia/metadata_details.rb
|
|
656
655
|
- app/lib/zizia/metadata_usage.rb
|
|
657
656
|
- app/lib/zizia/work_attributes.rb
|
|
658
|
-
- app/models/zizia/application_record.rb
|
|
659
657
|
- app/models/zizia/csv_import.rb
|
|
660
658
|
- app/models/zizia/csv_import_detail.rb
|
|
661
659
|
- app/models/zizia/pre_ingest_file.rb
|
|
@@ -704,6 +702,7 @@ files:
|
|
|
704
702
|
- lib/zizia/csv_template.rb
|
|
705
703
|
- lib/zizia/engine.rb
|
|
706
704
|
- lib/zizia/hash_mapper.rb
|
|
705
|
+
- lib/zizia/hyrax/based_near_attributes.rb
|
|
707
706
|
- lib/zizia/hyrax/hyrax_basic_metadata_mapper.rb
|
|
708
707
|
- lib/zizia/hyrax/hyrax_default_updater.rb
|
|
709
708
|
- lib/zizia/hyrax/hyrax_delete_files_updater.rb
|