Subset PVs & User Dropdown
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

Subset PVs & User Dropdown

This feature is useful when a dropdown has a long list of values, but you want to show only a limited set of options for a specific study.

Change in dropdown option format (from v11.x)

Before v11.x, dropdown sub-setting was done via a list of values. From v11.x onwards, dropdown options must be defined using the structured format. Since only a few customers use this feature, it is not handled automatically during upgrades.

Old Configuration (Before v11.x):

{ "name": "visit.site", "caption": "Site", "type": "dropdown", "multiple": false, "optional": false, "listSource": { "options": [ "Test Ankita v8.1", "Training Site Ankita", "Testing v8.1" ] }, "showIf": { "op": "AND", "rules": [ { "field": "visit.status", "op": "!=", "value": "Missed Collection" } ] } },

Updated Configuration (After v11.x):

{ "name": "visit.site", "caption": "Site", "type": "dropdown", "multiple": false, "optional": false, "listSource": { "options": [ { "value": "Test Ankita v8.1" }, { "value": "Training Site Ankita" }, { "value": "Testing v8.1" } ], "displayProp": "value", "selectProp": "value" }, "showIf": { "op": "AND", "rules": [ { "field": "visit.status", "op": "!=", "value": "Missed Collection" } ] } }

Subset PVs

Please find the examples below to show the specific/restricted values in the field dropdown for the PV fields.

Show few sites in visit site dropdown

It is possible to restrict the visit site to show only a few sites as per the user needs.

Use the below code block example and add it in the dictionary { "name": "visit.site", "caption": "Site", "type": "dropdown", "multiple": false, "optional": false, "listSource": { "options": [ { "value": "Test Ankita v8.1" }, { "value": "Training Site Ankita" }, { "value": "Testing v8.1" } ], "displayProp": "value", "selectProp": "value" }, "showIf": { "op": "AND", "rules": [ { "field": "visit.status", "op": "!=", "value": "Missed Collection" } ] } } After configuring the JSON workflow, the 'Site' dropdown shows only selected sites:

Display only two values for gender

Restrict dropdown values for gender up to two ‘Male’ and ‘Female’.

Use the below code block example and add it in the dictionary { "name": "cpr.participant.gender", "caption": "Gender", "type": "dropdown", "optional": true, "defaultValue": "Female", "listSource": { "options": [ { "value": "Male", "conceptCode": "M" }, { "value": "Female", "conceptCode": "F" } ], "displayProp": "value", "selectProp": "value" } } After configuring the JSON workflow, the 'Gender' dropdown shows only two genders, "Male" and "Female":

Show 'Whole Blood' value under 'Fluid' and 'Fixed Tissue Block' under 'Tissue' class

Restrict specimen type to specific class.

Use the below code block example and add it in the dictionary { "name": "specimen.type", "caption": "Type", "type": "specimen-type", "specimen": "specimen", "optional": false, "defaultValue": "Whole Blood", "options": [ { "specimenClass": "Fluid", "type": "Whole Blood" }, { "specimenClass": "Tissue", "type": "Fixed Tissue Block" } ] } After configuring the JSON workflow, the 'Type' dropdown shows only the selected specimen type:

Subset User Dropdown

You can configure a limited user list to simplify and speed up data entry. If only 4–5 users need to be selected, this avoids the need to search through the entire list of users each time.

List a subset of users in biobank technician dropdown

It is possible to restrict ‘Biobank Technician’ dropdown values to 4-5 users for easy search.

Use the below code block example and add it in the dictionary { "name": "specimen.extensionDetail.attrsMap.biobank_technician", "caption": "Biobank Technician", "type": "dropdown", "optional": true, "listSource": { "options": [ { "id": 6042, "fullName": "1Oncolife IA RP" }, { "id": 5963, "fullName": "2 Testing" }, { "id": 6041, "fullName": "2OncoLife IA RP" } ], "selectProp": "id", "displayProp": "fullName" } } After configuring the user subset in the JSON workflow, the 'Biobank Technician' user dropdown shows only listed users:

Restrict 'Collector' list based on the Institute

Based on Institute they belong to, ‘Collector’ user list can be restricted.

Collector - The code below is only applicable for unplanned collections (with the +Add Specimen button). It won't affect the planned specimen collection page.

