...
Expand |
---|
title | Click here to view details for the configuration.. |
---|
|
The code has three parts - records, forms and rules records - Whenever any of these specified records are modified; the constraint rules should be evaluated/enforced. This refers Refers to the fields at the data entry level at which the fields are present for which the edit check validation is to be applied. The value for records can be cpr, specimen, visit or a combination of these. forms - Optional field. If present, specifies the list of forms whose data is used to enforce the constraints. rules - List of integrity rules that should be satisfied by the records and forms.
A ‘rule’ is made up of three attributes when, expr, and description. when: The attribute 'when' is optional and specifies when the rule is applicable. For example, the rule is applicable only for primary specimens expr: The attribute 'expr' specifies the check constraint that should be satisfied. description: The attribute 'description' describes the constraint in user-friendly language. This is also used in error messages when the rule is broken or not satisfied.
Aliases for rules are - “cpr, visit, primarySpecimen, specimen”, which are self-explanator. Aliases for accessing the form records are cprForms, visitForms, primarySpecimenForms, specimenForms. These are maps that can be indexed by the form name to access the relevant form data. For example, specimenForms['SpecimenFrozenEvent'] can be used to access the latest frozen event. Similarly, specimenForms['SpecimenFrozenEvent$Array'] can be used to access the list of all the frozen events for the specimen in question.
|
Example: Visit date should be same or later than the registration date
For more examples, please refer to the wiki page Data Validation Examples
Expand |
---|
title | Click here to view details.. |
---|
|
Code Block |
---|
| {
"name" : "editChecks",
"data" : {
"constraints" : [
{
"records" : [ "cpr", "visit" ],
"rules" : [
{
"expr" : "#cpr.registrationDate != null && #visit.visitDate != null && !#cpr.registrationDate.after(#visit.visitDate)",
"description" : "Visit date should be same or later than the registration date!"
}
]
}
]
}
} |
|
Data Validation Fields
We can set up data validation on these 3 types of fields and their combinations:
Core fields
Custom fields
Custom form fields
Combination of the core fields, custom fields, custom form fields
Expand |
---|
title | Field dictionary used to create the expression in data validations |
---|
|
Level | Field Name | Field Expression |
---|
Participant | PPID | | Participant | First Name | Code Block |
---|
| #cpr.participant.firstName |
| Participant | Middle Name | Code Block |
---|
| #cpr.participant.middleName |
| Participant | Last Name | Code Block |
---|
| #cpr.participant.lastName |
| Participant | Registration Date | Code Block |
---|
| #cpr.registrationDate |
| Participant | External Subject ID | Code Block |
---|
| #cpr.externalSubjectId |
| Participant | Registration Site | | Participant | Birth Date | Code Block |
---|
| #cpr.participant.birthDate |
| Participant | Social Security Number | Code Block |
---|
| #cpr.participant.uid |
| Participant | eMPI | Code Block |
---|
| #cpr.participant.empi |
| Participant | Gender | Code Block |
---|
| #cpr.participant.gender |
| Participant | Vital Status | Code Block |
---|
| #cpr.participant.vitalStatus |
| Participant | Death Date |
|
...
Code Block |
---|
| #cpr.participant.deathDate |
| Participant | Races | Code Block |
---|
| #cpr.participant.races |
| Participant | Ethnicity | Code Block |
---|
| #cpr.participant.ethnicities |
| Participant | MRN | Code Block |
---|
| #cpr.participant.pmis |
| Visit | Name | Code Block |
---|
| #cpr.participant.pmis |
| Visit | Name | | Visit | Status | | Visit | Missed By | Code Block |
---|
| #visit.missedBy |
| Visit | Missed Reason | Code Block |
---|
| #visit.missedReason |
| Visit | Visit Date | Code Block |
---|
| #visit.visitDate |
| Visit | Visit Site | | Visit | Clinical Diagnosis | Code Block |
---|
| #visit.clinicalDiagnoses |
| Visit | Clinical Status | Code Block |
---|
| #visit.surgicalPathologyNumber |
| Visit | SPR | Code Block |
---|
| #visit.clinicalStatus |
| Visit | Visit Comments | Code Block |
---|
| #visit.comments |
| Specimen | Label | Code Block |
---|
| #specimen.label |
| Specimen | Barcode | Code Block |
---|
| #specimen.barcode |
| Specimen | Lineage | Code Block |
---|
| #specimen.lineage |
| Specimen | Collection Status | Code Block |
---|
| #specimen.status |
| Specimen | Type | | Specimen | Anatomic Site | Code Block |
---|
| #specimen.anatomicSite |
| Specimen | Laterality | Code Block |
---|
| #specimen.laterality |
| Specimen | Pathology Status | Code Block |
---|
| #specimen.pathology |
| Specimen | Initial Qty | Code Block |
---|
| #specimen.initialQty |
| Specimen | Available Qty | Code Block |
---|
| #specimen.availableQty |
| Specimen | Concentration | Code Block |
---|
| #specimen.concentration |
| Specimen | Parent Specimen Label | Code Block |
---|
| #specimen.parentLabel |
| Specimen | Biohazard | Code Block |
---|
| #specimen.biohazards |
| Specimen | Location | Code Block |
---|
| #specimen.storageLocation |
| Specimen | Created On | Code Block |
---|
| #specimen.createdOn |
| Specimen | Freezer Thaw Cycle | Code Block |
---|
| #specimen.freezeThawCycles |
| Specimen | Increment Freeze Thaw Cycle | Code Block |
---|
| #specimen.incrParentFreezeThaw |
| Specimen | Comments | Code Block |
---|
| #specimen.comments |
| Specimen | Collection Date | Code Block |
---|
| #specimen.collectionEvent.time |
| Specimen | Collector | Code Block |
---|
| #specimen.collectionEvent.user |
| Specimen | Received Date | Code Block |
---|
| #specimen.receivedEvent.time |
| Specimen | Receiver | Code Block |
---|
| #specimen.receivedEvent.user |
| Specimen | Collection Container | Code Block |
---|
| #specimen.collectionEvent.container |
| Specimen | Collection Procedure | Code Block |
---|
| #specimen.collectionEvent.procedure |
| Specimen | Received Quality | Code Block |
---|
| #specimen.receivedEvent.receivedQuality |
| Specimen | Frozen Time | Code Block |
---|
| #specimen.events.SpecimenFrozenEvent.time |
| Specimen | Frozen Method | Code Block |
---|
| #specimen.events.SpecimenFrozenEvent.frozenMethod |
| Specimen | Frozen Comments | Code Block |
---|
| #specimen.events.SpecimenFrozenEvent.comments |
|
|
Adding Multiple Data Validations
In case there are many edit checks data validations to be performed, here is a tip that could help in avoiding errors:
Check and test the data entry workflow after adding each edit checkvalidation. This will allow you to identify if any edit check validation fails and will be useful in rectifying the failed one. In case If all the edit checks validation are added together, it might will be difficult to identify the edit check validation in case the above error ‘Cannot index into a null value’ occurs.