From 5813f6e052e4f646b95b0e0e75c59da824338e24 Mon Sep 17 00:00:00 2001 From: Erik Surface Date: Mon, 13 Jan 2025 15:12:22 -0400 Subject: [PATCH] Update CHANGELOG and fixes to case-api --- CHANGELOG.md | 60 +++++++++++++++++++ .../case-module/client/case-type-1.json | 12 ++++ .../client/custom-login-markup.html | 10 ++++ server/src/case-api.js | 2 + server/src/releases.js | 2 - 5 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 content-sets/case-module/client/custom-login-markup.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 71d9333526..9adaf62700 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,65 @@ # What's new +## v3.32.0 + +Tangerine v3.32.0 contains a major update to the deployment and fuctionality of Online Surveys including the introduction of authentication and case association. + +__Online Survey Authentication__ + +Online Surveys can now be released for public access or require authentication. When authentication is required, data collectors will be required to provide a device user Access Code to access the survey. The survey will be associated with the device user who provided the short code. + +To deploy an Online Survey and require authentication: +1. Create the form +2. Add the `"requireAccessCode": true` property to the `app-config.json` file +3. Navigate to Deploy > Release Online Survey for the group +4. In the Unpublished Surveys list, click the icon to deploy a survey and require an access code. + +__Custom Markdown for Online Survey Login Page__ + +Custom styling (text, logos, formatting etc.) can be added to the login page for Online Surveys. In the content set repository, create a file called `client/custom-login-markup.html`. The file can contain any valid html. Any images can be added to the `media` folder and used in the html. Example [Custom Login Markup](content-sets/case-module/client/custom-login-markup.html). + +__Online Survey Case Form Authentication__ + +Online Surveys with authentication can also be configured when using the Case Module. This is useful for studies who want to deploy secure forms without needing to install a full PWA or APK for one form associated with the case. For example, a mother-child cohort study deploys Tangerine to track the health of the mother and child after birth. Labs are collected in the field and sent for analysis. Instead of requiring the lab to install a tablet or PWA with the Tangerine app, the lab forms can be deployed online to simplify the completion process. + +To configure forms for secure deployment online in Case, add the `"allowOnline": true` property to the `eventFormDefinitions` section in the case definition file. See the form definition for `form-allowed-online-survey` in [case-type-1](./content-sets/case-module/client/case-type-1.json). + +__Online Survey Help Link__ + +A help link can be added to the web pages for Online Surveys and will appear with the icon in the header. Define the link url by adding the `"helpLink": "https://www.tangerinecentral.org"` property to the `app-config.json` file. When clicked, the link will open in a new browser window. + +__Tangerine Case APIs__ + +- `/userProfile/createUserProfile/:groupId` + - Creates a user-profile document in the group + - Additional body data in json format will add properties to the user-profile: `{ "age": "7", "dob": "1/1/2018"}` +- `/case/createCase/:groupId/:caseDefinitionId` + - Creates a case in the group with the case type defined by the case definition id + - Additional body data in json format will add properties to the case: `{ "age": "7", "dob": "1/1/2018"}` +- `/case/readCase/:groupId/:caseId` + - Read a case from the group with the case id +- `/case/createCaseEvent/:groupId/:caseId/:caseDefinitionId/:caseEventDefinitionId` + - Creates an event with the event type as defined in the case definition +- `/case/createParticipant/:groupId/:caseId/:caseDefinitionId/:caseRoleId` + - Creates a participant with the case role as defined in the case definition +- `/case/getCaseEventFormSurveyLinks/:groupId/:caseId/` + Returns a JSON document with the urls for all case forms with active online surveys in the format: + ```json + { + "eventDefinitionId": event.caseEventDefinitionId, + "eventFormDefinitionId": eventForm.eventFormDefinitionId, + "formId": formId, + "url": url + } + ``` + +__Server upgrade instructions__ + +See the [Server Upgrade Insturctions](https://docs.tangerinecentral.org/system-administrator/upgrade-instructions). + +*Special Instructions for this release:* N/A + + ## v3.31.2 __General Updates__ diff --git a/content-sets/case-module/client/case-type-1.json b/content-sets/case-module/client/case-type-1.json index e515ce6701..ed80912446 100644 --- a/content-sets/case-module/client/case-type-1.json +++ b/content-sets/case-module/client/case-type-1.json @@ -137,6 +137,18 @@ "allowDeleteIfFormNotStarted": true, "required": false, "repeatable": true + }, + { + "id": "event-form-definition-h9d3hd9", + "formId": "form-allowed-online-survey", + "forCaseRole": "role-2", + "name": "A form allowed to be filled online", + "autoPopulate": true, + "allowDeleteIfFormNotCompleted": true, + "allowDeleteIfFormNotStarted": true, + "required": false, + "repeatable": true, + "allowOnline": true } ] }, diff --git a/content-sets/case-module/client/custom-login-markup.html b/content-sets/case-module/client/custom-login-markup.html new file mode 100644 index 0000000000..d5d7584458 --- /dev/null +++ b/content-sets/case-module/client/custom-login-markup.html @@ -0,0 +1,10 @@ +
+ +
+
+
Online Survey for Tangerine Study
+
+

+ Enter the provided Access Code below. +

+
\ No newline at end of file diff --git a/server/src/case-api.js b/server/src/case-api.js index 6572b77e26..d5ac21aff1 100644 --- a/server/src/case-api.js +++ b/server/src/case-api.js @@ -88,6 +88,7 @@ createCase = async (req, res) => { readCase = async (req, res) => { const groupDb = new DB(req.params.groupId) + let caseId = req.params.caseId let data = {} try { data = await groupDb.get(caseId); @@ -123,6 +124,7 @@ createEventForm = async (req, res) => { let groupId = req.params.groupId let caseId = req.params.caseId let caseEventId = req.params.caseEventId + let caseDefinitionId = req.params.caseDefinitionId let eventFormDefinitionId = req.params.eventFormDefinitionId const caseDefinition = _getCaseDefinition(groupId, caseDefinitionId) diff --git a/server/src/releases.js b/server/src/releases.js index 21f8b20acb..8735df3312 100644 --- a/server/src/releases.js +++ b/server/src/releases.js @@ -63,7 +63,6 @@ const releasePWA = async (req, res)=>{ const releaseOnlineSurveyApp = async(req, res) => { // @TODO Make sure user is member of group. - debugger; const groupId = sanitize(req.params.groupId) const formId = sanitize(req.params.formId) const releaseType = sanitize(req.params.releaseType) @@ -75,7 +74,6 @@ const releaseOnlineSurveyApp = async(req, res) => { } else { uploadKey = sanitize(req.body.uploadKey) } - debugger; const requireAccessCode = req.body.locked ? req.body.locked : false try {