Versions Compared

Key

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

...

Table of Contents

Introduction

Customs forms can be hidden/shown based on the basis of rules defined in the JSON. This is useful to display specific various forms for specific use cases.

Info

Configure this section outside the dictionary section.

For exampleExample use cases:

  1. Display “Tissue Review Event” only for tissue specimens.

  2. Display “Breast Pathology Annotation form” only if the anatomic site is “Breast”.

  3. Display “Screening form” only for “Screening”

...

  1. visits.

  2. Display “Consent forms” only for the “Consent Collector” role

...

Below is the JSON code template:

...

  1. .

Template of Code

Code Block
languagejson
[
  /* Other workflows */ 
  {
    "name": "formDataEntryRules",
    "data": {
      "participant": [
         /* Rules for participant form data entry */
        /* Records available for use in rule conditions are user, cpr, and cp */
        ],
         "visit": [
        /* Rules for visits form data entry */
        /* Records available for use in rule conditions are user, cp, cpr, and visit */
      ],
       "specimen": [
        /* Rules for specimens form data entry */
        /* Records available for use in rule conditions are user, cp, cpr, visit, and specimen */
      ],
       "specimenEvent": [
        /* Rules for specimens form data entry */
        /* Records available for use in rule conditions are user, cp, cpr, visit, and specimen */
      ]
    }
  },
  
  /* Other workflows */
]

Attributes

Rule Configuration

Suppose the case is 'Pregnancy tests form not applicable to male participants'. The rule for this case is:

...

Attributes

Description

when

Add conditions as to when the form should be displayed.

forms

Name of form that needs to be displayed.

Example: ‘Pregnancy tests form’ does not apply to male participants

Code Block
languagejson
[
  {
    "name": "formDataEntryRules",
    "data": {
      "participant" : 
        [ 
  		   {
    		  "when" : "cpr.participant.gender !== 'MaleFemale'",
     	       "forms" : [ "pregnancyTestForm" ]
   		   } 
        ]  {
    }
  }
]

Here, 

"When": Conditions

"forms": List of forms going to be displayed.

Below is a list of different rules that can be used to hide/show forms at a different level:

...

Level

...

Case and Description

...

Example JSON

...

Participant

...

Shows forms on the basis of CP’s field at the participant level.

In JSON Code, "XYZ Form" is a form name.

...

		  "when" : "cpr.participant.gender != 'Female'",
     	       "forms" : [ "generalInformation" ] // If you have multiple forms, please add the condition to show those
   		   }
        ]
      }
  }
]

User needs to provide the False condtion when they want to show the different forms if first condtion is not satisfied.(See below example)

Code Block
{
  "name" : "formDataEntryRules",
  "view" : null,
  "ctrl" : null,
  "data" : {
    "participant" : [ {
      "when" : "cpr.ppid == '1'",
      "forms" : [ "cbrc_fields" ]
    },
    {
      "when" : "cpr.ppid != '1'",
      "forms" : [ "consent_withdrawal","trackingForm" ]
    }
   ]
  }
},

Examples

Level

Case and Description

Example JSON

1. Participant

Shows forms based on CP’s field at the participant level.

Code Block
languagejson
 "participant" :  [ 
{
    "when" : "cp.shortTitle == 'Testing rule CP'",
    "forms" : ["XYZForm"]
 }
]

2. Participant

Shows forms based on the participant's core fields at the participant level.

