uc3-dmp-id 0.1.10 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d988ee80dfa85fc4f592a30bb6d53cb20b47e64998b06111e441343e286c5f9
4
- data.tar.gz: 86c974744aee06dd4d5b790159e018f63399438d46a9f131e56babf02cef51e6
3
+ metadata.gz: d3f3549ad23c4656916e7e6daf8f9152eb755d46279b7a3b689a26dd7d02d26b
4
+ data.tar.gz: 41a955d7b0e97e1094be9fd9d80b8f7ca45d17b901464aaae6816d09b757aa5a
5
5
  SHA512:
6
- metadata.gz: 9aad86fe76210fc8255b0513d74737e31884fe7827aa6a66edabf2fa24aaae8ed99eb8f7fabfd34a2f04a340b2a127d2f26d4bdac3ceabf596e115e925e54748
7
- data.tar.gz: 7496d05bcc65128c8ff645280994a2e430f0b7ca9ee80224defe1331ea27033af4e29c7ddcdcc3815df5640a9f02e41bad7b13036114fdda18a3a6f4f486dec9
6
+ metadata.gz: 2dd968c76f1e6fc0af048385872b93d7b3764b0f11bbfd7925c23233235b61b83a6678daec0544dcf6f0625797733b2de04e98691aff56359228caca849b1269
7
+ data.tar.gz: be3757e058012feaa9d9f0e11c0b0a75730031ad80f76793bb6f916247bff4c60f001bec49db41466e9aacc8a3b8dbbfcde303b73e5849855b119413fe202bc4
@@ -11,7 +11,7 @@ module Uc3DmpId
11
11
  # Class that adds items to the :dmphub_modifications array or directly to the
12
12
  # :dmpraodmap_related_identifiers array if the confidence level was 'Absolute'
13
13
  class Augmenter
14
- attr_accessor :augmenter, :dmp, :known_mods, :known_works, :known_awards, :logger
14
+ attr_accessor :augmenter, :run_id, :dmp, :known_mods, :known_works, :known_awards, :logger
15
15
 
16
16
  MSG_MISSING_ANNOTATIONS = 'DMP must have its DMPHub specific annotations!'
17
17
  MSG_MISSING_AUGMENTER = 'No Augmenter specified!'
@@ -21,6 +21,7 @@ module Uc3DmpId
21
21
  def initialize(**args)
22
22
  @logger = args[:logger]
23
23
  @augmenter = args[:augmenter]
24
+ @run_id = args.fetch(:run_id, 'None')
24
25
  raise AugmenterError, MSG_MISSING_AUGMENTER unless @augmenter.is_a?(Hash) && !@augmenter['PK'].nil?
25
26
 
26
27
  @dmp = args.fetch(:dmp, {})['dmp'].nil? ? args[:dmp] : args.fetch(:dmp, {})['dmp']
@@ -54,7 +55,6 @@ module Uc3DmpId
54
55
 
55
56
  # Save the DMP
56
57
  @dmp['dmphub_modifications'] = (@known_mods.nil? ? [] : @known_mods) << mod_hash
57
-
58
58
  client = Uc3DmpDynamo::Client.new
59
59
  resp = client.put_item(json: @dmp, logger:)
60
60
  raise AugmenterError, Helper::MSG_DMP_NO_DMP_ID if resp.nil?
@@ -70,6 +70,7 @@ module Uc3DmpId
70
70
  JSON.parse({
71
71
  id: "#{Time.now.utc.strftime('%Y-%m-%d')}-#{SecureRandom.hex(4)}",
72
72
  provenance: @augmenter['name'],
73
+ augmenter_run_id: @run_id,
73
74
  timestamp: Time.now.utc.iso8601,
74
75
  dmproadmap_related_identifiers: [],
75
76
  funding: []
@@ -94,7 +95,7 @@ module Uc3DmpId
94
95
  @logger&.debug(message: "Assessing Work: #{work['id']} (pre citation)", details: ret)
95
96
  return JSON.parse(ret.to_json) if work['bibtex'].nil?
96
97
 
97
- ret[:citation] = Uc3DmpCitation::Citer.bibtex_to_citation(bibtex_as_string: work['bibtex'])
98
+ ret[:citation] = Uc3DmpCitation::Citer.bibtex_to_citation(uri: work['id'], bibtex_as_string: work['bibtex'])
98
99
  JSON.parse(ret.to_json)
99
100
  end
100
101
  # rubocop:enable Metrics/AbcSize
@@ -101,6 +101,7 @@ module Uc3DmpId
101
101
  keywords: dmp.fetch('dataset', []).map { |ds| ds.fetch('keyword', []) }.flatten.compact.uniq,
102
102
  identifiers: [dmp.fetch('dmp_id', {})['identifier']],
103
103
  last_names: [],
104
+ orcids: [],
104
105
  affiliation_ids: [],
105
106
  affiliations: [],
106
107
  funder_names: [],
@@ -165,6 +166,7 @@ module Uc3DmpId
165
166
  name = entry.fetch('name', '')&.downcase&.strip
166
167
  last_name = name.include?(', ') ? name.split(', ').first : name.split.last
167
168
 
169
+ @details_hash[:orcids] << id unless id.nil?
168
170
  @details_hash[:identifiers] << [id, ror&.downcase&.strip]
169
171
  @details_hash[:last_names] << last_name
170
172
  @details_hash[:affiliation_ids] << ror
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.1.10'
4
+ VERSION = '0.1.12'
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.10
4
+ version: 0.1.12
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-30 00:00:00.000000000 Z
11
+ date: 2023-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json