sb_sync_event()
exports data from a Smartabase event form using the
Smartabase API. The user must supply a timestamp in unix format (i.e.
milliseconds since 1970-01-01) and sb_sync_event()
will return event data
that has been inserted or updated since that time.
sb_sync_event()
also attaches a new_sync_time
attribute to the returned
tibble. This attribute can then be stripped from the tibble and fed into a
subsequent call of sb_sync_event()
via the last_sync_time
argument.
Usage
sb_sync_event(
form,
last_sync_time,
url,
username,
password,
...,
filter = sb_sync_event_filter(),
option = sb_sync_event_option()
)
Arguments
- form
Name of Smartabase event form
- last_sync_time
UNIX time (time in milliseconds since 1970-01-01) as an integer
- url
Smartabase url e.g. "example.smartabase.com/site"
- username
Smartabase username
- password
Smartabase password
- ...
These dots are for future extensions and must be empty
- filter
More filters accessible via
sb_sync_event_filter()
object- option
More options accessible via
sb_sync_event_option()
object
Details
A common use case for smartabaseR
is to help automate certain data
wrangling and/or modelling tasks in Smartabase. By running sb_sync_event()
on a schedule (i.e. a 15 minute cron job), we can write logic that only
triggers when newly modified event data is discovered. The idea is to take
the new_sync_time
value returned from sb_sync_event()
and feed it back
into a subsequent call of sb_sync_event()
via the last_sync_time
argument.
Filters
There are also a range extra filters than can be supplied to the filter
argument. In order to reduce argument clutter in sb_sync_event()
, all
optional filters must be generated by the
sb_sync_event_filter()
function. Please see sb_sync_event_filter()
for more details.
Options
There are also a range extra options than can be supplied to the option
argument. In order to reduce argument clutter in sb_sync_event()
, all
options must be generated by the sb_sync_event_option()
function. Please
see sb_sync_event_option()
for more details.
See also
sb_get_profile()
for profile data.
sb_get_user()
for user data.
sb_sync_event()
to synchronise with an event form.
Other export functions:
sb_get_event()
,
sb_get_profile()
,
sb_get_user()
Examples
if (FALSE) { # \dontrun{
# Get any wellness data that has been modified since Jan 01 2023
(1672531200000):
new_wellness_data <- sb_sync_event(
form = "Daily Wellness",
last_sync_time = 1672531200000,
url = "example.smartabase.com/site",
username = "example.user",
password = "examplePassword"
)
} # }