Code Block
languagejson
"participant" :  [ 
{
      "when" : "cpr.participant.gender == 'Male'",
      "forms" : [ "smokingHistoryForm" ]
 }, 
 {
      "when" : "cpr.participant.gender == 'Female'",
      "forms" : [ "pregnancyTestForm" ]
 }, {
      "when" : "
cp
cpr.participant.
shortTitle
vitalStatus == '
Testing rule CP
Alive'",
      "forms" : [ "
XYZForm
participantFamilyHistory" ]
 }
]

3. Participant

Shows forms

on the basis of the participant's core fields at the participant level.code

based on the participant's custom fields at the participant level.

Add multiple conditions with the help of 'AND(&&)' and 'OR (||)' operators.


Code Block
languagejson
"participant" :  [ 
{

    "when" : "cpr.participant.extensionDetail.
gender
attrsMap.DD2 == '
Male
Married'",
    
"forms" : [ "
smokingHistoryForm
partnerSDetails" ]

}, {
 
{
   "when" : "cpr.participant.extensionDetail.attrsMap.DD2 
"when" : "
== 'Married' && cpr.participant.gender == 'Female'",

    "forms" : [ "
pregnancyTestForm
partnerSDetails" ]
}, { "when" : "cpr.participant.vitalStatus == 'Alive'",
}
]

4. Participant

Shows forms based on user role at the participant level.

Code Block
languagejson
"participant" : [
{
  "when": "user.hasRole('Coordinator')",
  "forms": ["participantRuleForm"]
}
]

5. Participant

Show forms based on value exist or not in another field.

Code Block
languagejson
"participant" : [
      {
 
"forms"
 
:
 
[
 
"participantFamilyHistory"
 
]
  
}
 
]

Participant

Shows forms on the basis of the participant's custom fields at the participant level.

Add multiple conditions with the help of 'AND(&&)' and 'OR (||)' operators.

Code Block"participant" : [ {
"when": "cpr.participant.gender != null",
        "forms": ["XYZForm"]
      },
      {
        "when"
: "cpr.participant.
extensionDetail.attrsMap.DD2
gender == 
'Married'
null",
        "forms"
: [
"
partnerSDetails
ABCForm"]
]
 
},
 
{
    }
"when
]

6. Visit

Shows forms based on CP’s field at the visit level.

Code Block
languagejson
"visit" :
"cpr.participant.extensionDetail.attrsMap.DD2 == 'Married' && cpr.participant.gender
  [ 
    {
       "when" : "cp.shortTitle == '
Female
Testing rule CP'",
       "forms" : [
"
partnerSDetails
XYZForm"]
   
]
 }
]
Participant

7. Visit

Shows forms

on the basis of user role at the participant

based on participant's and visit's core fields at the visit level.

Code Block
languagejson
"
participant
visit" :  [ 
    
{
      
"when": "
user.hasRole('Coordinator')
visit.status == 'Complete'",
      
"forms":
["participantRuleForm"] } ]Participant

Show forms on the basis of value exist or not in another field.

Code Block"participant" : [
 ["visitFormRule"]
    },
    {
       
"when": "cpr.participant.gender 
!
== 
null
'Male'",

       "forms": ["
XYZForm
visitInfoCollectedByCoordinator"]
    }
},
]

8. Visit

Shows forms based on the visit's custom fields at the visit level.

Code Block
languagejson
"visit" :  [ 
      {
        "when": "
cpr
visit.extensionDetail.
participant
attrsMap.
gender
CB8 == 
null
'Yes'",
        "forms": ["
ABCForm
visitInfoCollectedByCoordinator"]
      }
]

9. Visit

Shows forms

on the basis of CP’s field

based on user role at the visit level.

Code Block
languagejson
"visit" :  [ 
    {
"when" : "cp.shortTitle == 'Testing rule CP'",
        "
forms
when" : 
["XYZForm"]
"user.hasRole('Coordinator'),
       
}
 
]

Visit

Shows forms on the basis of participant's and visit's core fields at the visit level.

Code Block"visit
"forms" : 
[ 
{
"visitInfoCollectedByCoordinator" ]
    
"when": "visit.status == 'Complete'", "forms": ["visitFormRule"] },
}
]

10. Specimen

Shows forms based on participant’s, visit's, and specimen's core fields at the specimen level.

Add multiple conditions with the help of 'AND(&&)' and 'OR (||)' operators


Code Block
languagejson
"specimen" :  [ 
  {
     
{
   
"when": "
cpr
specimen.
participant.gender
type == '
Male
Whole Blood'",
"forms": ["visitInfoCollectedByCoordinator"]
       
}
 
]

Visit

Shows forms on the basis of the visit's custom fields at the visit level.

Code Block"visit" : [
"forms": ["fluidInfoForm"]
  },
  {
        "when": "
visit.extensionDetail.attrsMap.CB8
specimen.type == 'DNA' || specimen.type == '
Yes
RNA'",
        "forms": ["
visitInfoCollectedByCoordinator"] } ]

Visit

Shows forms on the basis of user role at the visit level.

Code Block"visit" : [
support_6200", "cPOneSpecimenForm"]
  },
  {
        "when"
: "
user.hasRole('Coordinator')
cpr.participant.gender == 'Female'",
        "forms"
: [
"
visitInfoCollectedByCoordinator" ]
specimenAdditionalRule"]
  },
  {
       
} ]

Specimen

Shows forms on the basis of participant’s, visit's and specimen's core fields at the specimen level.

Add multiple conditions with the help of 'AND(&&)' and 'OR (||)' operators

Code Block"specimen" : [
 "when": "visit.clinicalStatus == 'Follow-up'",
        "forms": ["fluidInfoForm"]
  },
  {
        "when": "specimen.
type
lineage ==
'Whole
 
Blood
'New'",
        "forms": ["
fluidInfoForm
techSpecimenForm"]
  },
  {
        "when": "
specimen
cpr.participant.
type
gender == '
DNA'||'RNA'", "forms": ["fluidInfoForm"] }, {
Female' && visit.clinicalStatus == 'Follow-up' && specimen.lineage == 'New'",
        "
when
forms": 
"cpr.participant.gender == 'Female'",
["specimenAdditionalRule","fluidInfoForm","techSpecimenForm"]
  
"forms": ["specimenAdditionalRule"] },
}
]

11. Specimen

Shows forms based on the specimen's custom fields at the specimen level.

Code Block
languagejson
"specimen" :  [ 
   {
        "when": "
visit.clinicalStatus
specimen.extensionDetail.attrsMap.DD4 == '
Follow-up
A'",
        "forms": ["fluidInfoForm"]
}, { "when": "specimen.lineage == 'New'",

    
}
]

12. Specimen

Shows forms based on user role at the specimen level.

Code Block
languagejson
  "
forms
specimen" :  [
"techSpecimenForm"]
 
},
   {
        "when": "
cpr.participant.gender == 'Female' && visit.clinicalStatus == 'Follow-up'
user.hasRole('Technician') && specimen.lineage == 'New'",
        "forms": [
"specimenAdditionalRule","fluidInfoForm",
"techSpecimenForm"]
   }
]

