geo_combine 0.9.2 → 0.10.0
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/.github/dependabot.yml +11 -0
- data/.github/workflows/ruby.yml +7 -7
- data/.gitignore +1 -0
- data/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +1 -1
- data/Gemfile +2 -1
- data/README.md +33 -6
- data/geo_combine.gemspec +2 -2
- data/lib/.DS_Store +0 -0
- data/lib/geo_combine/bounding_box.rb +0 -4
- data/lib/geo_combine/ckan_metadata.rb +1 -1
- data/lib/geo_combine/esri_open_data.rb +1 -0
- data/lib/geo_combine/geoblacklight.rb +30 -9
- data/lib/geo_combine/harvester.rb +28 -24
- data/lib/geo_combine/ogp.rb +11 -10
- data/lib/geo_combine/version.rb +1 -1
- data/lib/tasks/geo_combine.rake +10 -4
- data/lib/xslt/isoAardvark.xsl +738 -0
- data/spec/features/fgdc2html_spec.rb +1 -0
- data/spec/features/iso2html_spec.rb +1 -0
- data/spec/lib/geo_combine/ckan_metadata_spec.rb +1 -0
- data/spec/lib/geo_combine/esri_open_data_spec.rb +1 -0
- data/spec/lib/geo_combine/fgdc_spec.rb +3 -2
- data/spec/lib/geo_combine/geoblacklight_spec.rb +21 -20
- data/spec/lib/geo_combine/harvester_spec.rb +45 -15
- data/spec/lib/geo_combine/iso19139_spec.rb +1 -0
- metadata +14 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cf25387203a718f8ae41365d87fae7d1868ea1416bf8ae9a33d11b6fef21171d
|
|
4
|
+
data.tar.gz: 7cbdec148a45206e21090b123390ac129d705c502e2ed1bd2c0d723b81afd51c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1319f17633d5ee99fe3706dcdae9b7a327339b658ee8677b678aa23132b8b48b031589b217399c53078625b5a3f19cbdd11f13a00313edbe563a0ea8b04c651b
|
|
7
|
+
data.tar.gz: 521143da86eabc8ec0d89a45c82d8ccf58f2ab6bab03bf06357fd124e3601898a2ee8cd9a522b5d7a126d0e106e93f4790e84fd915186439eec7a7956814cf7c
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: "github-actions"
|
|
9
|
+
directory: "/"
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "weekly"
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -6,11 +6,11 @@ jobs:
|
|
|
6
6
|
rubocop:
|
|
7
7
|
runs-on: ubuntu-latest
|
|
8
8
|
steps:
|
|
9
|
-
- uses: actions/checkout@
|
|
9
|
+
- uses: actions/checkout@v6
|
|
10
10
|
- name: Set up Ruby and install dependencies
|
|
11
11
|
uses: ruby/setup-ruby@v1
|
|
12
12
|
with:
|
|
13
|
-
ruby-version: 3.
|
|
13
|
+
ruby-version: 3.2
|
|
14
14
|
bundler-cache: true
|
|
15
15
|
- name: Run linter
|
|
16
16
|
run: bundle exec rubocop
|
|
@@ -19,10 +19,10 @@ jobs:
|
|
|
19
19
|
runs-on: ubuntu-latest
|
|
20
20
|
strategy:
|
|
21
21
|
matrix:
|
|
22
|
-
ruby: [3.
|
|
22
|
+
ruby: [3.2, 3.3, 3.4]
|
|
23
23
|
faraday_version: ['', '~> 1.0'] # Defaults to whatever's the most recent version.
|
|
24
24
|
steps:
|
|
25
|
-
- uses: actions/checkout@
|
|
25
|
+
- uses: actions/checkout@v6
|
|
26
26
|
|
|
27
27
|
- name: Set up Ruby and install dependencies
|
|
28
28
|
uses: ruby/setup-ruby@v1
|
|
@@ -32,13 +32,13 @@ jobs:
|
|
|
32
32
|
env:
|
|
33
33
|
FARADAY_VERSION: ${{ matrix.faraday_version }}
|
|
34
34
|
|
|
35
|
-
- name: Run tests
|
|
35
|
+
- name: "Run tests for Ruby ${{ matrix.ruby }} and Faraday ${{ matrix.faraday_version == '~> 1.0' && '1.x' || 'latest' }}"
|
|
36
36
|
run: bundle exec rake spec
|
|
37
37
|
env:
|
|
38
38
|
FARADAY_VERSION: ${{ matrix.faraday_version }}
|
|
39
39
|
|
|
40
40
|
- name: Upload coverage artifacts
|
|
41
|
-
uses: actions/upload-artifact@
|
|
41
|
+
uses: actions/upload-artifact@v6
|
|
42
42
|
with:
|
|
43
|
-
name: coverage
|
|
43
|
+
name: "coverage-${{ matrix.ruby }}-${{ matrix.faraday_version == '~> 1.0' && 'faraday-1.x' || 'faraday-latest' }}"
|
|
44
44
|
path: coverage/
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
|
@@ -41,7 +41,7 @@ Metrics/CyclomaticComplexity:
|
|
|
41
41
|
# Offense count: 13
|
|
42
42
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
43
43
|
Metrics/MethodLength:
|
|
44
|
-
Max:
|
|
44
|
+
Max: 25
|
|
45
45
|
|
|
46
46
|
# Offense count: 2
|
|
47
47
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -32,8 +32,11 @@ $ gem install geo_combine
|
|
|
32
32
|
## Usage
|
|
33
33
|
|
|
34
34
|
### Converting metadata
|
|
35
|
+
|
|
35
36
|
#### Converting metadata into GeoBlacklight JSON
|
|
37
|
+
|
|
36
38
|
GeoCombine provides several classes representing different metadata standards that implement the `#to_geoblacklight` method for generating records in the [GeoBlacklight JSON format](https://opengeometadata.org/reference/):
|
|
39
|
+
|
|
37
40
|
```ruby
|
|
38
41
|
GeoCombine::Iso19139 # ISO 19139 XML
|
|
39
42
|
GeoCombine::OGP # OpenGeoPortal JSON
|
|
@@ -41,7 +44,9 @@ GeoCombine::Fgdc # FGDC XML
|
|
|
41
44
|
GeoCombine::EsriOpenData # Esri Open Data Portal JSON
|
|
42
45
|
GeoCombine::CkanMetadata # CKAN JSON
|
|
43
46
|
```
|
|
47
|
+
|
|
44
48
|
An example for converting an ISO 19139 XML record:
|
|
49
|
+
|
|
45
50
|
```ruby
|
|
46
51
|
# Create a new ISO19139 object
|
|
47
52
|
> iso_metadata = GeoCombine::Iso19139.new('./tmp/opengeometadata/edu.stanford.purl/bb/338/jh/0716/iso19139.xml')
|
|
@@ -52,7 +57,9 @@ An example for converting an ISO 19139 XML record:
|
|
|
52
57
|
# Output it as JSON instead of a Ruby hash
|
|
53
58
|
> iso_metadata.to_geoblacklight.to_json
|
|
54
59
|
```
|
|
60
|
+
|
|
55
61
|
Some formats also support conversion into HTML for display in a web browser:
|
|
62
|
+
|
|
56
63
|
```ruby
|
|
57
64
|
# Create a new ISO19139 object
|
|
58
65
|
> iso_metadata = GeoCombine::Iso19139.new('./tmp/opengeometadata/edu.stanford.purl/bb/338/jh/0716/iso19139.xml')
|
|
@@ -94,7 +101,16 @@ GeoCombine::Migrators::V1AardvarkMigrator.new(v1_hash: record, collection_id_map
|
|
|
94
101
|
Some of the tools and scripts in this gem use Ruby's `Logger` class to print information to `$stderr`. By default, the log level is set to `Logger::INFO`. For more verbose information, you can set the `LOG_LEVEL` environment variable to `DEBUG`:
|
|
95
102
|
|
|
96
103
|
```sh
|
|
97
|
-
$ LOG_LEVEL=DEBUG
|
|
104
|
+
$ export LOG_LEVEL=DEBUG
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### Schema version
|
|
108
|
+
|
|
109
|
+
By default, GeoCombine will only fetch and index records using the current schema version. If you instead want to index records using an older schema (e.g. because your GeoBlacklight instance is an older version), you can set the `SCHEMA_VERSION` environment variable:
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
# Only fetch and index schema version 1.0 records
|
|
113
|
+
$ export SCHEMA_VERSION=1.0
|
|
98
114
|
```
|
|
99
115
|
|
|
100
116
|
#### Clone OpenGeoMetadata repositories locally
|
|
@@ -103,7 +119,7 @@ $ LOG_LEVEL=DEBUG bundle exec rake geocombine:clone
|
|
|
103
119
|
$ bundle exec rake geocombine:clone
|
|
104
120
|
```
|
|
105
121
|
|
|
106
|
-
Will clone all
|
|
122
|
+
Will clone all OpenGeoMetadata repositories containing metadata matching the `SCHEMA_VERSION` into `./tmp/opengeometadata`. Location of the OpenGeoMetadata repositories can be configured using the `OGM_PATH` environment variable.
|
|
107
123
|
|
|
108
124
|
```sh
|
|
109
125
|
$ OGM_PATH='my/custom/location' bundle exec rake geocombine:clone
|
|
@@ -152,17 +168,28 @@ $ bundle exec rake geocombine:index
|
|
|
152
168
|
|
|
153
169
|
If Blacklight is installed in the ruby environment and a solr index is configured, the rake task will use the solr index configured in the Blacklight application (this is the case when invoking GeoCombine from your GeoBlacklight installation). If Blacklight is unavailable, the rake task will try to find a Solr instance running at `http://localhost:8983/solr/blacklight-core`.
|
|
154
170
|
|
|
155
|
-
You can also set
|
|
171
|
+
You can also set the Solr instance URL using `SOLR_URL`:
|
|
156
172
|
|
|
157
173
|
```sh
|
|
158
174
|
$ SOLR_URL=http://www.example.com:1234/solr/collection bundle exec rake geocombine:index
|
|
159
175
|
```
|
|
160
176
|
|
|
161
|
-
|
|
177
|
+
### Indexing local documents
|
|
178
|
+
|
|
179
|
+
To index an arbitrary collection of records in a custom directory, run one of the following:
|
|
180
|
+
|
|
181
|
+
```sh
|
|
182
|
+
rake geocombine:index\[/path/to/your/files\]
|
|
183
|
+
OGM_PATH=/path/to/your/files rake geocombine:index
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Indexing a single document
|
|
187
|
+
|
|
188
|
+
To index a single arbitrary record, run one of the following:
|
|
162
189
|
|
|
163
190
|
```sh
|
|
164
|
-
|
|
165
|
-
|
|
191
|
+
rake geocombine:index\[/path/to/your/file.json\]
|
|
192
|
+
OGM_PATH=/path/to/your/file.json rake geocombine:index
|
|
166
193
|
```
|
|
167
194
|
|
|
168
195
|
### Harvesting and indexing documents from GeoBlacklight sites
|
data/geo_combine.gemspec
CHANGED
|
@@ -32,8 +32,8 @@ Gem::Specification.new do |spec|
|
|
|
32
32
|
spec.add_development_dependency 'rake'
|
|
33
33
|
spec.add_development_dependency 'rspec'
|
|
34
34
|
spec.add_development_dependency 'rspec-html-matchers'
|
|
35
|
-
spec.add_development_dependency 'rubocop'
|
|
36
|
-
spec.add_development_dependency 'rubocop-rspec'
|
|
35
|
+
spec.add_development_dependency 'rubocop'
|
|
36
|
+
spec.add_development_dependency 'rubocop-rspec'
|
|
37
37
|
spec.add_development_dependency 'rubocop-rake'
|
|
38
38
|
spec.add_development_dependency 'simplecov'
|
|
39
39
|
spec.add_development_dependency 'webmock', '~> 3.14'
|
data/lib/.DS_Store
ADDED
|
Binary file
|
|
@@ -48,8 +48,6 @@ module GeoCombine
|
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def self.from_envelope(envelope)
|
|
51
|
-
return if envelope.nil?
|
|
52
|
-
|
|
53
51
|
envelope = envelope[/.*ENVELOPE\(([^)]*)/, 1].split(',')
|
|
54
52
|
new(
|
|
55
53
|
west: envelope[0],
|
|
@@ -63,8 +61,6 @@ module GeoCombine
|
|
|
63
61
|
# @param [String] spatial w,s,e,n or w s e n
|
|
64
62
|
# @param [String] delimiter "," or " "
|
|
65
63
|
def self.from_string_delimiter(spatial, delimiter: ',')
|
|
66
|
-
return if spatial.nil?
|
|
67
|
-
|
|
68
64
|
spatial = spatial.split(delimiter)
|
|
69
65
|
new(
|
|
70
66
|
west: spatial[0],
|
|
@@ -32,7 +32,7 @@ module GeoCombine
|
|
|
32
32
|
layer_slug_s: @metadata['name'],
|
|
33
33
|
solr_geom: envelope,
|
|
34
34
|
dc_subject_sm: subjects,
|
|
35
|
-
dct_references_s: external_references.to_json
|
|
35
|
+
dct_references_s: external_references.to_json,
|
|
36
36
|
dc_format_s: downloadable? ? 'ZIP' : nil # TODO: we only allow direct ZIP file downloads
|
|
37
37
|
}.compact
|
|
38
38
|
end
|
|
@@ -42,6 +42,7 @@ module GeoCombine
|
|
|
42
42
|
metadata.each do |key, value|
|
|
43
43
|
translate_formats(key, value)
|
|
44
44
|
enhance_subjects(key, value)
|
|
45
|
+
infer_geometry_type_from_subject(key, value)
|
|
45
46
|
format_proper_date(key, value)
|
|
46
47
|
fields_should_be_array(key, value)
|
|
47
48
|
translate_geometry_type(key, value)
|
|
@@ -55,20 +56,29 @@ module GeoCombine
|
|
|
55
56
|
metadata.to_json(options)
|
|
56
57
|
end
|
|
57
58
|
|
|
59
|
+
# True if the GeoBlacklight-Schema document is valid
|
|
60
|
+
# @return [Boolean]
|
|
61
|
+
def valid?
|
|
62
|
+
validate!
|
|
63
|
+
true
|
|
64
|
+
rescue StandardError
|
|
65
|
+
false
|
|
66
|
+
end
|
|
67
|
+
|
|
58
68
|
##
|
|
59
69
|
# Validates a GeoBlacklight-Schema json document
|
|
60
70
|
# @return [Boolean]
|
|
61
|
-
def
|
|
62
|
-
JSON::Validator.validate!(schema, to_json, fragment: '#/definitions/layer')
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
def validate!
|
|
72
|
+
JSON::Validator.validate!(schema, to_json, fragment: '#/definitions/layer')
|
|
73
|
+
validate_references!
|
|
74
|
+
validate_spatial!
|
|
65
75
|
end
|
|
66
76
|
|
|
67
77
|
##
|
|
68
78
|
# Validate dct_references_s
|
|
69
79
|
# @return [Boolean]
|
|
70
|
-
def
|
|
71
|
-
return
|
|
80
|
+
def validate_references!
|
|
81
|
+
return unless metadata.key?('dct_references_s') # Not required
|
|
72
82
|
|
|
73
83
|
begin
|
|
74
84
|
ref = JSON.parse(metadata['dct_references_s'])
|
|
@@ -83,8 +93,8 @@ module GeoCombine
|
|
|
83
93
|
end
|
|
84
94
|
end
|
|
85
95
|
|
|
86
|
-
def
|
|
87
|
-
GeoCombine::BoundingBox.from_envelope(metadata['solr_geom']).valid?
|
|
96
|
+
def validate_spatial!
|
|
97
|
+
raise GeoCombine::Exceptions::InvalidGeometry unless GeoCombine::BoundingBox.from_envelope(metadata['solr_geom']).valid?
|
|
88
98
|
end
|
|
89
99
|
|
|
90
100
|
private
|
|
@@ -106,6 +116,17 @@ module GeoCombine
|
|
|
106
116
|
metadata[key] = geometry_types[value]
|
|
107
117
|
end
|
|
108
118
|
|
|
119
|
+
##
|
|
120
|
+
# Enhances empty 'layer_geom_type_s' field by populating from related subject
|
|
121
|
+
def infer_geometry_type_from_subject(key, value)
|
|
122
|
+
return unless key == 'layer_geom_type_s' && value.blank?
|
|
123
|
+
|
|
124
|
+
# If any subjects match a known geometry type, use the first that does as the geometry type
|
|
125
|
+
metadata['dc_subject_sm'].find { |subject| geometry_types.value?(subject.capitalize) }&.tap do |subject|
|
|
126
|
+
metadata[key] = subject.capitalize
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
109
130
|
##
|
|
110
131
|
# Enhances the 'dc_subject_sm' field by translating subjects to ISO topic
|
|
111
132
|
# categories
|
|
@@ -163,7 +184,7 @@ module GeoCombine
|
|
|
163
184
|
metadata.except!(*DEPRECATED_KEYS_V1)
|
|
164
185
|
|
|
165
186
|
# ensure we have a proper v1 record
|
|
166
|
-
|
|
187
|
+
validate!
|
|
167
188
|
end
|
|
168
189
|
|
|
169
190
|
def schema
|
|
@@ -11,31 +11,25 @@ module GeoCombine
|
|
|
11
11
|
class Harvester
|
|
12
12
|
attr_reader :ogm_path, :schema_version
|
|
13
13
|
|
|
14
|
-
# Non-metadata repositories that shouldn't be harvested
|
|
15
|
-
def self.denylist
|
|
16
|
-
[
|
|
17
|
-
'GeoCombine',
|
|
18
|
-
'aardvark',
|
|
19
|
-
'metadata-issues',
|
|
20
|
-
'ogm_utils-python',
|
|
21
|
-
'opengeometadata.github.io',
|
|
22
|
-
'opengeometadata-rails',
|
|
23
|
-
'gbl-1_to_aardvark'
|
|
24
|
-
]
|
|
25
|
-
end
|
|
26
|
-
|
|
27
14
|
# GitHub API endpoint for OpenGeoMetadata repositories
|
|
28
15
|
def self.ogm_api_uri
|
|
29
16
|
URI('https://api.github.com/orgs/opengeometadata/repos?per_page=1000')
|
|
30
17
|
end
|
|
31
18
|
|
|
19
|
+
# Initialize a new harvester
|
|
20
|
+
# @param ogm_path [String] path to the directory where repositories will be cloned
|
|
21
|
+
# @param skip_repos [Array<String>] list of repository names to skip
|
|
22
|
+
# @param schema_version [String] schema version to filter repositories by
|
|
23
|
+
# @param logger [Logger] logger to use for logging messages
|
|
32
24
|
def initialize(
|
|
33
|
-
ogm_path
|
|
25
|
+
ogm_path:,
|
|
26
|
+
skip_repos: ENV.fetch('OGM_SKIP_REPOS', '').split(',').map(&:strip),
|
|
34
27
|
schema_version: ENV.fetch('SCHEMA_VERSION', 'Aardvark'),
|
|
35
28
|
logger: GeoCombine::Logger.logger
|
|
36
29
|
)
|
|
37
30
|
@ogm_path = ogm_path
|
|
38
31
|
@schema_version = schema_version
|
|
32
|
+
@skip_repos = skip_repos
|
|
39
33
|
@logger = logger
|
|
40
34
|
end
|
|
41
35
|
|
|
@@ -53,9 +47,16 @@ module GeoCombine
|
|
|
53
47
|
|
|
54
48
|
doc = JSON.parse(File.read(path))
|
|
55
49
|
[doc].flatten.each do |record|
|
|
56
|
-
# skip indexing if this record has a different schema version than what we want
|
|
57
50
|
record_schema = record['gbl_mdVersion_s'] || record['geoblacklight_version']
|
|
58
51
|
record_id = record['layer_slug_s'] || record['dc_identifier_s']
|
|
52
|
+
|
|
53
|
+
# skip indexing if no identifiable schema version
|
|
54
|
+
unless record_schema
|
|
55
|
+
@logger.debug "skipping #{record_id || path}; no schema version declared in record"
|
|
56
|
+
next
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# skip indexing if this record has a different schema version than what we want
|
|
59
60
|
if record_schema != @schema_version
|
|
60
61
|
@logger.debug "skipping #{record_id}; schema version #{record_schema} doesn't match #{@schema_version}"
|
|
61
62
|
next
|
|
@@ -87,19 +88,20 @@ module GeoCombine
|
|
|
87
88
|
end
|
|
88
89
|
|
|
89
90
|
# Clone a repository via git
|
|
90
|
-
#
|
|
91
|
+
# Return the name of the repository cloned, or nil if skipped
|
|
91
92
|
def clone(repo)
|
|
92
93
|
repo_path = File.join(@ogm_path, repo)
|
|
93
94
|
repo_info = repository_info(repo)
|
|
94
95
|
repo_url = "https://github.com/OpenGeoMetadata/#{repo}.git"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
repo_schemas = Array(repo_info.dig('custom_properties', 'supported_schemas'))
|
|
97
|
+
|
|
98
|
+
# Skip if exists, archived, empty, or different schema
|
|
99
|
+
return @logger.warn "skipping clone to #{repo_path}; directory exists" if File.directory? repo_path
|
|
100
|
+
return @logger.warn "repository is archived: #{repo_url}" if repo_info['archived']
|
|
101
|
+
return @logger.warn "repository is empty: #{repo_url}" if repo_info['size'].zero?
|
|
102
|
+
unless repo_schemas.include? @schema_version
|
|
103
|
+
return @logger.warn "repository #{repo_url} clone to #{repo_path}; repository properties don't include schema version #{@schema_version} (found #{repo_schemas.join(', ')})"
|
|
100
104
|
end
|
|
101
|
-
@logger.warn "repository is archived: #{repo_url}" if repo_info['archived']
|
|
102
|
-
@logger.warn "repository is empty: #{repo_url}" if repo_info['size'].zero?
|
|
103
105
|
|
|
104
106
|
Git.clone(repo_url, nil, path: ogm_path, depth: 1)
|
|
105
107
|
@logger.info "cloned #{repo_url} to #{repo_path}"
|
|
@@ -119,12 +121,14 @@ module GeoCombine
|
|
|
119
121
|
# List of repository names to harvest
|
|
120
122
|
def repositories
|
|
121
123
|
@repositories ||= JSON.parse(Net::HTTP.get(self.class.ogm_api_uri))
|
|
124
|
+
.filter { |repo| Array(repo.dig('custom_properties', 'supported_schemas')).include? @schema_version }
|
|
122
125
|
.filter { |repo| repo['size'].positive? }
|
|
123
126
|
.reject { |repo| repo['archived'] }
|
|
127
|
+
.reject { |repo| @skip_repos.include?(repo['name']) }
|
|
124
128
|
.map { |repo| repo['name'] }
|
|
125
|
-
.reject { |name| self.class.denylist.include? name }
|
|
126
129
|
end
|
|
127
130
|
|
|
131
|
+
# Fetch repository metadata from GitHub API
|
|
128
132
|
def repository_info(repo_name)
|
|
129
133
|
JSON.parse(Net::HTTP.get(URI("https://api.github.com/repos/opengeometadata/#{repo_name}")))
|
|
130
134
|
end
|
data/lib/geo_combine/ogp.rb
CHANGED
|
@@ -8,6 +8,7 @@ module GeoCombine
|
|
|
8
8
|
class OGP
|
|
9
9
|
class InvalidMetadata < RuntimeError; end
|
|
10
10
|
include GeoCombine::Formatting
|
|
11
|
+
|
|
11
12
|
attr_reader :metadata
|
|
12
13
|
|
|
13
14
|
##
|
|
@@ -123,7 +124,7 @@ module GeoCombine
|
|
|
123
124
|
# Builds a Solr Envelope using CQL syntax
|
|
124
125
|
# @return [String]
|
|
125
126
|
def envelope
|
|
126
|
-
raise ArgumentError unless west
|
|
127
|
+
raise ArgumentError unless west.between?(-180, 180) &&
|
|
127
128
|
east >= -180 && east <= 180 &&
|
|
128
129
|
north >= -90 && north <= 90 &&
|
|
129
130
|
south >= -90 && south <= 90 &&
|
|
@@ -144,6 +145,15 @@ module GeoCombine
|
|
|
144
145
|
GeoCombine::Fgdc.new(metadata['FgdcText']) if metadata['FgdcText']
|
|
145
146
|
end
|
|
146
147
|
|
|
148
|
+
SLUG_STRIP_VALUES = %w[
|
|
149
|
+
SDE_DATA.
|
|
150
|
+
SDE.
|
|
151
|
+
SDE2.
|
|
152
|
+
GISPORTAL.GISOWNER01.
|
|
153
|
+
GISDATA.
|
|
154
|
+
MORIS.
|
|
155
|
+
].freeze
|
|
156
|
+
|
|
147
157
|
private
|
|
148
158
|
|
|
149
159
|
##
|
|
@@ -207,15 +217,6 @@ module GeoCombine
|
|
|
207
217
|
sluggify(filter_name(name))
|
|
208
218
|
end
|
|
209
219
|
|
|
210
|
-
SLUG_STRIP_VALUES = %w[
|
|
211
|
-
SDE_DATA.
|
|
212
|
-
SDE.
|
|
213
|
-
SDE2.
|
|
214
|
-
GISPORTAL.GISOWNER01.
|
|
215
|
-
GISDATA.
|
|
216
|
-
MORIS.
|
|
217
|
-
].freeze
|
|
218
|
-
|
|
219
220
|
def filter_name(name)
|
|
220
221
|
# strip out schema and usernames
|
|
221
222
|
SLUG_STRIP_VALUES.each do |strip_val|
|
data/lib/geo_combine/version.rb
CHANGED
data/lib/tasks/geo_combine.rake
CHANGED
|
@@ -11,20 +11,26 @@ require 'geo_combine/geo_blacklight_harvester'
|
|
|
11
11
|
namespace :geocombine do
|
|
12
12
|
desc 'Clone OpenGeoMetadata repositories'
|
|
13
13
|
task :clone, [:repo] do |_t, args|
|
|
14
|
-
|
|
14
|
+
ogm_path = ENV.fetch('OGM_PATH', 'tmp/opengeometadata')
|
|
15
|
+
|
|
16
|
+
harvester = GeoCombine::Harvester.new(ogm_path: ogm_path)
|
|
15
17
|
args[:repo] ? harvester.clone(args.repo) : harvester.clone_all
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
desc '"git pull" OpenGeoMetadata repositories'
|
|
19
21
|
task :pull, [:repo] do |_t, args|
|
|
20
|
-
|
|
22
|
+
ogm_path = ENV.fetch('OGM_PATH', 'tmp/opengeometadata')
|
|
23
|
+
|
|
24
|
+
harvester = GeoCombine::Harvester.new(ogm_path: ogm_path)
|
|
21
25
|
args[:repo] ? harvester.pull(args.repo) : harvester.pull_all
|
|
22
26
|
end
|
|
23
27
|
|
|
24
28
|
desc 'Index all JSON documents except Layers.json'
|
|
25
|
-
task :index do
|
|
26
|
-
|
|
29
|
+
task :index, [:ogm_path] => [:environment] do |_t, args|
|
|
30
|
+
ogm_path = args.ogm_path || ENV.fetch('OGM_PATH', 'tmp/opengeometadata')
|
|
31
|
+
|
|
27
32
|
indexer = GeoCombine::Indexer.new
|
|
33
|
+
harvester = GeoCombine::Harvester.new(ogm_path: ogm_path)
|
|
28
34
|
indexer.index(harvester.docs_to_index)
|
|
29
35
|
end
|
|
30
36
|
|