relaton-nist 1.14.5 → 1.14.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +8 -0
- data/lib/relaton_nist/data_fetcher.rb +18 -13
- data/lib/relaton_nist/hit.rb +19 -19
- data/lib/relaton_nist/hit_collection.rb +9 -9
- data/lib/relaton_nist/nist_bibliography.rb +1 -1
- data/lib/relaton_nist/series.yaml +1 -1
- data/lib/relaton_nist/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af449d7420c8250ae7df9a33a292ac5278150c9159c05252650707746284feaa
|
4
|
+
data.tar.gz: f01fceceb91e3e91e0cb6b532fa2b63fdecfb88d18ddc9879f98b10733637232
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 158958c46a83455aa5a14ec3f9c1f84a6bd70870fb2f1e85dc37d2200d8a3b3a0a4bf824f924ac775f54d1204656f0f40c078f6b71a737efd33d46f93fc681c3
|
7
|
+
data.tar.gz: c999b71e25e1aef1f5d3a066db3f0720149c23a2cca13a75fa453201a06aabc7cf21a4b313b21f8e98dbeece8803c8f65ba0a3d79e0d8c942244d07fe656341d
|
data/README.adoc
CHANGED
@@ -43,6 +43,14 @@ sources:
|
|
43
43
|
. bibliographic feed from NIST CSRC
|
44
44
|
. NIST Library dataset
|
45
45
|
|
46
|
+
The NIST CSRC provides:
|
47
|
+
|
48
|
+
* NIST SP 800-*
|
49
|
+
* NIST SP 500-*
|
50
|
+
* NIST SP 1800-*
|
51
|
+
* NIST FIPS {31, 39, 41, 46, 46-$$*$$, 48, 65, 73, 74, 81, 83, 87, 102, 112, 113, 139, 140-$$*$$, 141, 171, 180, 180-$$*$$, 181, 186, 186-$$*$$, 188, 190, 191, 196, 197, 198, 198-1, 199, 200, 201, 201-*, 202}
|
52
|
+
|
53
|
+
The NIST Library dataset provides documents listed in the https://github.com/relaton/relaton-data-nist/blob/main/index-v1.yaml[index].
|
46
54
|
|
47
55
|
== Installation
|
48
56
|
|
@@ -29,14 +29,6 @@ module RelatonNist
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def parse_docid(doc) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
32
|
-
# case doi
|
33
|
-
# when "10.6028/NBS.CIRC.12e2revjune" then doi.sub!("13e", "12e")
|
34
|
-
# when "10.6028/NBS.CIRC.36e2" then doi.sub!("46e", "36e")
|
35
|
-
# when "10.6028/NBS.HB.67suppJune1967" then doi.sub!("1965", "1967")
|
36
|
-
# when "10.6028/NBS.HB.105-1r1990" then doi.sub!("105-1-1990", "105-1r1990")
|
37
|
-
# when "10.6028/NIST.HB.150-10-1995" then doi.sub!(/150-10$/, "150-10-1995")
|
38
|
-
# end
|
39
|
-
# anchor = doi.split("/")[1..-1].join "/"
|
40
32
|
[
|
41
33
|
{ type: "NIST", id: pub_id(doc), primary: true },
|
42
34
|
{ type: "DOI", id: fetch_doi(doc) },
|
@@ -44,9 +36,16 @@ module RelatonNist
|
|
44
36
|
]
|
45
37
|
end
|
46
38
|
|
39
|
+
#
|
40
|
+
# Parse document's ID from XML
|
41
|
+
#
|
42
|
+
# @param [Nokogiri::XML::Element] doc XML element
|
43
|
+
#
|
44
|
+
# @return [String] document's ID
|
45
|
+
#
|
47
46
|
def pub_id(doc)
|
48
47
|
# anchor(doc).gsub(".", " ")
|
49
|
-
fetch_doi(doc).split("/")[1..].join("/").gsub(".", " ")
|
48
|
+
fetch_doi(doc).split("/")[1..].join("/").gsub(".", " ").sub(/^nist\sir/, "NIST IR")
|
50
49
|
end
|
51
50
|
|
52
51
|
def fetch_doi(doc) # rubocop:disable Metrics/CyclomaticComplexity
|
@@ -135,8 +134,12 @@ module RelatonNist
|
|
135
134
|
# @param doc [Nokogiri::XML::Element]
|
136
135
|
# @return [Array<RelatonBib::FormattedString>]
|
137
136
|
def fetch_abstract(doc)
|
138
|
-
doc.xpath(
|
139
|
-
|
137
|
+
doc.xpath(
|
138
|
+
"jats:abstract/jats:p", "jats" => "http://www.ncbi.nlm.nih.gov/JATS1"
|
139
|
+
).each_with_object([]) do |a, m|
|
140
|
+
next if a.text.empty?
|
141
|
+
|
142
|
+
m << RelatonBib::FormattedString.new(content: a.text, language: doc["language"], script: "Latn")
|
140
143
|
end
|
141
144
|
end
|
142
145
|
|
@@ -273,8 +276,6 @@ module RelatonNist
|
|
273
276
|
# @return [Array<RelatonBib::Series>] series
|
274
277
|
#
|
275
278
|
def fetch_series(doc)
|
276
|
-
series_path = File.expand_path("series.yaml", __dir__)
|
277
|
-
series = YAML.load_file series_path
|
278
279
|
prf, srs, num = pub_id(doc).split
|
279
280
|
sname = series[srs] || srs
|
280
281
|
title = RelatonBib::TypedTitleString.new(content: "#{prf} #{sname}")
|
@@ -282,6 +283,10 @@ module RelatonNist
|
|
282
283
|
[RelatonBib::Series.new(title: title, abbreviation: abbr, number: num)]
|
283
284
|
end
|
284
285
|
|
286
|
+
def series
|
287
|
+
@series ||= YAML.load_file File.expand_path("series.yaml", __dir__)
|
288
|
+
end
|
289
|
+
|
285
290
|
#
|
286
291
|
# Save document
|
287
292
|
#
|
data/lib/relaton_nist/hit.rb
CHANGED
@@ -19,24 +19,24 @@ module RelatonNist
|
|
19
19
|
#
|
20
20
|
# @return [Iteger] sorting weigth
|
21
21
|
#
|
22
|
-
def sort_value # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
22
|
+
# def sort_value # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
23
|
+
# @sort_value ||= begin
|
24
|
+
# sort_phrase = [hit[:series], hit[:code]].join " "
|
25
|
+
# corr = hit_collection&.text&.split&.map do |w|
|
26
|
+
# if w =~ /\w+/ &&
|
27
|
+
# sort_phrase =~ Regexp.new(Regexp.escape(w), Regexp::IGNORECASE)
|
28
|
+
# 1
|
29
|
+
# else 0
|
30
|
+
# end
|
31
|
+
# end&.sum.to_i
|
32
|
+
# corr + case hit[:status]
|
33
|
+
# when "final" then 4
|
34
|
+
# when "withdrawn" then 3
|
35
|
+
# when "draft" then 2
|
36
|
+
# when "draft (obsolete)" then 1
|
37
|
+
# else 0
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
# end
|
41
41
|
end
|
42
42
|
end
|
@@ -59,9 +59,9 @@ module RelatonNist
|
|
59
59
|
(refparts[:code] && [parts[:series], item.hit[:series]].include?(refparts[:series]) &&
|
60
60
|
refparts[:code].casecmp(parts[:code].upcase).zero? &&
|
61
61
|
(refparts[:prt] == parts[:prt]) &&
|
62
|
-
(refparts[:vol] == parts[:vol]) &&
|
63
|
-
(refparts[:ver] == parts[:ver]) &&
|
64
|
-
(refparts[:rev] == parts[:rev]) &&
|
62
|
+
(refparts[:vol].nil? || refparts[:vol] == parts[:vol]) &&
|
63
|
+
(refparts[:ver].nil? || refparts[:ver] == parts[:ver]) &&
|
64
|
+
(refparts[:rev].nil? || refparts[:rev] == parts[:rev]) &&
|
65
65
|
refparts[:draft] == parts[:draft] && refparts[:add] == parts[:add])
|
66
66
|
end
|
67
67
|
end
|
@@ -164,11 +164,10 @@ module RelatonNist
|
|
164
164
|
#
|
165
165
|
def sort_hits!
|
166
166
|
@array.sort! do |a, b|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
end
|
167
|
+
code = a.hit[:code] <=> b.hit[:code]
|
168
|
+
next code unless code.zero?
|
169
|
+
|
170
|
+
b.hit[:release_date] <=> a.hit[:release_date]
|
172
171
|
end
|
173
172
|
self
|
174
173
|
end
|
@@ -191,7 +190,8 @@ module RelatonNist
|
|
191
190
|
hash = YAML.safe_load yaml
|
192
191
|
hash["fetched"] = Date.today.to_s
|
193
192
|
bib = RelatonNist::NistBibliographicItem.from_hash hash
|
194
|
-
|
193
|
+
id = bib.docidentifier.find(&:primary).id
|
194
|
+
hit = Hit.new({ code: id }, self)
|
195
195
|
hit.fetch = bib
|
196
196
|
[hit]
|
197
197
|
rescue OpenURI::HTTPError => e
|
@@ -22,7 +22,7 @@ MONO: Monographs
|
|
22
22
|
MP: Miscellaneous Publications
|
23
23
|
NCSTAR: National Construction Safety Team Act Reports
|
24
24
|
NSRDS: National Standard Reference Data Series
|
25
|
-
IR:
|
25
|
+
IR: IR (Interagency/Internal Reports)
|
26
26
|
OWMWP: Office of Weights and Measures White Papers
|
27
27
|
PC: Photographic Circulars
|
28
28
|
RPT: NBS Reports
|
data/lib/relaton_nist/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-nist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: relaton-bib
|