5: Create a Task That Runs Only If Certain Conditions Are Met
In this chapter you will add the three treatment plans. Execution of each treatment plan will depend on the results of the decisions – when a certain candidate is selected, some of these plans will run, while others will be discarded. You will also modify the Cancer treatment decision so that it will run only when cancer is diagnosed.
To download the process-description created in the previous chapter select File > Load Process Description From Web Repository. If you are logged in, the Load Process Description dialog appears; otherwise, you have to log in (if you don’t have a personal account, use the guest account: User Name = Guest; Password = testpass). Navigate to World\Tutorials and select and load Chapter04b_decision_modes.
1. Add Plans
Add three plans to the top-level plan. For detailed information about how to add a task see Step 3 of Chapter 1.
These plans will contain the different treatment protocols: gastrointestinal treatment, surgery and chemotherapy. Gastrointestinal treatment should be pursued if the patient is diagnosed with peptic ulcer; surgery and/or chemotherapy should be pursued if the patient is diagnosed with cancer.
To create a task that runs only if certain conditions are met, you have to define a precondition. A precondition is a truth-valued expression indicating the condition that has to be met for the task to run. A task’s precondition is examined by the Tallis Engine when its scheduling constraints are met. If at that time the precondition is false, the task is discarded.
For each of the plans, enter the information from one of the following tables:
| Instance Name: | Surgery_plan |
| Caption: | Surgery |
| Precondition: | result_set( Cancer_treatment_decision) includes Surgery |
Note: When creating preconditions (and other expressions) you can use the Expression Editor. Click the button to the right of the precondition field to display the Expression Editor. Select and double-click the requested function buttons and items; they will then populate the Tallis Condition field at the top.
| Instance Name: | Chemotherapy_plan |
| Caption: | Chemotherapy |
| Precondition: | result_set( Cancer_treatment_decision) includes Chemotherapy |
| Instance Name: | Gastrointestinal_treatment_plan |
| Caption: | Gastrointestinal treatment |
| Precondition: | result_of( Diagnosis_decision) = peptic_ulcer |
2. Add a precondition to the Cancer treatment decision
Select the Cancer treatment decision and enter the following expression in the precondition field:
| Precondition: | result_of( Diagnosis_decision) = cancer |
3. Add tasks to each plan
In this step you will add some content to the treatment plans.
In order to add a task to a plan, double-click the plan in the network view to show its contents. To go up one level, click the plan in the tree view.
Gastrointestinal treatment
Add an action to the Gastrointestinal treatment plan, and enter the following information:
| Instance Name: | GI_medication_action |
| Caption: | GI medication |
| Procedure: | Medication |
Surgery
Add an action to the Surgery plan, and enter the following information:
| Instance Name: | Refer_to_surgeon_action |
| Caption: | Refer to surgeon |
| Procedure: | Refer to surgeon |
Chemotherapy
Add an action to the Chemotherapy plan, and enter the following information:
| Instance Name: | Baseline_action |
| Caption: | Baseline |
| Procedure: | Record baseline information |
The chemotherapy treatment plan will be further developed in the next chapter.
4. Add Scheduling Constraints
Add scheduling constraints so that:
- The Gastrointestinal treatment plan runs after the Diagnosis decision completes
- The Surgery and the Chemotherapy plans run after the Cancer treatment decision completes
The figure below shows what the process-description should look like at this point.
5. Save the Process-Description
For more information about saving see Step 6 of Chapter 1.
6. Run the Process-Description in the Tallis Tester
For more information about running see Step 7 of Chapter 1.
Run the process-description to make sure that the appropriate task follows each decision:
- When you commit the peptic ulcer candidate of the Diagnosis decision, the Gastrointestinal treatment plan becomes in progress, while the Cancer treatment decision is discarded (a black icon indicates discarded tasks, which will no longer be executed).
- Note that the Surgery and the Chemotherapy plans are also discarded as a result.
- When you commit the cancer candidate of the Diagnosis decision, the Cancer treatment decision becomes in progress, while the Gastrointestinal treatment plan is discarded.
- When you commit the Surgery candidate of the Cancer treatment decision, the Surgery plan becomes in progress, while the Chemotherapy plan is discarded.
- When you commit the Chemotherapy candidate of the Cancer treatment decision, the Chemotherapy plan becomes in progress, while the Surgery plan is discarded.
- When you commit the Other candidate of the Cancer treatment decision, both the Surgery and the Chemotherapy plans are discarded.
Exit the Tester before going on to the next chapter.
