Dependencies between sources
In this tutorial you will work with a process-description that contains an enquiry called enquiry1. This enquiry has four sources:
- Gender – a text source with two range values: Male, Female (default value is Male)
- Pregnancy – Is the patient pregnant? – a text source with three range values: Yes, No, Maybe
- OCP – Has the patient ever been on the oral contraceptive pill? – a text source with two values: Yes, No (default value is No)
- OCP_duration – Duration of OCP use (in years) – a real source
You can either create this process-description yourself, or download the ready-made WEC_tutorial3 from the World > Tutorials > Customisation_samples folder in the ACL Web Repository.
1. Run the Process-Description Locally in a Web Browser
For more information on running a process-description locally see step 1 of tutorial 1.
The four sources are displayed on the screen in alphabetical order.
Enter the requested data and click Confirm to complete the process.
2. Create a Mapping File
In Apache Software Foundation\Tomcat 5.0\webapps\CustomTallis\customisations\mappings you will find examples of mapping files. Open the file entitled tutorial3mapping.xml.
The mapping file identifies the four sources, and defines an optional position attribute for each source. This attribute determines the position of the sources on the screen. The current settings mean that the order of the sources will now be Gender, Pregnancy, OCP, OCP_duration.
Apart from the sources tag, the enquiry tag also contains a dependency tag. The Pregnancy source is nested within this tag. The source and keyword attributes of this tag determine a source and its value for which the nested source would be disabled. In our example, if the patient is a man, he shouldn't be asked about pregnancy.
3. Point to the Mapping File
In the Context field of the top-level plan of the process-description, type the following lines:
#metadata
tallis.content=/customisations/mappings/tutorial3mapping.xml
4. Run the Process-Description Locally in a Web Browser
Run the process-description.
Going from left to right and from top to bottom, the Gender source is displayed first, then Pregnancy, OCP and then OCP_duration. The Pregnancy source is disabled.
Selecting Female for the Gender source will enable the Pregnancy source.
5. Create a Dependency Between OCP and Gender
Modify the mapping file so that a male patient isn't asked about Gender or OCP.
To achieve this, all you have to do is add the OCP source to the nested Pregnancy source in the dependency tag:
<pf:dependency source="Gender" keyword="Male">Pregnancy OCP</pf:dependency>
Run the process-description in a web-browser to test your changes.
6. Create a Dependency Between OCP_duration and OCP
Modify the mapping file so that the OCP_duration source will be disabled as long as the OCP value is No.
This entails adding another dependency tag:
<pf:dependency source="OCP" keyword="No">OCP_duration</pf:dependency>
Run the process-description in a web-browser to test your changes.