13. Specimen

Shows forms based on

the basis of the specimen's custom fields at the specimen level

a range of availability field.

Code Block
languagejson
"specimen" :  [ 
    {
        "when": "
"
specimen.
extensionDetail.attrsMap.DD4 == 'A'
availableQty > 5",
        "forms": ["
fluidInfoForm
specimenAdditionalRule"]
    }
]

14. Specimen

Shows forms on the basis of user role at the specimen level.

Code Block "specimen" :

Event

If CP collects the tissue samples from the participants, then that CP has the 'Tissue Review Event' form under the specimen.

Code Block
languagejson
"specimenEvent": [
    {
        "when": "
user.hasRole('Technician') &&
specimen.
lineage
specimenClass == '
New
Tissue'",
        "forms": ["
techSpecimenForm
SpecimenTissueReviewEvent"]
    
} ]

Specimen

Shows forms on the basis of a range of availability field.

Code Block"specimen" :
}
]

15. Specimen Event

Shows forms based on participant's, visit's, and specimen's core fields at the specimen event level.

Add multiple conditions with the help of 'AND(&&)' and 'OR (||)' operators

Code Block
languagejson
"specimenEvent": [
    
{
        "when": "
specimen.availableQty > 5
cpr.participant.gender == 'Female' && visit.clinicalStatus == 'Follow-up' && specimen.specimenClass == 'Tissue'",
        "forms": ["
specimenAdditionalRule Code Block"specimenEvent"
SpecimenTissueReviewEvent"]
    }
]

Specimen Event

Case:
If CP collects the tissue samples from the participants then that CP has the 'Tissue Review Event' form under the specimen.

16. No Forms

It does not show any forms at the derivative level

Code Block
languagejson
"specimen" : [
    {

      "when" : "specimen.
specimenClass
lineage == '
Tissue
Derived'",
      
"forms" : [ "
SpecimenTissueReviewEvent Code Block"specimenEvent": [
" ]
    } 
]

Specimen Event

Shows forms on the basis of participant's, visit's and specimen's core fields at the specimen event level.

Add multiple conditions with the help of 'AND(&&)' and 'OR (||)' operators

17. Visit

Show form based on event label

Code Block
languagejson
{
    "name": "formDataEntryRules",
    "data": {
    "visit": [
	{
 

"when": "cpr.participant.gender == 'Female' && visit.clinicalStatus

     "when": "visit.status == '

Follow-up

Complete' && 

specimen

visit.

specimenClass

eventLabel == '

Tissue

BASELINE'",


      "forms": ["

SpecimenTissueReviewEvent

rde_visit_testing"]
    }

]

No Forms

Does not show any forms at derivative level

Code Block "specimen" : [

, {
      "when"

: "

specimen

visit.

lineage

status == '

Derived

Complete'",
      "forms"

: [

""

]
    }
  ]

Visit

Show form based on event label

Code Block{ "name": "formDataEntryRules",


 }
}

18. Consent

Consent forms should be displayed to those who have access to the consent form. For example, ‘Consent Collector’.

Code Block
languagejson
"participant" :  [ 
   
"data":
 {
        "when": "
visit": [ {
user.hasRole('Consent Collector')",
        "
when
forms": 
"visit.status == 'Complete' && visit.eventLabel == 'BASELINE'",
["consentForm"]
    } 
"forms": ["rde_visit_testing"] },
]
  1. Specimens

Shows form based on CP title

Code Block
languagejson
"specimen" :  [ 
    {
      "when": 
{ "when": "visit.status == 'Complete'",
 "['101_Translational', '51Legacy', 'More CP names separated by comma'].indexOf(cp.shortTitle) >= 0"
       "forms": ["consentForm"]
    } 
]

Info

How to Escape single quote in code?

You need to use the double slash \\ before the chararcher as below

Code Block
languagejson

"specimen" :  [ 

...


    

...

{
   

...

   

...

Consent

...

Case:
Consent forms should be displayed to those who have access to the consent form. For example, ‘Consent Collector’

...

"when":  

...

"['101_Translational\\'s', '51Legacy', 'More CP names separated by comma'].indexOf(cp.shortTitle) >= 0"
       

...

"forms": ["consentForm"]
    } 
]

Example JSON

View file
nameST_6868.json