Use the below code block example and add it in the dictionary { "name" : "specimen.collectionEvent.user", "caption" : "Collector", "type" : "user", "defaultValue" : "current_user", "listSource": { "queryParams": { "static": { "institute": "Columbia University(CUMC)" } } },"showIf": { "op": "AND", "rules": [ { "field": "specimen.lineage", "op": "==", "value": "'New'" }, { "field" : "specimen.status", "op" : "==", "value" : "'Collected'" } ] }, "subFields": [ { "name": "emailAddress", "caption": "Collector Email Address" } ] }

Display restricted values in Cohort field

Use the below code block example and add it in the dictionary { "name" : "visit.cohort", "caption" : "GCT Cohort", "type" : "dropdown", "optional" : "true", "selectProp": "value", "showIf" : { "op" : "AND", "rules" : [ { "field" : "visit.status", "op" : "!=", "value" : "Missed Collection" } ] }, "listSource": { "options": [ { "value": "BEP C1D1" }, { "value": "BEP C2D1" }, { "value": "BEP C3D1" }, { "value": "EP C1D1" }, { "value": "EP C2D1" }, { "value": "EP C3D1" }, { "value": "EP C4D1" }, { "value": "VIP C1D1" }, { "value": "VIP C2D1" }, { "value": "VIP C3D1" }, { "value": "VIP C4D1" }, { "value": "CAV/IE C1D1" }, { "value": "CAV/IE C2D1" }, { "value": "CAV/IE C3D1" }, { "value": "CAV/IE C4D1" }, { "value": "HDCT C1D1" }, { "value": "HDCT C2D1" }, { "value": "C1D1" }, { "value": "C2D1" }, { "value": "C3D1" }, { "value": "C4D1" }, { "value": "Pre-Surgery" }, { "value": "Post-Surgery" } ], "displayProp": "value", "selectProp": "value" } },

Show cohort dropdown values based on event label

You can show different Cohort dropdown values based on the Event Label of the visit.

There are two ways to configure this:

1. Using the default Cohort field

You can use the default cohort field and configure the JSON to display different values based on the Event Label.

For example:

  • If Event Label = Baseline, show Bipolar and Birth study

  • If Event Label = Follow-up, show Placebo and Study Group A

Use the code below to show cohort values based on CP event label. { "name" : "visit.cohort", "caption" : "Cohort", "type" : "dropdown", "optional" : true, "showWhen" : "visit.status != 'Missed Collection' && visit.status != 'Not Collected'", "listSource" : { "apiUrl" : "permissible-values/v", "selectProp" : "value", "displayProp" : "value", "initUsingSelectProp" : true, "queryParams" : { "static" : { "attribute" : "cohort" }, "dynamic" : { "value" : "visit.eventLabel == 'Baseline' ? 'Bipolar|Birth study'.split('|') : visit.eventLabel == 'Follow-up' ? 'Placebo|Study Group A'.split('|') : ''" } } } } Screenshot: Event Label = Baseline Event Label = Follow-up

This approach works well when there are only a few Cohort values. If there are many values, maintaining them in the JSON can become difficult.

2. Using a PV custom field

You can also create a PV custom field with a parent-child relationship.

In this approach, the Event Label is used as the parent value, and the Cohort values are added as child values.

For example:

Baseline ├── Bipolar └── Birth study Follow-up ├── Placebo └── Study Group A

Steps

  1. Create a PV called Event Cohort.

  2. Add the event labels as parent values:

    • Baseline

    • Follow-up

  3. Add the Cohort values under the corresponding parent:

    • Under Baseline → Bipolar, Birth study

    • Under Follow-up → Placebo, Study Group A

  4. Create a visit-level custom field using the Event Cohort PV.

  5. Add the following configuration in the JSON dictionary:

{ "name" : "visit.extensionDetail.attrsMap.cohort", "caption" : "Custom Cohort", "type" : "pvs", "attr" : "event_cohort", "optional" : true, "parentValueExpr" : "visit.eventLabel", "leafValue" : true, "showWhen" : "visit.status != 'Missed Collection' && visit.status != 'Not Collected'" } Screenshot: Event Label = Baseline Event Label = Follow-up:

The parentValueExpr uses the visit's Event Label to select the corresponding parent value. The dropdown then displays only the child values under that parent.

For example:

  • Baseline → Bipolar, Birth study

  • Follow-up → Placebo, Study Group A

This approach is useful when the Cohort values need to be maintained through permissible values instead of putting all the values directly in the JSON.

Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com