Offline dataset publishing
As discussed in Publishing form data into server datasets, a wide range of data collection workflows are possible where data collected in one form can be made available as pre-load data inside the same, or any other form. Without offline server dataset publishing enabled, form data is published only to a server dataset when a form submission reaches the server, and then SurveyCTO Collect can download the latest version of that server dataset.
It is common that reliable Internet service is unavailable in the field, which is why Collect can always be used to fill out forms and store data offline. At the same time, data that would be required for pre-loading into forms on a device as part of a data collection workflow is typically generated through filling out forms on the same device. Thanks to offline dataset publishing, new pre-load data is available immediately — without the need to synchronize with the server.
As described in Introduction to advanced dataset usage, server datasets can be attached as pre-load data to multiple forms. With the addition of offline server dataset publishing, data captured offline using form A will then become immediately available for pre-loading into forms B and C. This will enable the design of advanced data collection workflows that are both complex and flexible but ultimately simpler for users to operate.
Enabling offline server dataset publishing
Once advanced offline functionality has been enabled on your server, you will need to configure offline server dataset publishing for each server dataset that requires it. To be able to configure a dataset for offline publishing, it must have at least one column header defined.
On the Design tab, under the Your forms and datasets section, perform the following steps:
- Find the server dataset you would like to turn on offline publishing for, and click Settings.
- Choose a field in the dataset to be the Unique ID field (this will already be set for case management and enumerator datasets).
- Enable Allow offline updates.
- Click Save.
You will also need to use the Publish into option for the same server dataset to configure publishing from a form into the dataset (detailed in Publishing form data into server datasets). Lastly, make the dataset's data available for pre-loading by using the Attach option to attach it to one or more forms.
Operating in the field
First, while you still have an Internet connection, download any forms that are configured to publish data into the datasets that make up your workflow in Collect's Get Blank Form menu. From there, you can go 100% offline (although, you may prefer to first test this by disabling wi-fi and cellular data service). All a Collect user needs to do is to fill out a form and finalize it in order to generate local changes in a server dataset. The server dataset publishing that takes place on the server while connected to the server is immediately locally mirrored on the device.
Open any form that has the server dataset in question attached to it, and the locally generated changes will be present. This data might be displayed in a field or choice list label, depending on what you have configured to be pre-loaded in your form design. Just like dataset publishing on the server, offline dataset publishing can create new data (e.g. add a new case to a cases dataset) or replace old data (e.g. change the status of a case to "completed"). It is important to note that finalized submissions published to local datasets cannot be reopened and edited in SurveyCTO Collect.
Reconciling offline changes
When data is first downloaded from the server, each server dataset will be identical. As forms are filled out using Collect while offline, server datasets will diverge from the original, and each user will have their own, different version of the data. Depending on your data collection workflow, this can pose some challenges, and you may decide to limit and control this as much as possible.
One way to manage this is through the case management feature, which facilitates the unique assignment of cases using enumerators or unique logins. If enumerators using Collect are able to identify themselves and only have access to their own cases, there will be no conflicts. Non-case management data collection workflows should also make use of unique IDs to facilitate pre-loading from the correct columns and rows in attached pre-load data, so different enumerators do not update the same row of the server dataset.
In addition, the potential for data loss can be mitigated through the use of the Add and Append field mapping options discussed in Publishing form data into server datasets. By adding numeric values together when publishing (where applicable), the sum will be the same irrespective of the order of addition. Similarly, when appending values, the order may vary, but each value should be present, avoiding data loss.
Lastly, the server's copy of the dataset will be reconciled with Collect's version whenever it syncs with the server. First, offline changes stored on Collect which have not reached the server will be applied to the server's version of the dataset. Once complete, Collect will receive a consolidated update from the server, which in addition to including the changes made on that device, may include differences since the last server sync (such as data from forms submitted by other enumerators). At the end of a server sync, Collect's copy of the dataset will match the version on the server.
Considerations when using SurveyCTO Desktop as a local server
If Collect synchronizes with SurveyCTO Desktop acting as a local server while it has local changes, those local changes could be in conflict with a new version of the dataset stored by Desktop. If Desktop had synchronized more recently with the server after Collect and therefore has a newer version of the dataset data than Collect does, that newer version of the dataset in Desktop can overwrite local changes that only exist on that device in Collect. For this reason, Collect users will be warned in this case about possible data loss and will have the option to skip updates to their local copy of the dataset during the sync with Desktop. Even if Collect users choose to skip the server dataset updates, other aspects of the sync with Desktop will still take place. If Desktop's more up-to-date dataset copy does overwrite local changes in a server dataset that data is not lost because it will still be recoverable in the form data (the source of local changes).
If you do need to work offline for extended periods, Desktop's local server functionality is still the best way to back up and secure data collected on mobile devices, but for the above reasons, take care when updating Collect's local data via Desktop.