Leave a comment at the end of this page or email contact@krishagni.com
Hide/Show Custom Forms based on Rules (v7.0)
Introduction
Customs forms can be hidden/shown based on rules defined in the JSON. This is useful to display various forms for specific use cases.
Configure this section outside the dictionary section.
Example use cases:
Display “Tissue Review Event” only for tissue specimens.
Display “Breast Pathology Annotation form” only if the anatomic site is “Breast”.
Display “Screening form” only for “Screening” visits.
Display “Consent forms” only for the “Consent Collector” role.
Template of Code
[
/* 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
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
[
{
"name": "formDataEntryRules",
"data": {
"participant" :
[
{
"when" : "cpr.participant.gender == 'Female'",
"forms" : [ "pregnancyTestForm" ]
}
{
"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)
{
"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. | |
2. Participant | Shows forms based on the participant's core fields at the participant level. | |
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. | |
4. Participant | Shows forms based on user role at the participant level. | |
5. Participant | Show forms based on value exist or not in another field. | |
6. Visit | Shows forms based on CP’s field at the visit level. | |
7. Visit | Shows forms based on participant's and visit's core fields at the visit level. | |
8. Visit | Shows forms based on the visit's custom fields at the visit level. | |
9. Visit | Shows forms based on user role at the visit level. | |
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 | |
11. Specimen | Shows forms based on the specimen's custom fields at the specimen level. | |
12. Specimen | Shows forms based on user role at the specimen level. | |
13. Specimen | Shows forms based on a range of availability field. | |
14. Specimen Event | If CP collects the tissue samples from the participants, then that CP has the 'Tissue Review Event' form under the 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 | |
16. No Forms | It does not show any forms at the derivative level | |
17. Visit | Show form based on event label |
|
18. Consent
| Consent forms should be displayed to those who have access to the consent form. For example, ‘Consent Collector’. | |
| Shows form based on CP title |
|
How to Escape single quote in code?
You need to use the double slash \\ before the chararcher as below
Example JSON
Leave a comment at the end of this page or email contact@krishagni.com