1	--
2	-- Example fragment of an openEHR Archetype, written in cADL, a subsyntax of the Archetype Definition Language (ADL)
3	-- definition available here: http://www.openehr.org/releases/trunk/architecture/am/adl2.pdf
4	--	Author: Thomas Beale
5	--
6
7	EVALUATION[id1] matches {	-- Adverse Reaction
8		data matches {
9			ITEM_TREE[id2] matches {
10				items cardinality matches {1..*; unordered} matches {
11					ELEMENT[id3] matches {	-- Substance/Agent
12						value matches {
13							DV_TEXT[id51]
14						}
15					}
16					ELEMENT[id5] occurrences matches {0..1} matches {	-- Absolute Contraindication?
17						value matches {
18							DV_BOOLEAN[id52] matches {
19								value matches {True}
20							}
21						}
22					}
23					ELEMENT[id50] occurrences matches {0..1} matches {	-- Future Use
24						value matches {
25							DV_TEXT[id53]
26						}
27					}
28					ELEMENT[id7] occurrences matches {0..1} matches {	-- Overall Comment
29						value matches {
30							DV_TEXT[id54]
31						}
32					}
33					CLUSTER[id10] matches {	-- Reaction Event
34						items matches {
35							ELEMENT[id11] occurrences matches {0..1} matches {	-- Specific Substance/Agent
36								value matches {
37									DV_TEXT[id55]
38								}
39							}
40							ELEMENT[id12] matches {	-- Manifestation
41								value matches {
42									DV_TEXT[id56]
43								}
44							}
45							ELEMENT[id17] occurrences matches {0..1} matches {	-- Reaction Type
46								value matches {
47									DV_TEXT[id57]
48								}
49							}
50							ELEMENT[id22] occurrences matches {0..1} matches {	-- Certainty
51								value matches {
52									DV_CODED_TEXT[id58] matches {
53										defining_code matches {[ac1]}		-- Certainty (synthesised)
54									}
55								}
56							}
57							ELEMENT[id13] occurrences matches {0..1} matches {	-- Reaction Description
58								value matches {
59									DV_TEXT[id59]
60								}
61							}
62							ELEMENT[id28] occurrences matches {0..1} matches {	-- Onset of Reaction
63								value matches {
64									DV_DATE_TIME[id60]
65								}
66							}
67							ELEMENT[id29] occurrences matches {0..1} matches {	-- Duration of Reaction
68								value matches {
69									DV_DURATION[id61]
70								}
71							}
72							allow_archetype CLUSTER[id30] matches {	-- Additional Reaction Detail
73								include
74									archetype_id/value matches {/openEHR-EHR-CLUSTER\.anatomical_location(-a-zA-Z0-9_]+)*\.v1/}
75							}
76							ELEMENT[id19] occurrences matches {0..1} matches {	-- Exposure Description
77								value matches {
78									DV_TEXT[id62]
79								}
80							}
81							ELEMENT[id21] occurrences matches {0..1} matches {	-- Earliest Exposure
82								value matches {
83									DV_DATE_TIME[id63]
84								}
85							}
86							ELEMENT[id26] occurrences matches {0..1} matches {	-- Duration of Exposure
87								value matches {
88									DV_DURATION[id64]
89								}
90							}
91							allow_archetype CLUSTER[id20] matches {	-- Additional Exposure Detail
92								include
93									archetype_id/value matches {/openEHR-EHR-CLUSTER\.amount(-a-zA-Z0-9_]+)*\.v1|openEHR-EHR-CLUSTER\.medication_admin(-a-zA-Z0-9_]+)*\.v1|openEHR-EHR-CLUSTER\.timing(-a-zA-Z0-9_]+)*\.v1/}
94							}
95							ELEMENT[id41] occurrences matches {0..1} matches {	-- Clinical Management Description
96								value matches {
97									DV_TEXT[id65]
98								}
99							}
100							ELEMENT[id32] matches {	-- Multimedia
101								value matches {
102									DV_MULTIMEDIA[id66] matches {
103										media_type
104									}
105								}
106							}
107							allow_archetype CLUSTER[id42] matches {	-- Reporting Details
108								include
109									archetype_id/value matches {/.*/}
110							}
111							ELEMENT[id33] occurrences matches {0..1} matches {	-- Reaction Comment
112								value matches {
113									DV_TEXT[id67]
114								}
115							}
116						}
117					}
118				}
119			}
120		}
121		protocol matches {
122			ITEM_TREE[id43] matches {
123				items matches {
124					ELEMENT[id45] occurrences matches {0..1} matches {	-- Reaction Reported?
125						value matches {
126							DV_BOOLEAN[id68] matches {
127								value matches {True, False}
128							}
129						}
130					}
131					ELEMENT[id49] occurrences matches {0..1} matches {	-- Report Comment
132						value matches {
133							DV_TEXT[id69]
134						}
135					}
136					ELEMENT[id46] matches {	-- Adverse Reaction Report
137						value matches {
138							DV_URI[id70]
139						}
140					}
141					ELEMENT[id48] occurrences matches {0..1} matches {	-- Supporting Clinical Record Information
142						value matches {
143							DV_EHR_URI[id71]
144						}
145					}
146				}
147			}
148		}
149	}
150