Open ddachs opened 3 hours ago
The error is caused by extra columns in the CSV files in example_DP.zip
that are not part of the Camtrap DP standard. Currently frictionless cannot (and according to the standard should not) deal with those.
The erroneous columns are:
_id
at the end_id
at the endTRAPPER should not add these columns (ping @kbubnicki). Note also that metadata.json
should be named datapackage.json
We had a similar issue with Agouti, and I provided a temporary fix in R: https://gist.github.com/peterdesmet/fa9e6dfbd3020055d137d641492c47a3
For this case, you should do:
# My files
directory <- "~/Downloads/example_DP"
# Load libraries
library(readr)
library(dplyr)
# Read, fix and write media
media <- read_csv(
file.path(directory, "media.csv"),
col_types = cols(.default = "c")
)
media <-
media %>%
dplyr::select(-`_id`)
readr::write_csv(media, file.path(directory, "media.csv"))
# Read, fix and write observations
obs <- read_csv(
file.path(directory, "observations.csv"),
col_types = cols(.default = "c")
)
obs <-
obs %>%
dplyr::select(-`_id`)
readr::write_csv(obs, file.path(directory, "observations.csv"))
# Read package
library(camtrapdp)
datapackage_path <- file.path(directory, "metadata.json")
package <- camtrapdp::read_camtrapdp(datapackage_path)
With some packages I get an error, when using the read_camtrapdp() function:
My camtrapDP output originates from TRAPPER, but it is not always the case with TRAPPER DPs. I cannot spot differences between working and failing packages.
It seems, that the error happens in the frictionless:::read_from_path function. I tried executing read_camtrapdp function step by step, but eventually the purrr::map_df function worked just fine with paths as argument, wich is confusing to me. Maybe others have better luck, finding the problem.
example_DP.zip