Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The ability to select templates (like the email address verification email) by criteria such as the user's language, or the version of the app;
  • The ability to clearly specify the template that should be used if the criteria filtering is ambiguous (unlike app configurations where we just take the first one);
  • The ability to audit changes to templates (like study consents, which create immutable revisions... just record who created the revision);
  • The possibility of creating later to create custom templates that can be used with scheduling or notifications (right now, you have to manage these outside the system and can't schedule anything);
  • The ability possibility later to add additional documents easily (the privacy document has long been considered, because it's required to submit an app to the App Store);
  • Should definitely replace the templates on the study object; could conceivably replace the study consent documents as well;

Not

...

In Scope (up for discussion)

  • Custom template implementation (just ensure the design can accommodate it);
  • Additional document implementation (just ensure the design can accommodate it);
  • Document inclusions or attachments (e.g. images for HTML documents... unless we really want this);
  • Variable resolution (that's part of using the template);
  • Publishing documents (e.g. the publicly available versions that's part of the consentsconsent system). However we'd need something like this for the privacy document

...

Template Model

Image RemovedImage Added

You can now add any number of templates for a specific type of template, differentiated by their guids, and selectable using Criteria.

As an example, there might be a VERIFY_EMAIL template for English and for French. The default specified in the Study object could be the English template. Each of these templates can be edited any number of times, creating a stream of TemplateRevision objects, and one of these would be the published revision, that is, the revision that will be returned to the caller when asking for this template. TemplateRevisions are not deletable.

STUDY
defaultTemplates: Map<TemplateType, String>

Where there are multiple templates for a given type, one can be specified as the default if the user doesn't send or doesn't have (or doesn't match) any template through the criteria matching system. Eventually remove all templates from the study object (see Migration below).

CREATE TABLE `Template` (
  `guid` VARCHAR(60) NOT NULL,
  `studyId` VARCHAR(255) NOT NULL,
  `type` ENUM('ACCOUNT_EXISTS', 'ACCOUNT_EXISTS_SMS', 'APP_INSTALL_LINK', 'APP_INSTALL_LINK_SMS', 'EMAIL_SIGN_IN',
    'PHONE_SIGN_IN_SMS', 'RESET_PASSWORD', 'RESET_PASSWORD_SMS', 'SIGNED_CONSENT', 'SIGNED_CONSENT_SMS',
    'VERIFY_EMAIL', 'VERIFY_PHONE_SMS') NOT NULL,
  `name` VARCHAR(255) NULL,
  `criteriaKey` VARCHAR(255) NULL,
  `createdOn` BIGINT UNSIGNED NULL,
  `modifiedOn` BIGINT UNSIGNED NULL,
  `publishedCreatedOn` BIGINT UNSIGNED NULL,
  `deleted` BOOLEAN NOT NULL DEFAULT FALSE,
  `version` INT UNSIGNED NOT NULL, /* optimistic locking */
  PRIMARY KEY (`studyId`, `guid`)
  INDEX `type_set_idx` (`studyId`, `type`)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

CREATE TABLE `TemplateRevision` (
  `studyId` VARCHAR(255) NOT NULL,
  `guid` VARCHAR(60) NOT NULL,
  `createdOn` BIGINT UNSIGNED NULL,
  `createdBy` VARCHAR(255) NOT NULL,
  `storagePath` VARCHAR(255) NOT NULL,
  `subject` VARCHAR(255) NULL,
  `mimeType` ENUM('HTML', 'TEXT') NULL,
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;