Got feedback or spotted a mistake?

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

Data Validation Examples

Participant

We can add edit checks on participant fields using the record type as ‘cpr’

Attribute Type

Description

Example JSON

Attribute Type

Description

Example JSON

Text

Patient first name, last name should not be null.

{ "records" : [ "cpr" ], "rules" : [ { "expr" : "#cpr.participant.firstName != null && #cpr.participant.lastName != null", "description" : "First name or last name should not be null" } ] },

Text

Allow only capital letters in the field first name

{ "records" : [ "cpr" ], "rules" : [ { "expr" : "#cpr.participant.firstName.matches(\"^[A-Z]+$\")", "description" : "Only capital letters allowed for Initials" } ] }

Numeric field

The participant’s age registered under the COVID protocol should be between 18-55

{ "records" : [ "cpr" ], "rules" : [ { "when" : "#cpr.participant.extensionDetail?.getAttrsMap()?.get('min_max_age') != null && !#cpr.participant.extensionDetail?.getAttrsMap()?.get('min_max_age').isEmpty()", "expr" : "T(java.lang.Integer).parseInt(#cpr.participant.extensionDetail?.getAttrsMap()?.get('min_max_age')) >= 18 && T(java.lang.Integer).parseInt(#cpr.participant.extensionDetail?.getAttrsMap()?.get('min_max_age')) <= 55", "description" : "Partiicpant's age should be between 18 and 55" } ] }

Text Custom Field

If the patient is ‘Dead’ then, specify the value ‘Cause of death.’

Dropdown

Only male participant registrations are allowed

Multi-select field

If Race is one of (White or Asian), then Ethnicity should be 'American.'

Dropdown and Muliselect

  1. If Registration Site='MCRI Repository', then Race values is one of 'White' or 'Asian'

  2. If the patient is ‘Alive’ then Ethnicity should be ‘African’ or 'American'

Custom Field

The email id of the participant should be of the form ‘example@something.com’

Custom Form Field

In the ‘Smoking History Form’ attached at the ‘Participant Forms’ level, if the value of ‘Have you ever smoked’ is ‘Yes’, the error ‘Smokers not allowed!’ should be thrown.

Custom Form Field

‘Male’ participants with the value of ‘Have you ever smoked?’ as ‘Yes’ are not allowed. Error ‘Male smokers not allowed!’ should be thrown.

Custom form Date Field

‘Date of participant signed' is a date type custom field. The date is valid if

Valid Date = (Date signed ≤ Today’s Date) otherwise invalid

Calculated Field (Age)

Participant age at the time of registration should be more than 18 years

Dropdown Custom Field

If the patient is ‘Dead’, enter the values for the 'Diagnosed With' field from the dropdown.

Dropdown Multiselect (Custom Field)

If the patient is 'Alive', enter the values for the 'City lived In field from the dropdown.

Fancy Control-User

If the user (Surgeon) is 'Krishna W' then the user needs to provide the death cause value (Custom Field) for the patient.

 

Visit

We can add edit checks on visit fields using the record type as ‘visit’

Attribute Type

Description

Example JSON

Attribute Type

Description

Example JSON

Dropdown

Clinical diagnosis should be one of 'Cholera', 'Liver cell carcinoma'

Dropdown custom field

If the clinical diagnosis is one of 'Cholera', 'Liver cell carcinoma', then the Diagnosis subtype ID 'Negative'

Date

Participant/Visit fields:

"Visit date should be the same or later than the registration date!"

Dropdown (Core fields)

The values for clinical diagnoses should be ‘Breast implant status’ and ‘Other disorders of breast.’

Dropdown (Core fields)

If ‘Clinical Diagnoses’ is one of List a then acceptable ‘Anatomic Site’ values will be among List b.
List a: '10 weeks gestation of pregnancy, '11 weeks gestation of pregnancy', '12 weeks gestation of pregnancy', '13 weeks gestation of pregnancy, '14 weeks gestation of pregnancy
List b: Extrahepatic bile duct Intrahepatic bile duct Liver

Dropdown (Custom Form fields)

