get_new_submissions: Takes ODK data (data frame or csv) and downloads all missing...

Description Usage Arguments Details Value Examples

View source: R/get_new_submissions.R

Description

-Disclaimer: this function takes significantly longer than its ODATA equivalent get_new_submissions_odata. Only use it if the latter does not work with your use case.- Potential reasons for use are: a) Form on ODK is encrypted (ODATA is generally not supported for such forms) b) get_new_submissions_odata only gets new submissions that were submitted after the most recent submission in the data (missing instances "in between" are not considered)

Usage

1
get_new_submissions(csv = NULL, df = NULL, id_col, merge_data = TRUE)

Arguments

csv

Character that specifies the path to the csv file that is to be read. (Either csv or df must not null)

df

Data frame that, specifies the data frame that is to be read. (Either csv or df must be null)

id_col

Character that specifies the exact name of the instance ID in the df/csv.

merge_data

Boolean that specifies whether the new data shall be merged with the one that was given or not.

Details

This function uses the find_missing_instanceIDs function to find all submissions of an ODK form which are already stored on ODK Central but not loaded in your current data submissions and then downloads them. The new submissions can either be appended to the old data or be returned separately. To do so, the function makes use of ruODK's submission_get function which sends GET requests to ODK Centrals REST-API to retrieve data.

Value

Data frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
# ruODK needs to be set up for this function to work
repvisforODK::setup_ruODK(svc = 'example/svc.svc', un = 'exampleusername', pw = 'examplepassword', tz = 'Europe/Berlin', verbose = TRUE)

# load latest data
df <- ruODK::odata_submission_get()

# call function on fraction of the data and only return the missing part
new_data_df <- get_new_submissions(df = df[10:nrow(df), ], id_col = 'id')

## End(Not run)

lucidviews/repvisForODK documentation built on Feb. 13, 2022, 9:50 p.m.