CARP Study Generator Utility Package

This utility package helps generate the configuration files needed for a CARP Mobile Sensing study, and uploading this to the CARP web server.

Configuration and Setup

To use the study generator, do the following in you app:

  1. Include carp_study_generator and test as part of the dev_dependencies in the pubspec.yaml file.
  2. Copy the folder carp to the root of you project.
  3. Configure carpspec.yaml, and the json files protocol.json, consent.json, and the language json files (en.json, etc.).

Configuration of carpspec.yaml

The carpspec.yaml can be configured using the following properties for:

  • the CARP Server
  • protocol
  • informed consent
  • localization
  client_id: carp
  client_secret: carp
  password: pw

  path: carp/protocols/protocol.json

  path: carp/consents/consent.json

  path: carp/lang/
  # list the locales supported 
  # for each locale, a json file in the 'lang' folder must be added
    - en
    - da

Note that the carpspec.yaml file contains username and password in clear text and hence SHOULD NOT BE ADDED TO VERSION CONTOL - add it to .gitignore.

File Structure

All files used for creating and uploading configurations to CARP is stored in the carp folder in the root of your (app) project file. The name of the json files to upload is specified in the carpspec.yaml file. The default file structure is:

protocolsThe file(s) containing the json definition of your StudyProtocol.
consentsThe file(s) containing the json definition of your RPOrderedTask with the informed consent to show to the user.
langThe json language file for each language supported of the form <language>.json.

Please ignore the test scripts in the carp folder (these are used to execute the commands).


Each command is run like this:

flutter test carp/<command>

The available commands are:

  help           Prints this help message.
  dryrun         Makes a dryrun testing access to the CARP server, and the protocol, consent, and localizations.
  create         Create a study protocol based on a json file and uploads it to the CARP server.
  update         Update an existing study protocol based on a json file and uploads it to the CARP server as a new version.
  consent        Create an informed consent based on a json file and uploads it to the CARP server.
  localization   Create localization support based on the files '<locale>.json' and upload them to the CARP server.

Before uploading a any json files to CARP, run the dryrun command first. It will check and output a list like the following:

[!] CARP Server          CarpServiceException: 401 Unauthorized -  The requested email account: cannot be found. 
[✓] Protocol path        carp/protocols/protocol.json
[✓] Protocol parse       name: test_protocol
[✓] Consent path         carp/consents/consent.json
[!] Consent parse        FormatException: Unexpected end of input (at character 1)
[✓] Locale - en          carp/lang/en.json
[✓] Locale - da          carp/lang/da.json
 •  2 issues found!