If the ‘Tumor Site/Anatomic site’ value from the custom form is ‘Extrahepatic bile duct', 'Intrahepatic bile duct', 'Liver', then the allowed values for the 'Tumor Morphology Diagnosis’ field from the custom form will be '10 weeks gestation of pregnancy', '11 weeks gestation of pregnancy', '12 weeks gestation of pregnancy, '13 weeks gestation of pregnancy, '14 weeks gestation of pregnancy'

Dropdown (Core and Custom Form)

If the 'Primary Site' values (Custom Form) are 'Extrahepatic bile duct', 'Intrahepatic bile duct', 'Liver', the allowed value for Clinical Diagnosis (Core) should be in {'10 weeks gestation of pregnancy', '11 weeks gestation of pregnancy', '12 weeks gestation of pregnancy', '13 weeks gestation of pregnancy', '14 weeks gestation of pregnancy'}

Dropdown (Core and Custom Form)

If the diagnosis field from the visit level form contains values from the below List, then the allowed value for Clinical Diagnosis (Core) should be 'Non-malignant'.

List:

‘8006/2 Observation for suspected malignant neoplasm’, '8009/1 Non-malignant diagnosis, no history of cancer (Other Medical Care)'.

Why is RegEx used in the edit check? Providing these long multi-choice values in the edit check is not flexible, so RegEx checks for the statement and matches the values.

Specimen

We can add edit checks on specimen fields using the record type as ‘specimen’

Attribute Type

Description

Example JSON

Attribute Type

Description

Example JSON

Dropdown core

If the participant gender is ‘Male’, then the anatomic site cannot include 'Female genital tract, NOS', 'Overlapping lesion of female genital organs', 'Other specified parts of female genital organs', 'Breast, NOS'

Date

Registration Date vs. Collection Date

The specimen collection date should be the same or later than the registration date.

Dropdown custom

The anatomic site should be Brain NOS OR Abdomen NOS for tissue samples

Date field (core)

Specimen data should be the same or later than the Visit date!

(Visit date allows only ‘Date' whereas Specimen collection date allows 'Date and time data entry. In this Edit check, similar date format is provided for both the date fields.)

Shipment

We can add edit checks on shipment fields using the record type as ‘shipment’

Attribute Type

Description

Example JSON

Shipment Shipped Date

Shipment Shipped date should be lesser than current date/time

Received Date

Shipment received date should be lesser than current date/time

Shipment Shipped Date Vs. Specimen Collection Date

Shipment Shipped date should be greater than the specimen collection date

 

Shipment Received Date Vs. Specimen Collection Date

Shipment received date should be greater than the specimen collection date

Shipment shipped Date Vs. Specimen Collection Date

Shipment shipped date should be greater than the specimen collection date, where the collection is date considered as one day earlier than actual.

Passing condition:

Shipped date:07-02-2023 00:00

Collection date:07-02-2023 22:14

Failed condition:

Shipped date:07-02-2023 00:00

Collection date:08-02-2023 02.14

Shipment shipped Date Vs. Specimen Collection Date

Shipment shipped date should be greater than the specimen collection date on specimen event page edit.

The regular expression of comparing shipped Vs collection date doesn’t work on Specimen Event page. To ensure the check validate on ‘Editing' the ‘Collection Event date and time’ this expression is used.

Shipment shipped Date Vs. Specimen Collection Date

The Shipment shipped date can be lesser than specimen collection date by 24 hours, not more than that.

Passing condition:

Shipped date:06-02-2023 20:00

Collection date:07-02-2023 18:14

Failed condition:

Shipped date:06-02-2023 20:00

Collection date:08-02-2023 22.14

 

Shipment shipped Date Vs. Specimen Collection Date

This expression only compares both shipped date Vs Collection Date and ignore the time attached to both fields.

Order

We can add edit checks on order fields using the record type as ‘order’

Attribute Type

Description

Example JSON

Attribute Type

Description

Example JSON

Distribution date

Order date should be lesser than current date/time

Distribution date Vs. Collection Date

Order date should be greater than the specimen collection date

Got feedback or spotted a mistake?

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