This function check that all interviews in the dataset were made within a distance from a sampled point. It is based on a GIS shapefile providing the sample points for the assessment. The function is based on the GPS data filled in the survey to determine their location. There is an option to automatically mark for deletion the surveys which are to far away from a sampled point.

One internal function "make_GeodesicBuffer" used to create the buffers is created by Valentin https://stackoverflow.com/users/5193830/valentin

isInterviewAtTheSamplePoint(
  ds = NULL,
  dsCoordinates = NULL,
  sampledPoints = NULL,
  buffer = 10,
  surveyConsent = NULL,
  reportingColumns = c(enumeratorID, uniqueID),
  deleteIsInterviewAtTheSamplePoint = FALSE
)

Arguments

ds

dataset containing the survey (from kobo): data.frame

dsCoordinates

name of the fields from the dataset where the information about the GPS coordinates are stored: list of string (c('Long','Lat'))

sampledPoints

dataset containing the shapefile of the households sampled - Regardless the projection used for the shapefile, it is transformed to WGS84

buffer

value in meter to determine the buffer from a sampled point which is acceptable: integer

surveyConsent

name of the field in the dataset where the survey consent is stored: string

reportingColumns

(Optional, by default it is built from the enumeratorID and the UniqueID) name of the columns from the dataset you want in the result: list of string (c('col1','col2',...))

deleteIsInterviewAtTheSamplePoint

(Optional, by default set as FALSE) if TRUE, the survey in error will be marked as 'deletedIsInterviewAtTheSamplePoint': boolean (TRUE/FALSE)

uniqueID

name of the field where the survey unique ID is stored: string

enumeratorID

name of the field where the enumerator ID is stored: string

Value

dst same dataset as the inputed one but with survey marked for deletion if errors are found and delete=TRUE (or NULL)

ret_log list of the errors found (or NULL)

var a list of value (or NULL)

graph graphical representation of the results (or NULL)

Author

Yannick Pascaud

Examples

{ ds <- HighFrequencyChecks::sample_dataset sampledPoints <- HighFrequencyChecks::SamplePts dsCoordinates <- c("X_gps_reading_longitude","X_gps_reading_latitude") buffer <- 10 surveyConsent <- "survey_consent" uniqueID <- "X_uuid" enumeratorID <- "enumerator_id" reportingColumns <- c(enumeratorID, uniqueID) list[dst,ret_log,var,graph] <- isInterviewAtTheSamplePoint(ds=ds, dsCoordinates=dsCoordinates, sampledPoints=sampledPoints, buffer=buffer, surveyConsent=surveyConsent, reportingColumns=reportingColumns, deleteIsInterviewAtTheSamplePoint=FALSE) head(ret_log, 10) }
#> Warning: CRS object has no comment
#> Warning: CRS object has comment, which is lost in output
#> enumerator_id X_uuid Outside #> 44 14 0636c440-1b81-4cf2-9f56-9e3b6d378047 NOk #> 45 3 2ab24867-db88-40f2-ba97-b5c7b6da8f1d NOk #> 46 76 0a3bcffb-0cba-4661-ac98-3c28b12b4ec8 NOk #> 65 102 8fd35129-6566-4200-a9b7-7e1a16825bc2 NOk #> 112 16 f19a65d7-d78e-4887-8d87-6ac8d0b35ee5 NOk #> 113 42 NOk #> 114 80 ca219404-8ebe-4855-b391-4e6e3dd71eec NOk #> 115 83 13ece80f-f607-46a6-874d-99bf44c7a477 NOk #> 116 80 7d9162ca-72bb-4c40-b908-5de3b0e768a5 NOk #> 117 102 baceb291-a351-40a8-9587-150eb4312fe2 NOk