Versions Compared

Key

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

...

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" : "cpr.participant.vitalStatus == 'Alive'",
      "forms" : [ "participantFamilyHistory" ]
 }
]

3. Participant

Shows forms 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.attrsMap.DD2 == 'Married'",
    "forms" : [ "partnerSDetails" ]
}, {
    "when" : "cpr.participant.extensionDetail.attrsMap.DD2 == 'Married' && cpr.participant.gender == 'Female'",
    "forms" : [ "partnerSDetails" ]
}
]

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" : [
      {
        "when": "cpr.participant.gender != null",
        "forms": ["XYZForm"]
      },
      {
        "when": "cpr.participant.gender == null",
        "forms": ["ABCForm"]
      }
]

6. Visit

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

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

7. Visit

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

Code Block
languagejson
"visit" :  [ 
    {
      "when": "visit.status == 'Complete'",
      "forms": ["visitFormRule"]
    },
    {
       "when": "cpr.participant.gender == 'Male'",
       "forms": ["visitInfoCollectedByCoordinator"]
    }
]

8. Visit

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

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

9. Visit

Shows forms based on user role at the visit level.

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

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": "specimen.type == 'Whole Blood'",
        "forms": ["fluidInfoForm"]
  },
  {
        "when": "specimen.type == 'DNA' || specimen.type == 'RNA'",
        "forms": ["support_6200", "cPOneSpecimenForm"]
  },
  {
        "when": "cpr.participant.gender == 'Female'",
        "forms": ["specimenAdditionalRule"]
  },
  {
        "when": "visit.clinicalStatus == 'Follow-up'",
        "forms": ["fluidInfoForm"]
  },
  {
        "when": "specimen.lineage == 'New'",
        "forms": ["techSpecimenForm"]
  },
  {
        "when": "cpr.participant.gender == 'Female' && visit.clinicalStatus == 'Follow-up' && specimen.lineage == 'New'",
        "forms": ["specimenAdditionalRule","fluidInfoForm","techSpecimenForm"]
  }
]

11. Specimen

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

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

12. Specimen

Shows forms based on user role at the specimen level.

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

13. Specimen

Shows forms based on a range of availability field.

Code Block
languagejson
"specimen" :  [ 
    {
        "when": "specimen.availableQty > 5",
        "forms": ["specimenAdditionalRule"]
    }
]

14. 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": "specimen.specimenClass == 'Tissue'",
        "forms": ["SpecimenTissueReviewEvent"]
    }
]

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": "cpr.participant.gender == 'Female' && visit.clinicalStatus == 'Follow-up' && specimen.specimenClass == 'Tissue'",
        "forms": ["SpecimenTissueReviewEvent"]
    }
]

16. No Forms

It does not show any forms at the derivative level

Code Block
languagejson
"specimen" : [
    {
      "when" : "specimen.lineage == 'Derived'",
      "forms" : [ "" ]
    } 
]

17. Visit

Show form based on event label

Code Block
languagejson
{
    "name": "formDataEntryRules",
    "data": {
    "visit": [
	{
      "when": "visit.status == 'Complete' && visit.eventLabel == 'BASELINE'",
      "forms": ["rde_visit_testing"]
    }, {
      "when": "visit.status == 'Complete'",
      "forms": [""]
    }
  ]
 }
}

18. Consent

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

Code Block
languagejson
"participant" :  [ 
    {
        "when": "user.hasRole('Consent Collector')",
        "forms": ["consentForm"]
    } 
]
  1. Specimens

Shows form based on CP title

Code Block
languagejson
"specimen" :  [ 
    {
      "when":  "['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" :  [ 
    {
      "when":  "['101_Translational\\'s', '51Legacy', 'More CP names separated by comma'].indexOf(cp.shortTitle) >= 0"
       "forms": ["consentForm"]
    } 
]

Example JSON

View file
nameST_6868.json

...