cocina-models 0.108.1 → 0.108.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4afcd46738fc91195733dc87097c0d582865df04246de6a92e8c11e7a813c6a
4
- data.tar.gz: cd3301f2e60b80e0ca63ab8c2ae4ae36744e2b2ca1113466d44ca6dc59750130
3
+ metadata.gz: 4ac0ee1d7ed8ae53486e4b711aa05db3d73b2390a8083f9f1597f111ebbe3c9c
4
+ data.tar.gz: 33583ad6d49089fba2434b8924302cf9c3f4ee18150100e56db61d2bc36e3972
5
5
  SHA512:
6
- metadata.gz: d2fee0029492cef4d925ae6d9e715a20d9e61b69cc2af48c1977e1ed5d74c548d0e8f49a014d4bb8d6cc047042438d83224ef9e43b4471b9199006b2b2a23c93
7
- data.tar.gz: a758819e0df55773429f54d381243d831d511f45f156dd566fe1ff9d150a28bf2e095f029dd51175ccf2aaea90653bedad1e9f5b91e67d9838b7f07efbf8c4c7
6
+ metadata.gz: f57738f86a52485a98f8a6f6793a026a2a5e38d42e4cfd4c444891a3d1d115331e93d3e839d9e406550f07cd78db405111c91cb9701e5bc85b24eefb9cb7c8cd
7
+ data.tar.gz: 12de4f311c73204458f59af08db308bf83c7949b72378a3c4a044590c943a494db19a98f072e4691946dbd44ae1e0ba58174ae8fdcae1745ae688d0b9447022c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocina-models (0.108.1)
4
+ cocina-models (0.108.3)
5
5
  activesupport
6
6
  deprecation
7
7
  dry-struct (~> 1.0)
@@ -19,7 +19,7 @@ PATH
19
19
  GEM
20
20
  remote: https://rubygems.org/
21
21
  specs:
22
- activesupport (8.1.0)
22
+ activesupport (8.1.1)
23
23
  base64
24
24
  bigdecimal
25
25
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -42,7 +42,7 @@ GEM
42
42
  rack (>= 1.5)
43
43
  concurrent-ruby (1.3.5)
44
44
  connection_pool (2.5.4)
45
- date (3.4.1)
45
+ date (3.5.0)
46
46
  debug (1.11.0)
47
47
  irb (~> 1.10)
48
48
  reline (>= 0.3.8)
@@ -77,16 +77,16 @@ GEM
77
77
  activesupport (>= 3.0, < 9.0)
78
78
  equivalent-xml (0.6.0)
79
79
  nokogiri (>= 1.4.3)
80
- erb (5.1.1)
80
+ erb (6.0.0)
81
81
  i18n (1.14.7)
82
82
  concurrent-ruby (~> 1.0)
83
83
  ice_nine (0.11.2)
84
84
  io-console (0.8.1)
85
- irb (1.15.2)
85
+ irb (1.15.3)
86
86
  pp (>= 0.6.0)
87
87
  rdoc (>= 4.0.0)
88
88
  reline (>= 0.4.2)
89
- json (2.15.2)
89
+ json (2.16.0)
90
90
  json_schema (0.21.0)
91
91
  jsonpath (1.1.5)
92
92
  multi_json
@@ -94,7 +94,7 @@ GEM
94
94
  lint_roller (1.1.0)
95
95
  logger (1.7.0)
96
96
  mini_portile2 (2.8.9)
97
- minitest (5.26.0)
97
+ minitest (5.26.1)
98
98
  multi_json (1.17.0)
99
99
  nokogiri (1.18.10)
100
100
  mini_portile2 (~> 2.8.2)
@@ -115,15 +115,15 @@ GEM
115
115
  date
116
116
  stringio
117
117
  racc (1.8.1)
118
- rack (3.2.3)
118
+ rack (3.2.4)
119
119
  rainbow (3.1.1)
120
- rake (13.3.0)
121
- rdoc (6.15.0)
120
+ rake (13.3.1)
121
+ rdoc (6.15.1)
122
122
  erb
123
123
  psych (>= 4.0.0)
124
124
  tsort
125
125
  regexp_parser (2.11.3)
126
- reline (0.6.2)
126
+ reline (0.6.3)
127
127
  io-console (~> 0.5)
128
128
  rspec (3.13.2)
129
129
  rspec-core (~> 3.13.0)
@@ -134,13 +134,13 @@ GEM
134
134
  rspec-expectations (3.13.5)
135
135
  diff-lcs (>= 1.2.0, < 2.0)
136
136
  rspec-support (~> 3.13.0)
137
- rspec-mocks (3.13.6)
137
+ rspec-mocks (3.13.7)
138
138
  diff-lcs (>= 1.2.0, < 2.0)
139
139
  rspec-support (~> 3.13.0)
140
140
  rspec-support (3.13.6)
141
141
  rspec_junit_formatter (0.6.0)
142
142
  rspec-core (>= 2, < 4, != 2.12.0)
143
- rubocop (1.81.6)
143
+ rubocop (1.81.7)
144
144
  json (~> 2.3)
145
145
  language_server-protocol (~> 3.17.0.2)
146
146
  lint_roller (~> 1.1.0)
