-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sketch initial migrator for v1 to aardvark
Note that the fixture called aardvark hasn't actually been converted yet, is just a straight up copy of the full_geoblacklight fixutre refs #121
- Loading branch information
1 parent
c62a0d3
commit aadfc78
Showing
5 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module GeoCombine | ||
module Migrators | ||
# migrates the v1 schema to the aardvark schema | ||
class V1AardvarkMigrator | ||
attr_reader :v1_hash | ||
|
||
# @param v1_hash [Hash] parsed json in the v1 schema | ||
def initialize(v1_hash:) | ||
@v1_hash = v1_hash | ||
end | ||
|
||
def run | ||
v1_hash | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"geoblacklight_version":"1.0", | ||
"dc_identifier_s":"http://purl.stanford.edu/cz128vq0535", | ||
"dc_title_s":"2005 Rural Poverty GIS Database: Uganda", | ||
"dc_description_s":"This polygon shapefile contains 2005 poverty data for 855 rural subcounties in Uganda. These data are intended for researchers, students, policy makers and the general public for reference and mapping purposes, and may be used for basic applications such as viewing, querying, and map output production.", | ||
"dc_rights_s":"Public", | ||
"dct_provenance_s":"Stanford", | ||
"dct_references_s":"{\"http://schema.org/url\":\"http://purl.stanford.edu/cz128vq0535\",\"http://schema.org/downloadUrl\":\"http://stacks.stanford.edu/file/druid:cz128vq0535/data.zip\",\"http://www.loc.gov/mods/v3\":\"http://purl.stanford.edu/cz128vq0535.mods\",\"http://www.isotc211.org/schemas/2005/gmd/\":\"http://opengeometadata.stanford.edu/metadata/edu.stanford.purl/druid:cz128vq0535/iso19139.xml\",\"http://www.w3.org/1999/xhtml\":\"http://opengeometadata.stanford.edu/metadata/edu.stanford.purl/druid:cz128vq0535/default.html\",\"http://www.opengis.net/def/serviceType/ogc/wfs\":\"https://geowebservices.stanford.edu/geoserver/wfs\",\"http://www.opengis.net/def/serviceType/ogc/wms\":\"https://geowebservices.stanford.edu/geoserver/wms\"}", | ||
"layer_id_s":"druid:cz128vq0535", | ||
"layer_slug_s":"stanford-cz128vq0535", | ||
"layer_geom_type_s":"Polygon", | ||
"layer_modified_dt":"2015-01-13T18:46:38Z", | ||
"dc_format_s":"Shapefile", | ||
"dc_language_s":"English", | ||
"dc_type_s":"Dataset", | ||
"dc_publisher_s":"Uganda Bureau of Statistics", | ||
"dc_creator_sm":[ | ||
"Uganda Bureau of Statistics" | ||
], | ||
"dc_subject_sm":[ | ||
"Poverty", | ||
"Statistics" | ||
], | ||
"dct_issued_s":"2005", | ||
"dct_temporal_sm":[ | ||
"2005" | ||
], | ||
"dct_spatial_sm":[ | ||
"Uganda" | ||
], | ||
"solr_geom":"ENVELOPE(29.572742, 35.000308, 4.234077, -1.478794)", | ||
"solr_year_i":2005 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
spec/lib/geo_combine/migrators/v1_aardvark_migrator_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
RSpec.describe GeoCombine::Migrators::V1AardvarkMigrator do | ||
include JsonDocs | ||
|
||
describe '#run' do | ||
it 'migrates keys' do | ||
input_hash = JSON.parse(full_geoblacklight) | ||
expected_output = JSON.parse(full_geoblacklight_aardvark) | ||
expect(described_class.new(v1_hash: input_hash).run).to eq(expected_output) | ||
end | ||
end | ||
end |