Versions Compared

Key

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

...

Attribute Type

Description

Example JSON

Date

Registration Date vs. Collection Date

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

Code Block
{
          "when" : "#specimen.status == 'Collected'",
          "expr" : "!#cpr.registrationDate.after(#specimen.collectionEvent.time)",
          "description" : "The specimen #specimen.label (#specimen.type) collection date should be same or later than the registration date!"
}

Dropdown custom

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

Code Block
{
          "when" : "#specimen.status == 'Collected' && #specimen.specimenClass == 'Tissue'",
          "expr" : "#specimen.anatomicSite == 'Brain, NOS' || #specimen.anatomicSite == 'Abdomen, NOS'",
          "description" : "Anatomic site should be Brain NOS or Abdomen NOS for tissue samples"
        }

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'

Code Block
{
      "records" : [ "specimen", "cpr", "visit" ],
      "rules" : [
        {
          "when" : "#cpr.participant.gender == 'Male' && #specimen.status == 'Collected' && #visit.eventLabel == 'Baseline'",
          "expr" : "!{'Female genital tract, NOS', 'Overlapping lesion of female genital organs', 'Other specified parts of female genital organs', 'Breast, NOS'}.contains(#specimen.anatomicSite)",
          "description" : "CORE GEN AS: Check the Gender ASite COMBO"
        }
     ]
    }

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.)

Code Block
{
      "records" : [ "visit", "specimen" ],
      "rules" : [ {
        "when" : "#visit.visitDate != null &&  #visit.status == 'Complete' && #specimen.collectionEvent.time != null && #specimen.status == 'Collected'",
        "expr" : "#formatDate(#visit.visitDate,'yyyyMMdd') == #formatDate(#specimen.collectionEvent.time,'yyyyMMdd')",
        "description" : "Correct the visit date to the  specimen collection date"
      } ]
    }

Specimen Event Field

To validate that the value of the specimen spun event’s gForce should be 500 for specific workflow = ‘cfDNA-2D' and its specific task = 'spin_tubes1’

Code Block
"records" : [ "specimen" ],
      "forms" : {
        "specimen" : [ "SpecimenSpunEvent" ]
      },
      "rules" : [ {
        "when" : "#collFns.isNotEmpty(#specimenForms['SpecimenSpunEvent$Array']) && #specimen.lineage == 'New' && #specimen.type == 'Volbloed (wholeblood)' && #workflow != null && #workflow.shortCode == 'cfDNA-2D' && #task != null && #task.name == 'spin_tubes1'",
        "expr" : "#collFns.forEvery(#specimenForms['SpecimenSpunEvent$Array'][#specimenForms['SpecimenSpunEvent$Array'].size() - 1], 'SpunEvent', \"#SpunEvent['gForce'] == 500\")",
        "description" : "Speed should be 500 g.",
        "type" : "SOFT"
      } ]


Shipment page examples

Attribute Type

Description

Example JSON

Shipment Shipped Date

Shipment Shipped date should be lesser than current date/time

Code Block
{
"records": ["shipment"],
                "rules": [
                  {
                    "when": "#shipment.status != 'Pending'",
                    "expr": "#cmp(#shipment.shippedDate, #currentTime()) <= 0",
                    "description": "1. Shipment date should be lesser than current date/time"
                  }
                ]
 },

Received Date

Shipment received date should be lesser than current date/time

Code Block
{
"records": ["shipment"],
                "rules": [
                  {
                    "when": "#shipment.status == 'Received'",
                    "expr": "#cmp(#shipment.receivedDate, #currentTime()) <= 0",
                    "description": "2. 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

Code Block
  {"records": ["shipment", "shipmentSpecimen"],
                "rules": [
                  {
                    "when": "#shipment.status != 'Pending' && #shipment.shippedDate != null",
                    "expr": "#cmp(#shipment.shippedDate, #specimen.collectionEvent.time) >= 0",
                    "description": "3. Shipment date should be greater than the specimen (#specimen.label) collection date"
                  }
                ]
                },

Shipment Received Date Vs. Specimen Collection Date

Shipment received date should be greater than the specimen collection date

Code Block
  {
  "records": ["shipment", "shipmentSpecimen"],
                "rules": [
                       {
                    "when": "#shipment.status != 'Pending' && #shipment.receivedDate != null",
                    "expr": "#cmp(#shipment.receivedDate, #specimen.collectionEvent.time) >= 0",
                    "description": "4. Shipment receive date should be greater than the specimen (#specimen.label) 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

Code Block
   {
                "records": ["shipment", "shipmentSpecimen"],
                "rules": [
                  {
                    "when": "#shipment.status != 'Pending' && #shipment.shippedDate != null",
                    "expr": "(#shipment.shippedDate.getTime() - (#specimen.collectionEvent.time.getTime() - 24 * 60 * 60 * 1000)) >= 0",
                    "description": "Shipment 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 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.

Code Block
{
  "records" : [ "specimen" ],
  "forms" : {
    "specimen" : [ "SpecimenShipmentShippedEvent" ]
  },
  "rules" : [ {
    "when" : "#specimenForms != null && #specimenForms['SpecimenShipmentShippedEvent'] != null",
    "expr": "#collFns.forEvery(#specimenForms['SpecimenShipmentShippedEvent$Array'], 'se', \"#se['time'].after(#specimen.collectionEvent.time)\")",
    "description" : "Shipment date should be later than the collection date."
  } ]
}

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

Code Block
{
   "records": ["shipment", "shipmentSpecimen"],
     "rules": [
                {
                   "when": "#shipment.status != 'Pending' && #shipment.shippedDate != null",
                    "expr": "(#shipment.shippedDate.getTime() - #specimen.collectionEvent.time.getTime()) >= -86400000",
                    "description": "Shipment shipped date cannot occur more than 24 hours before the Specimen collection date."
                }
              ]
}

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.

Code Block
{
               "records": ["shipment", "shipmentSpecimen"],
               "rules": [
                 {
                   "when": "#shipment.status != 'Pending' && #shipment.shippedDate != null",
                   "expr": "#shipment.shippedDate.getYear() > #specimen.collectionEvent.time.getYear() || (#shipment.shippedDate.getYear() == #specimen.collectionEvent.time.getYear() && #shipment.shippedDate.getMonth() > #specimen.collectionEvent.time.getMonth()) || (#shipment.shippedDate.getYear() == #specimen.collectionEvent.time.getYear() && #shipment.shippedDate.getMonth() == #specimen.collectionEvent.time.getMonth() && #shipment.shippedDate.getDate() >= #specimen.collectionEvent.time.getDate())",
                   "description": "Shipment date should be greater than the specimen collection date"
                 }
               ]
 }

...