@@ -151,15 +151,15 @@ GEM
151
151
  rubocop-ast (>= 1.47.1, < 2.0)
152
152
  ruby-progressbar (~> 1.7)
153
153
  unicode-display_width (>= 2.4.0, < 4.0)
154
- rubocop-ast (1.47.1)
154
+ rubocop-ast (1.48.0)
155
155
  parser (>= 3.3.7.2)
156
156
  prism (~> 1.4)
157
157
  rubocop-rake (0.7.1)
158
158
  lint_roller (~> 1.1)
159
159
  rubocop (>= 1.72.1)
160
- rubocop-rspec (3.7.0)
160
+ rubocop-rspec (3.8.0)
161
161
  lint_roller (~> 1.1)
162
- rubocop (~> 1.72, >= 1.72.1)
162
+ rubocop (~> 1.81)
163
163
  ruby-progressbar (1.13.0)
164
164
  securerandom (0.4.1)
165
165
  simplecov (0.22.0)
@@ -168,7 +168,7 @@ GEM
168
168
  simplecov_json_formatter (~> 0.1)
169
169
  simplecov-html (0.13.2)
170
170
  simplecov_json_formatter (0.1.4)
171
- stringio (3.1.7)
171
+ stringio (3.1.8)
172
172
  super_diff (0.17.0)
173
173
  attr_extras (>= 6.2.4)
174
174
  diff-lcs
@@ -180,7 +180,7 @@ GEM
180
180
  unicode-display_width (3.2.0)
181
181
  unicode-emoji (~> 4.1)
182
182
  unicode-emoji (4.1.0)
183
- uri (1.0.4)
183
+ uri (1.1.1)
184
184
  zeitwerk (2.7.3)
185
185
 
186
186
  PLATFORMS
@@ -29,6 +29,7 @@ module Cocina
29
29
  add_types(forms)
30
30
  add_physical_descriptions(forms)
31
31
  add_subject_cartographics(forms)
32
+ add_etd_resource_type(forms)
32
33
  Primary.adjust(forms, 'genre', notifier, match_type: true)
33
34
  Primary.adjust(forms, 'resource type', notifier, match_type: true)
34
35
  end
@@ -187,6 +188,28 @@ module Cocina
187
188
  end
188
189
  end
189
190
 
191
+ def add_etd_resource_type(forms)
192
+ thesis_node = resource_element.xpath('mods:note[@type="thesis"]', mods: Description::DESC_METADATA_NS).first
193
+ return unless thesis_node
194
+
195
+ doi_node = resource_element.xpath('mods:identifier[@type="doi"]', mods: Description::DESC_METADATA_NS).first
196
+ return unless doi_node
197
+
198
+ forms.push({
199
+ source: {
200
+ value: 'DataCite resource types'
201
+ },
202
+ type: 'resource type',
203
+ value: 'Dissertation'
204
+ }, {
205
+ source: {
206
+ value: 'Stanford self-deposit resource types'
207
+ },
208
+ type: 'resource type',
209
+ structuredValue: [{ type: 'subtype', value: 'Academic thesis' }]
210
+ })
211
+ end
212
+
190
213
  def manuscript_form
191
214
  {
192
215
  value: 'manuscript',
@@ -6,6 +6,8 @@ module Cocina
6
6
  module FromMods
7
7
  # Builds cocina identifier
8
8
  class IdentifierBuilder
9
+ ORCID_PREFIX = 'https://orcid.org/'
10
+
9
11
  # @param [Nokogiri::XML::Element] identifier_element identifier element
10
12
  # @return [Hash] a hash that can be mapped to a cocina model
11
13
  def self.build_from_identifier(identifier_element:)
@@ -40,7 +42,7 @@ module Cocina
40
42
  attrs[:uri] = identifier_element.text
41
43
  else
42
44
  attrs[:type] = cocina_type
43
- attrs[:value] = identifier_element.text
45
+ attrs[:value] = value
44
46
  attrs[:source] = build_source
45
47
  end
46
48
  attrs[:status] = 'invalid' if identifier_element['invalid'] == 'yes'
@@ -54,16 +56,29 @@ module Cocina
54
56
  def types_for(type)
55
57
  return ['uri', 'uri', IdentifierType::STANDARD_IDENTIFIER_SCHEMES] if type == 'uri'
56
58
 
59
+ type = 'orcid' if orcid?
60
+
57
61
  IdentifierType.cocina_type_for_mods_type(type)
58
62
  end
59
63
 
64
+ def value
65
+ value = identifier_element.text
66
+ return value.delete_prefix(ORCID_PREFIX) if orcid?
67
+
68
+ value
69
+ end
70
+
60
71
  def build_source
61
72
  {
62
- uri: identifier_element['typeURI']
73
+ uri: orcid? ? 'https://orcid.org' : identifier_element['typeURI']
63
74
  }.tap do |props|
64
75
  props[:code] = mods_type unless props[:uri]
65
76
  end.compact.presence
66
77
  end
78
+
79
+ def orcid?
80
+ identifier_element.text.starts_with?(ORCID_PREFIX)
81
+ end
67
82
  end
68
83
  end
69
84
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- VERSION = '0.108.1'
5
+ VERSION = '0.108.3'
6
6
  end
7
7
  end