inbo / camtraptor

Camtraptor is an R package to read, explore and visualize Camera Trap Data Packages (Camtrap DP)
https://inbo.github.io/camtraptor/
MIT License
10 stars 2 forks source link

Fix two `write_eml()` issues #290

Closed peterdesmet closed 1 year ago

peterdesmet commented 1 year ago

This PR fixes two issues I encountered when running write_eml() on a Camtrap DP 1.0 version of the entire MICA dataset.

  1. Conversion: move the entire first of package$sources to package$platform: write_eml() couldn't find platform$path before because only the title was copied.
  2. Use a simpler way to arrange the contributors on a provided order of names. It errored before.
  3. Always choose taxonID from taxonomy if available
peterdesmet commented 1 year ago

@damianooldoni I added one more commit with changes, please review. The rationale is:

If a Camtrap DP 0.1.6 dataset, then:

  1. observations has a taxonID
  2. package.taxonomy has taxonID (required field)
  3. join will result in taxonID.x and taxonID.y
  4. keep only the taxonID.y (from taxonomy), rename and drop the taxonID.x

If a Camtrap DP 1.0 dataset, then:

  1. observations does not have a taxonID (because this is before conversion)
  2. package.taxonomy might have a taxonID
  3. join will result in taxonID or no taxonID
  4. conversion will always add taxonID: https://github.com/inbo/camtraptor/blob/545f72f6b19ca23c22839646feb54970206a2966/R/zzz.R#L817