bolognese 1.1 → 1.1.1
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/Gemfile.lock +1 -1
- data/lib/bolognese/metadata.rb +5 -1
- data/lib/bolognese/utils.rb +6 -0
- data/lib/bolognese/version.rb +1 -1
- data/lib/bolognese/writers/csv_writer.rb +5 -4
- data/spec/writers/csv_writer_spec.rb +41 -24
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ff0be2c3f93e115b37c7fb40e472979f997660034fe611caa145f94eda6f00d
|
|
4
|
+
data.tar.gz: ec082c7b6ddd9f0f8abf2f5c08897b3ca73a48ad9a391a3e4de570a9556bf2ee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 23f5743255d698fa71e7297e67335883abe7fd093c7a38b1a25ffe1d26d6462e36034f591cc00fdf3baafd649426393e8d3e25938744da2de91b102c155d37aa
|
|
7
|
+
data.tar.gz: ad05fdb0f221944bb4a2dbc0b06fb69e14244b819762585bb293acf06697dba0815bee2eea5c7a77b4606b4ffbdc8e7b8f692f248117f6afedc933779462e4df
|
data/Gemfile.lock
CHANGED
data/lib/bolognese/metadata.rb
CHANGED
|
@@ -13,7 +13,7 @@ module Bolognese
|
|
|
13
13
|
:subjects, :contributor, :descriptions, :language, :sizes,
|
|
14
14
|
:formats, :schema_version, :meta, :container, :agency,
|
|
15
15
|
:format, :funding_references, :state, :geo_locations,
|
|
16
|
-
:types, :content_url, :related_identifiers, :style, :locale
|
|
16
|
+
:types, :content_url, :related_identifiers, :style, :locale, :date_registered
|
|
17
17
|
|
|
18
18
|
def initialize(input: nil, from: nil, **options)
|
|
19
19
|
id = normalize_id(input, options)
|
|
@@ -215,6 +215,10 @@ module Bolognese
|
|
|
215
215
|
@state ||= meta.fetch("state", nil)
|
|
216
216
|
end
|
|
217
217
|
|
|
218
|
+
def date_registered
|
|
219
|
+
@date_registered ||= meta.fetch("date_registered", nil)
|
|
220
|
+
end
|
|
221
|
+
|
|
218
222
|
def types
|
|
219
223
|
@types ||= meta.fetch("types", nil)
|
|
220
224
|
end
|
data/lib/bolognese/utils.rb
CHANGED
|
@@ -833,6 +833,12 @@ module Bolognese
|
|
|
833
833
|
{ 'date-parts' => [[year.to_i, month.to_i, day.to_i].reject { |part| part == 0 }] }
|
|
834
834
|
end
|
|
835
835
|
|
|
836
|
+
def get_iso8601_date(iso8601_time)
|
|
837
|
+
return nil if iso8601_time.nil?
|
|
838
|
+
|
|
839
|
+
iso8601_time[0..9]
|
|
840
|
+
end
|
|
841
|
+
|
|
836
842
|
def get_year_month(iso8601_time)
|
|
837
843
|
return [] if iso8601_time.nil?
|
|
838
844
|
|
data/lib/bolognese/version.rb
CHANGED
|
@@ -2,7 +2,7 @@ module Bolognese
|
|
|
2
2
|
module Writers
|
|
3
3
|
module CsvWriter
|
|
4
4
|
require "csv"
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
def csv
|
|
7
7
|
return nil unless valid?
|
|
8
8
|
|
|
@@ -12,6 +12,9 @@ module Bolognese
|
|
|
12
12
|
doi: doi,
|
|
13
13
|
url: url,
|
|
14
14
|
year: publication_year,
|
|
15
|
+
registered: get_iso8601_date(date_registered),
|
|
16
|
+
state: state,
|
|
17
|
+
resource_type_general: types["resourceTypeGeneral"],
|
|
15
18
|
bibtex_type: types["bibtex"].presence || "misc",
|
|
16
19
|
title: parse_attributes(titles, content: "title", first: true),
|
|
17
20
|
author: authors_as_string(creators),
|
|
@@ -19,9 +22,7 @@ module Bolognese
|
|
|
19
22
|
journal: container && container["title"],
|
|
20
23
|
volume: container.to_h["volume"],
|
|
21
24
|
issue: container.to_h["issue"],
|
|
22
|
-
pages: pages
|
|
23
|
-
language: language,
|
|
24
|
-
keywords: subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) }.join(", ") : nil
|
|
25
|
+
pages: pages
|
|
25
26
|
}.values
|
|
26
27
|
|
|
27
28
|
CSV.generate { |csv| csv << bib }
|
|
@@ -12,11 +12,14 @@ describe Bolognese::Metadata, vcr: true do
|
|
|
12
12
|
expect(csv[0]).to eq("10.7554/elife.01567")
|
|
13
13
|
expect(csv[1]).to eq("https://elifesciences.org/articles/01567")
|
|
14
14
|
expect(csv[2]).to eq("2014")
|
|
15
|
-
expect(csv[3]).to
|
|
16
|
-
expect(csv[4]).to eq("
|
|
17
|
-
expect(csv[5]).to eq("
|
|
18
|
-
expect(csv[6]).to eq("
|
|
19
|
-
expect(csv[7]).to eq("
|
|
15
|
+
expect(csv[3]).to be_nil
|
|
16
|
+
expect(csv[4]).to eq("findable")
|
|
17
|
+
expect(csv[5]).to eq("Text")
|
|
18
|
+
expect(csv[6]).to eq("article")
|
|
19
|
+
expect(csv[7]).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
|
20
|
+
expect(csv[8]).to eq("Sankar, Martial and Nieminen, Kaisa and Ragni, Laura and Xenarios, Ioannis and Hardtke, Christian S")
|
|
21
|
+
expect(csv[9]).to eq("(:unav)")
|
|
22
|
+
expect(csv[10]).to eq("eLife")
|
|
20
23
|
end
|
|
21
24
|
|
|
22
25
|
it "with pages" do
|
|
@@ -27,12 +30,17 @@ describe Bolognese::Metadata, vcr: true do
|
|
|
27
30
|
expect(csv[0]).to eq("10.1155/2012/291294")
|
|
28
31
|
expect(csv[1]).to eq("http://www.hindawi.com/journals/pm/2012/291294/")
|
|
29
32
|
expect(csv[2]).to eq("2012")
|
|
30
|
-
expect(csv[3]).to
|
|
31
|
-
expect(csv[4]).to eq("
|
|
32
|
-
expect(csv[5]).to eq("
|
|
33
|
-
expect(csv[6]).to eq("
|
|
34
|
-
expect(csv[7]).to eq("
|
|
35
|
-
expect(csv[
|
|
33
|
+
expect(csv[3]).to be_nil
|
|
34
|
+
expect(csv[4]).to eq("findable")
|
|
35
|
+
expect(csv[5]).to eq("Text")
|
|
36
|
+
expect(csv[6]).to eq("article")
|
|
37
|
+
expect(csv[7]).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
|
|
38
|
+
expect(csv[8]).to eq("Thanassi, Wendy and Noda, Art and Hernandez, Beatriz and Newell, Jeffery and Terpeluk, Paul and Marder, David and Yesavage, Jerome A.")
|
|
39
|
+
expect(csv[9]).to eq("(:unav)")
|
|
40
|
+
expect(csv[10]).to eq("Pulmonary Medicine")
|
|
41
|
+
expect(csv[11]).to eq("2012")
|
|
42
|
+
expect(csv[12]).to be_nil
|
|
43
|
+
expect(csv[13]).to eq("1-7")
|
|
36
44
|
end
|
|
37
45
|
|
|
38
46
|
it "text" do
|
|
@@ -44,10 +52,14 @@ describe Bolognese::Metadata, vcr: true do
|
|
|
44
52
|
expect(csv[0]).to eq("10.17173/pretest8")
|
|
45
53
|
expect(csv[1]).to eq("http://pretest.gesis.org/Pretest/DoiId/10.17173/pretest8")
|
|
46
54
|
expect(csv[2]).to eq("2014")
|
|
47
|
-
expect(csv[3]).to eq("
|
|
48
|
-
expect(csv[4]).to eq("
|
|
49
|
-
expect(csv[5]).to eq("
|
|
50
|
-
expect(csv[6]).to eq("
|
|
55
|
+
expect(csv[3]).to eq("2016-06-01")
|
|
56
|
+
expect(csv[4]).to eq("findable")
|
|
57
|
+
expect(csv[5]).to eq("Text")
|
|
58
|
+
expect(csv[6]).to eq("article")
|
|
59
|
+
expect(csv[7]).to eq("PIAAC-Longitudinal (PIAAC-L) 2015")
|
|
60
|
+
expect(csv[8]).to eq("Lenzner, T. and Neuert, C. and Otto, W. and Landrock, U. and Menold, N.")
|
|
61
|
+
expect(csv[9]).to eq("GESIS – Pretest Lab")
|
|
62
|
+
expect(csv[10]).to eq("GESIS Projektbericht")
|
|
51
63
|
end
|
|
52
64
|
|
|
53
65
|
it "climate data" do
|
|
@@ -59,10 +71,13 @@ describe Bolognese::Metadata, vcr: true do
|
|
|
59
71
|
expect(csv[0]).to eq("10.5067/altcy-tj122")
|
|
60
72
|
expect(csv[1]).to eq("http://podaac.jpl.nasa.gov/dataset/MERGED_TP_J1_OSTM_OST_CYCLES_V2")
|
|
61
73
|
expect(csv[2]).to eq("2012")
|
|
62
|
-
expect(csv[3]).to eq("
|
|
63
|
-
expect(csv[4]).to eq("
|
|
64
|
-
expect(csv[5]).to eq("
|
|
65
|
-
expect(csv[6]).to eq("
|
|
74
|
+
expect(csv[3]).to eq("2014-01-15")
|
|
75
|
+
expect(csv[4]).to eq("findable")
|
|
76
|
+
expect(csv[5]).to eq("Dataset")
|
|
77
|
+
expect(csv[6]).to eq("misc")
|
|
78
|
+
expect(csv[7]).to eq("Integrated Multi-Mission Ocean Altimeter Data for Climate Research Version 2")
|
|
79
|
+
expect(csv[8]).to eq("{GSFC}")
|
|
80
|
+
expect(csv[9]).to eq("NASA Physical Oceanography DAAC")
|
|
66
81
|
end
|
|
67
82
|
|
|
68
83
|
it "maremma" do
|
|
@@ -73,11 +88,13 @@ describe Bolognese::Metadata, vcr: true do
|
|
|
73
88
|
expect(csv[0]).to eq("10.5438/qeg0-3gm3")
|
|
74
89
|
expect(csv[1]).to eq("https://github.com/datacite/maremma")
|
|
75
90
|
expect(csv[2]).to eq("2017")
|
|
76
|
-
expect(csv[3]).to
|
|
77
|
-
expect(csv[4]).to eq("
|
|
78
|
-
expect(csv[5]).to eq("
|
|
79
|
-
expect(csv[6]).to eq("
|
|
80
|
-
expect(csv[
|
|
91
|
+
expect(csv[3]).to be_nil
|
|
92
|
+
expect(csv[4]).to eq("findable")
|
|
93
|
+
expect(csv[5]).to eq("Software")
|
|
94
|
+
expect(csv[6]).to eq("misc")
|
|
95
|
+
expect(csv[7]).to eq("Maremma: a Ruby library for simplified network calls")
|
|
96
|
+
expect(csv[8]).to eq("Fenner, Martin")
|
|
97
|
+
expect(csv[9]).to eq("DataCite")
|
|
81
98
|
end
|
|
82
99
|
end
|
|
83
100
|
end
|