Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Collection Protocol

In OpenSpecimen, it is possible to add custom fields at the CP level. This feature was introduce introduced to facilitate capturing additional information at the study level. Only one custom form can be attached at the CP custom field level. So this form must have fields required for all the CPs.

Using skip logic in the custom forms, one can show/ hide these fields based on the site selected in the CP site dropdown or the site code.

Use Case 1: Show a custom field based on the site or site code selected in the CP site dropdown.

Expand
titleClick here to view details...

Show field ‘Arkansas Repository ID’ only when the site 'Arkansas Repository' is added

...

to the CP sites

Code Block
languagexml
<showWhen><![CDATA[$extendedObj.cpSites.siteName = "Arkansas Repository"]]></showWhen>

...

Image Added

When the site ‘Arkansas Repository' is not selected:

Image Modified

When the site ‘Arkansas Repository' is added

...

to the list:

Image Modified

The field display can also be configured based on the site code, like below:

Code Block
languagexml
<showWhen><![CDATA[$extendedObj.cpSites.code = "AR"]]></showWhen>
Image Added

The field will be displayed only when the user enters the site code as 'AR':

Image Added

Use Case 2: Show a custom field based on the CP Short Title.

Expand
titleClick here to view details...
Code Block
languagexml
<showWhen><![CDATA[$extendedObj.cpShortTitle = "ASS12"]]></showWhen>
Image Added

The form is attached at the specimen custom field level for 2 CPs.

When the showWhen condition is satisfied the field will be visible i.e for all the specimens in the ASS12 CP the field ‘Did you fast today?' will be visible

Image Added

Whereas for the other CP, the additional fields section is blank.

Image Added

You can also add multiple CPs in the condition if you wish to show this field for only 2 CPs.

Code Block
languagexml
<showWhen><![CDATA[$extendedObj.cpShortTitle =  "ASS12" or $extendedObj.cpShortTitle = "LSC"]]></showWhen>

Please note that both the CPs mentioned here did not have any JSON attached

Orders

Since the order level custom fields are not a standalone form and are used in conjunction with the order fields, you need to use a different syntax.

Use case: The field ‘Courier Name' should only be displayed if the value for ‘Distributed Offsite’ field is 'Yes’

Expand
titleClick here to view details . . .
Code Block
languagexml
<showWhen><![CDATA[order.extensionDetail.attrsMap.distributed_offsite == "Yes"]]></showWhen>

...

Image Added

If 'No' is selected, the field is not displayed:

Image Added

If ‘Yes' is selected, the 'Courier Name’ field is displayed:

Image Added