To ensure the logic you provided in a rule is correct, there is a Test Rule feature. This feature simply allows you to confirm that the rule is actually testing the feature you wanted to test. To fully test your rules, it is best practice to enter test data for a test subject.
Ensure the rule is uploaded to OpenClinica:
1. Complete writing the rule
2. Log into OpenClinica
3. Select Tasks > Build Study
4. On the Create Rules row of the Build Study page, click
The following window displays:
5. Click Browse, then locate and Open the XML file containing the rule to be uploaded. You may only upload one file at a time.
6. Click Continue, this will prompt the system to check the validity of the rule
7. If the rule is valid, a successful confirmation message is displayed. To save the rule in OpenClinica, you must select “Continue.” Otherwise, click “Cancel.”
8. If the rule in invalid, the system displays an error message containing the source of errors. Note that for invalid rules there is no “Continue” button; “Cancel” is the only option at the bottom of the page.
9. Repeat step 1-7 as necessary to upload a new file/ update an invalid rule.
Testing Rules Expression in OpenClinica
In order to make creating/managing Rules easier, OpenClinica provides you with a tool to execute rules in a test environment. With the Test Rule page you will be able to modify, edit and run the rules for the desired results. You will be presented with a real time response on the validity of your test rules before uploading them into OpenClinica.
Once the rules get uploaded successfully to OpenClinica, you can verify the validity of the rule by:
1. On the Build Study page, click the View icon to access the Manage Rules for <<Study Name>> page. Click here for more information regarding the Manage Rules page.
2. Locate the rule that you wish to validate and test
3. Under the “Actions” column of that rule, click the “Test” icon
4. You will be prompted to the Test Rules page (see below). The Test Rules page allows you to enter specific information about the rule you want to test.
- Enter Target Name: This would be the same statement element as the Target element in RuleAssignment in the XML file
- Enter the Rule Expression: This would be the same element as the expression element in the RuleDef element in the XML file.
- Select the evaluation action from the drop-down true or false
5. Click Validate and Test
6. Note: If the rule is valid, you will be told whether it will pass with a True or False result. You also have the ability to specify test values for variables in your expression and re-test the rule. If the rule is valid, then a successful confirmation message is displayed. Also, addditional sections named “Step 2” and “Step 3” are displayed (see below). If a rule is invalid, OpenClinica will provide you with feedback in the form of an error message with information on why your rule was considered invalid.
7. Now, you can specify the test values for variables in the rule expression at your discreton and verify if the rule functions as expected by clicking “Validate and Save”. Repeat this step as necessary.