carp_study_generator 0.21.4
carp_study_generator: ^0.21.4 copied to clipboard
Utilities for generating CARP Mobile Sensing studies
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:
- Include
carp_study_generator
andtest
as part of thedev_dependencies
in thepubspec.yaml
file. - Copy the folder
carp
to the root of you project. - Configure
carpspec.yaml
, and the json filesprotocol.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
- the study ID
- protocol
- informed consent
- localization
server:
uri: https://cans.cachet.dk
client_id: carp
client_secret: carp
username: user@dtu.dk
password: pw
study:
study_id: 01cf04a7-d154-40f0-9a75-ab759cf74eb3
study_deployment_id: ae8076a3-7170-4bcf-b66c-64639a7a9eee
protocol:
path: carp/protocols/protocol.json
consent:
path: carp/consents/consent.json
localization:
path: carp/lang/
# list the locales supported
# for each locale, a json file in the 'lang' folder must be added
locales:
- 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:
Folder | Description |
---|---|
protocols |
The file(s) containing the json definition of your StudyProtocol . |
consents |
The file(s) containing the json definition of your RPOrderedTask with the informed consent to show to the user. |
lang |
The 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).
Usage #
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 App CarpApp - name: CARP server at 'https://cans.cachet.dk/', uri: https://cans.cachet.dk/, studyDeploymentId: null, studyId: 7be8da9b-7e8f-46c6-a070-d3fa186914a2
[!] CARP Server CarpServiceException: 401 Unauthorized - The requested email account: user@dtu.dk 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!