iev 0.4.3 → 0.4.4
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/CLAUDE.md +3 -0
- data/Gemfile +3 -18
- data/README.adoc +34 -0
- data/data/subject_areas.yaml +1920 -0
- data/lib/iev/cli/command.rb +24 -0
- data/lib/iev/exporter.rb +19 -0
- data/lib/iev/scraper/browser.rb +102 -0
- data/lib/iev/scraper.rb +5 -105
- data/lib/iev/subject_area_concepts.rb +123 -0
- data/lib/iev/subject_areas.rb +232 -0
- data/lib/iev/term_builder.rb +19 -0
- data/lib/iev/version.rb +1 -1
- data/lib/iev.rb +36 -0
- metadata +6 -2
data/lib/iev/term_builder.rb
CHANGED
|
@@ -77,6 +77,9 @@ module Iev
|
|
|
77
77
|
cd.notes = extract_notes
|
|
78
78
|
cd.terms = extract_terms
|
|
79
79
|
|
|
80
|
+
domain = extract_domain
|
|
81
|
+
cd.domain = domain if domain
|
|
82
|
+
|
|
80
83
|
sources = extract_authoritative_source
|
|
81
84
|
cd.sources = sources if sources&.any?
|
|
82
85
|
|
|
@@ -98,6 +101,22 @@ module Iev
|
|
|
98
101
|
@term_language ||= find_value_for("LANGUAGE").to_three_char_code
|
|
99
102
|
end
|
|
100
103
|
|
|
104
|
+
# Derives the domain (subject area section) from the IEVREF identifier.
|
|
105
|
+
# IEVREF format: "AAA-BB-CC" where AAA = area, AAA-BB = section.
|
|
106
|
+
# Returns a URI reference to the section concept (e.g. "section-103-01").
|
|
107
|
+
def extract_domain
|
|
108
|
+
return nil unless term_id
|
|
109
|
+
|
|
110
|
+
section_code = term_id.split("-")[0..1].join("-")
|
|
111
|
+
section = Iev.find_section(section_code)
|
|
112
|
+
return SubjectAreas.section_uri(section_code) if section
|
|
113
|
+
|
|
114
|
+
area_code = term_id.split("-")[0]
|
|
115
|
+
SubjectAreas.area_uri(area_code)
|
|
116
|
+
rescue StandardError
|
|
117
|
+
nil
|
|
118
|
+
end
|
|
119
|
+
|
|
101
120
|
# Splits unified definition (from the spreadsheet) into separate
|
|
102
121
|
# definition, examples, and notes strings (for YAMLs).
|
|
103
122
|
#
|
data/lib/iev/version.rb
CHANGED
data/lib/iev.rb
CHANGED
|
@@ -34,6 +34,8 @@ module Iev
|
|
|
34
34
|
autoload :RelatonDb, "iev/relaton_db"
|
|
35
35
|
autoload :Scraper, "iev/scraper"
|
|
36
36
|
autoload :SourceParser, "iev/source_parser"
|
|
37
|
+
autoload :SubjectAreas, "iev/subject_areas"
|
|
38
|
+
autoload :SubjectAreaConcepts, "iev/subject_area_concepts"
|
|
37
39
|
autoload :SupersessionParser, "iev/supersession_parser"
|
|
38
40
|
autoload :TermAttrsParser, "iev/term_attrs_parser"
|
|
39
41
|
autoload :TermBuilder, "iev/term_builder"
|
|
@@ -80,4 +82,38 @@ module Iev
|
|
|
80
82
|
def self.scrape_concept(code)
|
|
81
83
|
Scraper.new.fetch_concept(code)
|
|
82
84
|
end
|
|
85
|
+
|
|
86
|
+
# Return all IEV subject areas with their sections (from bundled data).
|
|
87
|
+
# @return [Array<Hash>]
|
|
88
|
+
def self.subject_areas
|
|
89
|
+
SubjectAreas.all
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Find a subject area by code.
|
|
93
|
+
# @param code [String, Integer] e.g. "102"
|
|
94
|
+
# @return [Hash, nil]
|
|
95
|
+
def self.find_subject_area(code)
|
|
96
|
+
SubjectAreas.find_area(code)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Find a section by its section code.
|
|
100
|
+
# @param section_code [String] e.g. "102-01"
|
|
101
|
+
# @return [Hash, nil]
|
|
102
|
+
def self.find_section(section_code)
|
|
103
|
+
SubjectAreas.find_section(section_code)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Return sections for a given area code.
|
|
107
|
+
# @param code [String, Integer] e.g. "102"
|
|
108
|
+
# @return [Array<Hash>]
|
|
109
|
+
def self.sections_for(code)
|
|
110
|
+
SubjectAreas.sections_for(code)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Return the parent subject area for a given section code.
|
|
114
|
+
# @param section_code [String] e.g. "102-01"
|
|
115
|
+
# @return [Hash, nil]
|
|
116
|
+
def self.area_for_section(section_code)
|
|
117
|
+
SubjectAreas.area_for_section(section_code)
|
|
118
|
+
end
|
|
83
119
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: iev
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-05-
|
|
11
|
+
date: 2026-05-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: creek
|
|
@@ -191,6 +191,7 @@ files:
|
|
|
191
191
|
- Rakefile
|
|
192
192
|
- bin/console
|
|
193
193
|
- bin/setup
|
|
194
|
+
- data/subject_areas.yaml
|
|
194
195
|
- exe/iev
|
|
195
196
|
- iev.gemspec
|
|
196
197
|
- lib/iev.rb
|
|
@@ -210,8 +211,11 @@ files:
|
|
|
210
211
|
- lib/iev/profiler.rb
|
|
211
212
|
- lib/iev/relaton_db.rb
|
|
212
213
|
- lib/iev/scraper.rb
|
|
214
|
+
- lib/iev/scraper/browser.rb
|
|
213
215
|
- lib/iev/scraper/page_parser.rb
|
|
214
216
|
- lib/iev/source_parser.rb
|
|
217
|
+
- lib/iev/subject_area_concepts.rb
|
|
218
|
+
- lib/iev/subject_areas.rb
|
|
215
219
|
- lib/iev/supersession_parser.rb
|
|
216
220
|
- lib/iev/term_attrs_parser.rb
|
|
217
221
|
- lib/iev/term_builder.rb
|