Skip to content

Commit

Permalink
Update CHANGELOG and fixes to case-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Surface committed Jan 13, 2025
1 parent b2e2f9e commit 5813f6e
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 2 deletions.
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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 <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="rgb(255, 149, 34)"><path d="M240-80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h40v-80q0-83 58.5-141.5T480-920q83 0 141.5 58.5T680-720v80h40q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Zm0-80h480v-400H240v400Zm240-120q33 0 56.5-23.5T560-360q0-33-23.5-56.5T480-440q-33 0-56.5 23.5T400-360q0 33 23.5 56.5T480-280ZM360-640h240v-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80ZM240-160v-400 400Z"/></svg> 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 <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M478-240q21 0 35.5-14.5T528-290q0-21-14.5-35.5T478-340q-21 0-35.5 14.5T428-290q0 21 14.5 35.5T478-240Zm-36-154h74q0-33 7.5-52t42.5-52q26-26 41-49.5t15-56.5q0-56-41-86t-97-30q-57 0-92.5 30T342-618l66 26q5-18 22.5-39t53.5-21q32 0 48 17.5t16 38.5q0 20-12 37.5T506-526q-44 39-54 59t-10 73Zm38 314q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg> 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__
Expand Down
12 changes: 12 additions & 0 deletions content-sets/case-module/client/case-type-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
},
Expand Down
10 changes: 10 additions & 0 deletions content-sets/case-module/client/custom-login-markup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div>
<img id="logo" src="./assets/media/logo.png" width="100%">
</div>
<div>
<center><strong>Online Survey for Tangerine Study</strong></center>
<br>
<p>
<small>Enter the provided Access Code below.</small>
</p>
</div>
2 changes: 2 additions & 0 deletions server/src/case-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions server/src/releases.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down

0 comments on commit 5813f6e

Please sign in to comment.