Got feedback or spotted a mistake?

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

Calculated Fields on Overview Page

OpenSpecimen allows configuring calculated fields to be displayed on overview pages.

Note

  • We do not recommend storing any calculated field values since it is duplicate information.

  • You can configure the code in JSON workflow within the 'Dictionary' section.

Example 1: Display participant concatenated first name and last name

{ "name": "calcCpr.name", "displayExpr": "cpr.participant.firstName + ' ' + cpr.participant.lastName", "caption": "Name", "type": "span" }

A more robust example of the above is no blank space when either first name or last name is not specified.

{ "name": "calcCpr.name", "displayExpr": "fns.concat(cpr.participant.firstName, cpr.participant.lastName)", "caption": "Name", "type": "span" }



Example 2: Display Visit Clinical Diagnosis Values concatenated with their Concept code 

{ "name": "calcVisit.diagnosisList", "caption": "Clinical Diagnosis", "type": "span", "displayExpr": "fns.concatList(visit.diagnosisList, '!!value && value != \"Not Specified\" ? value + (!!conceptCode ? \" (\" + conceptCode + \")\" : \"\") : \"\"', ', ')" }

Example 3: Display age as of today

Example 4: Display age at the time of visit

Example 5: Display age at the time of specimen creation

Example 6: Display the multiplication of 2 Custom fields

Example 7: Adding 2 Number fields

 

Example 8: Average of 2 Number fields

Example 9: Return the array of substring and display it on child specimen overview page

Example 10: Display quantity (ug) field on the specimen overview page

Example 11: Display if the patient consented or not based on consent responses

Example 12: Display BMI of participant

Example 13: Display Participant custom field on Visit/Specimen Overview Page as Read-Only

Example 14: Display Participant Yes/No and Date custom field on Specimen Overview Page as Read-Only

Example 15: Display Visit default field on Specimen Overview Page as Read-Only

Example 16: Display Visit custom field on Specimen Overview Page as Read-Only

Example 17: Display age as of today in Months

Example 18: Calculating the months remaining after counting the completed years

 

Example 19: Calculating the Cohort field based on the consent signature date.

 

Example 20: Calculating the Field based on Custom Number field divided by user input value.

 

Example 21: Calculating Age of Dead participants and alive participants.

 

 

Inbuilt Functions

Example JSON Download

Calculated URL

From v10.2 onwards, on the JSON configured overview page, calculated fields can be used to display the hyperlinked URLs.

Below is the list of fields that are available to be used in the JSON

Field

Syntax

Collection Protocol Identifier

cpr.cpId

Participant Registration Identifier

participant.id

Participant Identifier

cpr.id

Visit Identifier

specimen.visitId

Specimen Identifier

specimen.id

Got feedback or spotted a mistake?

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