Now step back from the keyboard and get a pen and paper! First step is to note down the structure of the object you wish to build an archetype for. In this case we will consider an apple object. It has features such as colour, price, type, weight. How would you structure this? What data types would these attributes have? A simple mind mapping tool can be helpful at this stage:
To build this as an EN 13606 archetype, start by clicking on the New Archetype button . Give it a name. How about 'CEN13606-Apple.v1'. Unfold the archetype by clicking on the Fold/Unfold part of the Tree View on the little + button and then unfold on Definition and ENTRY. Left and right click on items and delete it as we won't need this. Left click then right click back on ENTRY, then click on the Add Data Group button in the menu . Unfold ENTRY again and you can see the new and yet to be named CLUSTER. This is how we add top level data groups. We will do that shortly but after adding some leaf node ELEMENTs so you can right click and delete this for now, or leave it and when we add ELEMENTs shortly you can move the order around.
To start to name things, click back in the tree in the Tree View on the left hand side pane again, for example on Definition. Left click now on ENTRY, then right click it, then click on the Add Local Term button . Call it 'Apple', then ok. We need to make the local code identifier to be 'at0000' for the LocalCode tag in the RHS. Then just type over the field containing 'at0002' or whatever in the Ontology pane at the bottom of the screen. Double click on the value to ready it for editing.
Highlight the ENTRY part of the tree again by left clicking on it, then right click , then click on the Add Element button in the menu . Unfold ENTRY again and you can see the new and yet to be named ELEMENT. Left, then right click on ELEMENT, then click on the Add Local Term button . We'll put 'Colour' here. In a similar way add 'Cost' and 'Weight' as ELEMENTS. Leave their type as the default 'mtAny' setting for now.
Add a CLUSTER (if you haven't left it there from before; by using the Add Data Group button on the right click menu) to ENTRY, as we have grouped ELEMENTS under 'Variety notes' in the mind map. So name the data group cluster. To this CLUSTER, add the final two ELEMENTs of 'Common name' and 'Best use' . The archetype should now look like this:
Now we can add some datatypes. The choices for colour will come from the list shown in the mindmap. Here's how we can do it. First click on the ELEMENT named 'Colour' in the Tree View, then move over to set the ADLMatchType in the RHS to mtReferenceSection by clicking on the adjacent pane to the tab name in the RHS and then on the down arrow that appears on the right of the box.
Unfold the Colour ELEMENT node (nodes are general name for parts of the tree identified uniquely with an atCode). Note a child concept has appeared called ReferenceSectionData. Click on this and on the RHS see the default tags which reading from top to bottom describe the allowing of textual values (like a CE HL7 datatype); the Choices tag - we'll come back to this; Default Index - don't worry about it; Display style allows display options including horizontal and vertical radio buttons; and (any) mapped HL7 datatypes.
To add the pull down menu choices, we first add them as nodes to the archetype, but not directly in the view of the structure shown in Tree View. Look at the Ontology pane at the bottom of the editor. window. See how term definitions are being built up as we go. We will deliberately add new terms now. Click on the Edit terms button back up in the menu at the top of the window . Click on the blue 'plus sign' button on the same line as TermDefinitions. A new row describing a node identifier called an atCode or in this case a LocalCode, appears. Complete the details, putting 'en' for English if that's your language, 'Green' for the Text and Description, and that's all. Click in another row to save the changes, and repeat for the colour 'Red'.
Close this window by clicking on the little door icon on the top left . Back in the Tree View, unfold the node named 'Colour' if necessary, click on ReferenceSectionData, then on the RHS, click on (Codes) in the box adjacent to Choices, then on the button. In the Selected codes or restraints window that appears, click on the button, find the term 'Green', then do the same for 'Red' and ok out.
Check on how things are looking by clicking on the Preview Archetype in editor button .
Close this and save your work. Do the same thing to create the choices for the node 'Common name', with choices to be 'Granny Smith,, 'Delicious', 'Jonathon' and 'Lady'. Lets look at the other nodes: 'Weight' is a Physical Quantity (PQ). The ADLMatchType for this on the RHS is mtQuantity. When you have created the 'child' node called QuantityData back in the Tree View, left and right click on this again, choose New Child and click on that. In the RHS type 'g' for grams in the box next to Units. In preview mode you can see that units of g are now present in the archetype/template. You can treat dollars as a PQ and do so for the 'Cost' node. Let it have two decimal places. To wrap up the datatypes for our apple archetype, make the node 'Common name' be of type mtReferenceSection like the node 'Colour' and refresh your memory from earlier in this section on how to add the appropriate new allowable choice terms and then do so.
Local terms may be bound to one or more terminologies, such as LOINC and SNOMED. Here's how to do it. Let's assume you have a license for SNOMED; click somewhere in the archetype tree in Tree View. Then click on the Edit terms button . Click on the row that contains the term 'Green'. Now click on the plus sign in the pane below. Double click in the Terminology pane and type 'SNOMED-CT', then next to it under Code, type '371246006', then 'Green' under Text. If you type a different value for text it will change the archetype's local term to be that term, so don't!