uc3-dmp-id 0.1.13 → 0.1.14

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: d66a6f468a0f6d8db5ae871ca3981e7eb88e78a31dd4ee3c156532c9afd546fe
4
- data.tar.gz: 92b20512b11ab92808db115a40b8cf5a1e7c5369d890f591fc4745c73f93c3d7
3
+ metadata.gz: 7ae3b97965d06d3157328d0c23441eb32b63013b52d78f631cb8bd5a9459eebd
4
+ data.tar.gz: 4d731209d7649e2ed868d00cb7f69b061545edd75f36b73e7e0356aadae34a41
5
5
  SHA512:
6
- metadata.gz: 858aaabd9f1cf699257b076309851ea26a44a8262bddd0ad0c99956f2c872ba6a7a705c8edd45cadd45b64097caa8ad9a16b9caa896490e2a2f23622664a4986
7
- data.tar.gz: 37b83f9bd35d43285879c57d59af76b836ad49c5fc6708c81c34d04685db3238bac1f8e4a80abfbbdc992b7c67560341806c28f80bbfdb696646b4696da89a9d
6
+ metadata.gz: 236e174f59feb0b53bf812c7baf81eaa505e041e01fc9e5b5a689f402b746c9b53652aff506742a1210b9265e5341119d1e52d816e2fce99fac58e59132cf427
7
+ data.tar.gz: 3daabef6a600a9b490100b6a09db742c7e44e28368a9e936914371b34d25c8f2df996fbe3a19577cb64973c8f5a38a4c2d784563ceed4acd147779785277ee4b
@@ -36,17 +36,18 @@ module Uc3DmpId
36
36
  def add_modifications(works:)
37
37
  mod_hash = _generate_mod_header
38
38
 
39
- works.fetch('publications', []).each do |publication|
40
- # Skip the entry if we already know about this identifier
41
- next if @known_works.include?(publication['id'])
42
-
43
- work_hash = _work_to_mod_entry(type: 'publication', work: publication)
44
- mod_hash.fetch('dmproadmap_related_identifiers', []) << work_hash unless work_hash.nil?
45
- fundings = publication.fetch('fundingReferences', [])
46
- next unless fundings.any?
47
-
48
- award_hash = fundings.map { |funding| _funding_to_mod_entry(work: publication, funding:) }
49
- mod_hash.fetch('funding', []) << award_hash unless award_hash.nil?
39
+ %w[publications datasets softwares].each do |work_type|
40
+ works.fetch(work_type, []).each do |work|
41
+ next if @known_works.include?(work['id'])
42
+
43
+ work_hash = _work_to_mod_entry(type: work_type[0..work_type.length - 2], work:)
44
+ mod_hash.fetch('dmproadmap_related_identifiers', []) << work_hash unless work_hash.nil?
45
+ fundings = publication.fetch('fundingReferences', [])
46
+ next unless fundings.any?
47
+
48
+ award_hash = fundings.map { |funding| _funding_to_mod_entry(work:, funding:) }
49
+ mod_hash.fetch('funding', []) << award_hash unless award_hash.nil?
50
+ end
50
51
  end
51
52
  return 0 unless mod_hash['dmproadmap_related_identifiers'].any? || mod_hash.fetch('funding', []).any?
52
53
 
@@ -143,7 +143,7 @@ module Uc3DmpId
143
143
  @details_hash[:identifiers] << grant&.split('/')&.last&.downcase&.strip
144
144
  @details_hash[:identifiers] << opportunity&.downcase&.strip
145
145
 
146
- @details_hash[:funder_names] << funding['name']&.downcase&.strip
146
+ @details_hash[:funder_names] << funding['name']&.downcase&.split(' (').first&.strip
147
147
  @details_hash[:funder_ids] << fundref
148
148
  @details_hash[:opportunity_ids] << opportunity&.downcase&.strip
149
149
  @details_hash[:grant_ids] << [grant&.downcase&.strip, grant&.split('/')&.last&.downcase&.strip]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.1.13'
4
+ VERSION = '0.1.14'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-31 00:00:00.000000000 Z
11
+ date: 2023-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json