Skip to content

Commit

Permalink
support schema 4.0 geolocation information. datacite/datacite#505
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Sep 8, 2018
1 parent c70a5e1 commit 2df024c
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ GEM
api-pagination (4.8.1)
arel (9.0.0)
aws-eventstream (1.0.1)
aws-partitions (1.102.0)
aws-sdk-core (3.26.0)
aws-partitions (1.103.0)
aws-sdk-core (3.27.0)
aws-eventstream (~> 1.0)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
aws-sdk-kms (1.8.0)
aws-sdk-core (~> 3)
aws-sdk-kms (1.9.0)
aws-sdk-core (~> 3, >= 3.26.0)
aws-sigv4 (~> 1.0)
aws-sdk-s3 (1.18.0)
aws-sdk-core (~> 3, >= 3.21.2)
aws-sdk-s3 (1.19.0)
aws-sdk-core (~> 3, >= 3.26.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.0)
aws-sdk-sqs (1.5.0)
aws-sdk-core (~> 3)
aws-sdk-sqs (1.6.0)
aws-sdk-core (~> 3, >= 3.26.0)
aws-sigv4 (~> 1.0)
aws-sigv4 (1.0.3)
base32-url (0.5)
Expand All @@ -93,7 +93,7 @@ GEM
latex-decode (~> 0.0)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bolognese (0.13.6)
bolognese (0.14.1)
activesupport (>= 4.2.5, < 6)
benchmark_methods (~> 0.7)
bibtex-ruby (~> 4.1)
Expand Down Expand Up @@ -132,7 +132,7 @@ GEM
simplecov (<= 0.13)
coderay (1.1.2)
colorize (0.8.1)
commonmarker (0.17.11)
commonmarker (0.17.12)
ruby-enum (~> 0.5)
concurrent-ruby (1.0.5)
countries (2.1.4)
Expand Down Expand Up @@ -181,10 +181,10 @@ GEM
erubi (1.7.1)
excon (0.62.0)
facets (3.1.0)
factory_bot (4.11.0)
factory_bot (4.11.1)
activesupport (>= 3.0.0)
factory_bot_rails (4.11.0)
factory_bot (~> 4.11.0)
factory_bot_rails (4.11.1)
factory_bot (~> 4.11.1)
railties (>= 3.0.0)
faker (1.9.1)
i18n (>= 0.7)
Expand Down
140 changes: 140 additions & 0 deletions spec/fixtures/files/schema_4.0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<?xml version="1.0" ?>
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
<identifier identifierType="DOI">10.6071/Z7WC73</identifier>
<creators>
<creator>
<creatorName>Bales, Roger</creatorName>
<affiliation>UC Merced</affiliation>
</creator>
<creator>
<creatorName>Meadows, Matt</creatorName>
<affiliation>UC Merced</affiliation>
</creator>
<creator>
<creatorName>Stacy, Erin</creatorName>
<nameIdentifier nameIdentifierScheme="ORCID" schemeURI="http://orcid.org/">0000-0002-8862-1404</nameIdentifier>
<affiliation>UC Merced</affiliation>
</creator>
<creator>
<creatorName>Conklin, Martha</creatorName>
<nameIdentifier nameIdentifierScheme="ORCID" schemeURI="http://orcid.org/">0000-0002-9627-2427</nameIdentifier>
<affiliation>UC Merced</affiliation>
</creator>
<creator>
<creatorName>Meng, Xiande</creatorName>
<affiliation>UC Merced</affiliation>
</creator>
<creator>
<creatorName>Southern Sierra Critical Zone Observatory, SSCZO</creatorName>
<affiliation>NSF</affiliation>
</creator>
</creators>
<titles>
<title>
Southern Sierra Critical Zone Observatory (SSCZO), Providence Creek
meteorological data, soil moisture and temperature, snow depth and air
temperature
</title>
</titles>
<publisher>UC Merced</publisher>
<publicationYear>2013</publicationYear>
<subjects>
<subject>Earth sciences</subject>
<subject>soil moisture</subject>
<subject>soil temperature</subject>
<subject>snow depth</subject>
<subject>air temperature</subject>
<subject>water balance</subject>
<subject>Nevada, Sierra (mountain range)</subject>
</subjects>
<fundingReferences>
<fundingReference>
<funderName>
National Science Foundation, Division of Earth Sciences, Critical Zone
Observatories
</funderName>
<awardNumber>1331939, 0725097</awardNumber>
</fundingReference>
</fundingReferences>
<contributors>
<contributor contributorType="ProjectLeader">
<contributorName>Bales, Roger</contributorName>
<affiliation>University of California, Merced</affiliation>
</contributor>
<contributor contributorType="DataCollector">
<contributorName>Meadows, Matt</contributorName>
<affiliation>University of California, Merced</affiliation>
</contributor>
<contributor contributorType="DataManager">
<contributorName>Meng, Xiande</contributorName>
<affiliation>University of California, Merced</affiliation>
</contributor>
<contributor contributorType="ResearchGroup">
<contributorName>Southern Sierra Critical Zone Observatory</contributorName>
</contributor>
</contributors>
<dates>
<date dateType="Updated">2014-10-17</date>
<date dateType="Available">2016-03-14T17:02:02Z</date>
</dates>
<language>en</language>
<resourceType resourceTypeGeneral="Dataset">dataset</resourceType>
<sizes>
<size>1799269709 bytes</size>
</sizes>
<version>2</version>
<rightsList>
<rights rightsURI="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International (CC BY 4.0)</rights>
</rightsList>
<descriptions>
<description descriptionType="Abstract">
Snow depth, soil moisture and soil temperature are measured at lower
Providence South facing (LowMetS) and North facing (LowMetN), Upper
Providence South facing (UpMetS), North facing (UpMetN) and Flat aspect
(UpMetF), and Subcatchment basin P301 (P301) with a wireless sensor
network, using a Campbell Scientific logger to control peripheral devices.
Snow depth is measured in the open, at the drip edge and under canopies.
Soil moisture and temperature are measured at 10, 30, 60 and 90 cm depths
coincident with the snow depth nodes. 10 watt solar panels provides power
for monitoring at 10 minute intervals. Raw data have been processed to
level 1 (QA/QC) and level 2 (gap-filled, derived) data. Time period: water
year 2008 through water year 2012 (version 1), 2013 to 2016 (version 2).
</description>
<description descriptionType="Methods">
Soil volumetric water content (VWC) and soil temperature measured using
Decagon Devices ECHO-TM at depths of 10, 30, 60, an 90 cm below the
mineral soil surface. Sensor now equivalent to 5TM
(http://www.decagon.com/soil-moisture-sensors/). Distance to snow/soil
surface and air temperature measured with Judd Communications ultrasonic
depth sensor, using analog control ( http://www.juddcom.com/ ). Data
control and storage on Campbell Scientific CR1000 datalogger, using
AM16/32B multiplexer ( http://www.campbellsci.com ). Program for data
acquisition are located on UC Merced-SNRI digital library (
https://eng.ucmerced.edu/snsjho/files/MHWG/Field/Southern...)
</description>
<description descriptionType="Other">
Lower and upper Providence Creek, Subcatchment basin P301.acde: white fir
drip edge; acuc: white fir under canopy; cdde: incense-cedar drip edge;
cduc: incense-cedar under canopy; open: open canopy; plde: sugar pine drip
edge; pluc: sugar pine under canopy; ppde: Ponderosa pine drip; edge ppde:
Ponderosa pine drip edge; ppuc: Ponderosa pine under canopy; ppuc:
Ponderosa pine under canopy; qkde: black oak drip edge; qkuc: black oak
under canopy
</description>
</descriptions>
<geoLocations>
<geoLocation>
<geoLocationPoint>
<pointLatitude>37.047756</pointLatitude>
<pointLongitude>-119.221094</pointLongitude>
</geoLocationPoint>
<geoLocationBox>
<westBoundLongitude>-119.211</westBoundLongitude>
<eastBoundLongitude>-119.182</eastBoundLongitude>
<southBoundLatitude>37.046</southBoundLatitude>
<northBoundLatitude>37.075</northBoundLatitude>
</geoLocationBox>
<geoLocationPlace>Providence Creek (Lower, Upper and P301)</geoLocationPlace>
</geoLocation>
</geoLocations>
</resource>
41 changes: 41 additions & 0 deletions spec/requests/dois_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,47 @@
end
end

context 'when the request uses schema 4.0' do
let(:xml) { Base64.strict_encode64(file_fixture('schema_4.0.xml').read) }
let(:valid_attributes) do
{
"data" => {
"type" => "dois",
"attributes" => {
"doi" => "10.14454/10703",
"url" => "http://www.bl.uk/pdf/patspec.pdf",
"xml" => xml,
"event" => "register"
},
"relationships"=> {
"client"=> {
"data"=> {
"type"=> "clients",
"id"=> client.symbol.downcase
}
}
}
}
}
end

before { post '/dois', params: valid_attributes.to_json, headers: headers }

it 'creates a Doi' do
expect(json.dig('data', 'attributes', 'doi')).to eq("10.14454/10703")
expect(json.dig('data', 'attributes', 'title')).to eq("Southern Sierra Critical Zone Observatory (SSCZO), Providence Creek\n meteorological data, soil moisture and temperature, snow depth and air\n temperature")
expect(json.dig('data', 'attributes', 'schema-version')).to eq("http://datacite.org/schema/kernel-4")
end

it 'returns status code 201' do
expect(response).to have_http_status(201)
end

it 'sets state to registered' do
expect(json.dig('data', 'attributes', 'state')).to eq("registered")
end
end

context 'when the request uses namespaced xml and the title changes' do
let(:title) { "Referee report. For: RESEARCH-3482 [version 5; referees: 1 approved, 1 approved with reservations]" }
let(:xml) { Base64.strict_encode64(file_fixture('ns0.xml').read) }
Expand Down

0 comments on commit 2df024c

Please sign in to comment.