Skip to content

Commit

Permalink
Include georeferencing in processed values
Browse files Browse the repository at this point in the history
  • Loading branch information
charvolant committed Jun 17, 2020
1 parent f465d95 commit dd5f61a
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class LocationProcessor extends Processor {
//process state/country values if coordinates not determined
processStateCountryValues(raw, processed, assertions)

//Process georeference information
processGeoreferenceValues(raw, processed, assertions)

//create flag if no location info was supplied for this record
checkLocationSupplied(raw, processed, assertions)

Expand Down Expand Up @@ -161,6 +164,24 @@ class LocationProcessor extends Processor {
}
}

/**
* Process any georeference infomaation
*
* @param raw The original record
* @param processed Processed values
* @param assertions The current list of assertions
*/
private def processGeoreferenceValues(raw: FullRecord, processed: FullRecord, assertions: ArrayBuffer[QualityAssertion]) {
// georeferencedDate is handled by the event prooessor
// processed.location.georeferencedDate = raw.location.georeferencedDate
processed.location.georeferencedBy = raw.location.georeferencedBy
processed.location.georeferenceProtocol = raw.location.georeferenceProtocol
processed.location.georeferenceRemarks = raw.location.georeferenceRemarks
processed.location.georeferenceSources = raw.location.georeferenceSources
processed.location.georeferenceVerificationStatus = raw.location.georeferenceVerificationStatus
}


/**
* Validation checks
*
Expand Down
33 changes: 33 additions & 0 deletions src/test/scala/au/org/ala/biocache/ProcessLocationTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -959,4 +959,37 @@ class ProcessLocationTest extends ConfigFunSuite with BeforeAndAfterAll {
processed.location.decimalLongitude
}
}


test("georeferencing processing") {
var raw = new FullRecord
var processed = new FullRecord
raw.location.decimalLatitude="-29.04"
raw.location.decimalLongitude="167.95"
raw.location.georeferencedBy = "Minnie Bannister"
raw.location.georeferencedDate = "2020-06-12"
raw.location.georeferenceProtocol = "GPS"
raw.location.georeferenceRemarks = "This is a test"
raw.location.georeferenceSources = "The back of an envelope"
raw.location.georeferenceVerificationStatus = "unverified"
var qas = (new LocationProcessor).process("test", raw, processed)

expectResult(raw.location.georeferencedBy){
processed.location.georeferencedBy
}
assert(processed.location.georeferencedDate == null)
expectResult(raw.location.georeferenceProtocol){
processed.location.georeferenceProtocol
}
expectResult(raw.location.georeferenceRemarks){
processed.location.georeferenceRemarks
}
expectResult(raw.location.georeferenceSources){
processed.location.georeferenceSources
}
expectResult(raw.location.georeferenceVerificationStatus){
processed.location.georeferenceVerificationStatus
}
}

}

0 comments on commit dd5f61a

Please sign in to comment.