Skip to content

Commit

Permalink
Merge pull request #163 from inbo/feature_type
Browse files Browse the repository at this point in the history
Fix #131: eventRemarks + use fixed `camera trap` for samplingProtocol
  • Loading branch information
peterdesmet authored Sep 13, 2022
2 parents 8589075 + 41a2233 commit c396f4e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions inst/sql/dwc_audubon.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ WITH observations_media AS (
SELECT
obs_med.observationID AS occurrenceID,
-- provider: can be org managing the platform, but that info is not available
{media_license} AS rights,
{media_license} AS `dcterm:rights`,
obs_med.mediaID AS identifier,
CASE
WHEN obs_med.fileMediatype LIKE '%video%' THEN 'MovingImage'
ELSE 'StillImage'
END AS type,
END AS `dc:type`,
obs_med._id AS providerManagedID,
CASE
WHEN obs_med.favourite AND obs_med.comments != '' THEN 'media marked as favourite | ' || obs_med.comments
Expand Down
25 changes: 15 additions & 10 deletions inst/sql/dwc_occurrence.sql
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,29 @@ SELECT
obs.deploymentID AS parentEventID,
strftime('%Y-%m-%dT%H:%M:%SZ', datetime(obs.timestamp, 'unixepoch')) AS eventDate,
dep.habitat AS habitat,
'camera trap' ||
CASE
WHEN dep.baitUse IS 'none' THEN ' without bait'
WHEN dep.baitUse IS NOT NULL THEN ' with bait'
ELSE ''
END AS samplingProtocol,
'camera trap' AS samplingProtocol,
strftime('%Y-%m-%dT%H:%M:%SZ', datetime(dep.start, 'unixepoch')) ||
'/' ||
strftime('%Y-%m-%dT%H:%M:%SZ', datetime(dep.end, 'unixepoch')) AS samplingEffort, -- Duration of deployment
CASE
WHEN dep.baitUse IS 'none' THEN 'camera trap without bait'
WHEN dep.baitUse IS NOT NULL THEN 'camera trap with ' || dep.baitUse || ' bait'
ELSE 'camera trap'
END ||
CASE
WHEN dep.featureType IS 'none' THEN ''
WHEN dep.featureType IS 'other' THEN ' near other feature'
WHEN dep.featureType IS NOT NULL THEN ' near ' || dep.featureType
ELSE ''
END ||
COALESCE(
dep.comments || ' | tags: ' || dep.tags,
'tags: ' || dep.tags,
dep.comments
' | tags: ' || dep.tags || ' | ' || dep.comments,
' | tags: ' || dep.tags,
' | ' || dep.comments
) AS eventRemarks,
-- LOCATION
dep.locationID AS locationID,
dep.locationName AS locality,
dep.featureType AS locationRemarks,
dep.latitude AS decimalLatitude,
dep.longitude AS decimalLongitude,
'WGS84' AS geodeticDatum,
Expand Down

0 comments on commit c396f4e

Please sign in to comment.