# openEHR-tool

**URL:** <https://discourse.openehr.org/t/openehr-tool/3108>\
**Category:** Tools\
**Tags:** rest-apis\
**Created:** [28 October 2022 08:30 UTC](https://discourse.openehr.org/t/openehr-tool/3108 "2022-10-28T08:30:03Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![linforest](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/l/ac8455/32.png) [@linforest](https://discourse.openehr.org/u/linforest)\
**Post date:** [27 August 2024 08:12 UTC](https://discourse.openehr.org/t/openehr-tool/3108/22 "2024-08-27T08:12:54Z")

</div>

I would have liked to have assumed that when v0 was still in effect, I would have found all the old versions of Archetype(s) in the CKM and could have downloaded them and copied them into my local CKM repo, but not all of the old Archetype(s) existed in the CKM, such as **openEHR-EHR-CLUSTER.structured\_name.v0** shown in the following Error dialog.

 ![image](https://discourse.openehr.org/uploads/default/original/2X/5/5cd18b4df0e856164f5b2c33b79390617148fa45.png)

---

<div class="post-metadata">

**Author:** ![ian.mcnicoll](https://discourse.openehr.org/user_avatar/discourse.openehr.org/ian.mcnicoll/32/4430_2.png) [@ian.mcnicoll](https://discourse.openehr.org/u/ian.mcnicoll)\
**Post date:** [27 August 2024 08:24 UTC](https://discourse.openehr.org/t/openehr-tool/3108/23 "2024-08-27T08:24:38Z")

</div>

It is still in CKM, just superceded and so not normally visible.

To find it …

![image](https://discourse.openehr.org/uploads/default/original/2X/2/25291860cb80cb043ce14723a6f9ba1546893e65.png)

then click on Published only, so that all versions becomes visible.

![image](https://discourse.openehr.org/uploads/default/original/2X/9/9bc8742595327a39796b89983c164e87c880c3aa.png)

THen scroll right to find the v0 revisions . You can download from there, though it might be tricky to find exactly the correct revision that was used for the .oet

Alternatively, down load the template filset from the Cause of Death .oet export - that should hook up to the correct archetype.

I think it is correct for CKM to limit export to current revisions BTW.

---

<div class="post-metadata">

**Author:** ![linforest](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/l/ac8455/32.png) [@linforest](https://discourse.openehr.org/u/linforest)\
**Post date:** [27 August 2024 08:44 UTC](https://discourse.openehr.org/t/openehr-tool/3108/24 "2024-08-27T08:44:39Z")

</div>

Got it. Thank you so much! I can find the older versions now although some were potentially renamed, such as **openEHR-EHR-CLUSTER.structured\_name.v0**.

Never mind. Please don’t waste your valueable time any more for this. I was just curious 😀

---

<div class="post-metadata">

**Author:** ![ian.mcnicoll](https://discourse.openehr.org/user_avatar/discourse.openehr.org/ian.mcnicoll/32/4430_2.png) [@ian.mcnicoll](https://discourse.openehr.org/u/ian.mcnicoll)\
**Post date:** [27 August 2024 08:49 UTC](https://discourse.openehr.org/t/openehr-tool/3108/25 "2024-08-27T08:49:38Z")

</div>

No worries. It is useful to document this stuff for a wider audience.

Keep asking these great questions!!

---

<div class="post-metadata">

**Author:** ![linforest](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/l/ac8455/32.png) [@linforest](https://discourse.openehr.org/u/linforest)\
**Post date:** [27 August 2024 10:03 UTC](https://discourse.openehr.org/t/openehr-tool/3108/26 "2024-08-27T10:03:11Z")

</div>

Using openEHR-tool, an example Composition XML([Example-Data-Linkoping\_University\_Physical\_Activity-Pretty.xml](https://discourse.openehr.org/uploads/short-url/ukCQOlHcOSvhB4ARNgWFwOpfOSN.xml) (44.6 KB)) was created mainly based on \*\* Cluster-focused models\*\* in [/proposals/2019-07-12\_clst](https://github.com/regionostergotland/Physical_activity/tree/master/proposals/2019-07-12_clst) from [Erik Sundvall](https://discourse.openehr.org/u/erik.sundvall) 's team.

When trying to Post an example Composition XML, I got a 422 error as followings:

 ![image](https://discourse.openehr.org/uploads/default/original/2X/3/3ad364f154f88c875c6dcc191958ad4ee2e4d942.png)

 ![image](https://discourse.openehr.org/uploads/default/original/2X/2/2da3058f610de202060de1f4cc25e71116701833.png)

---

<div class="post-metadata">

**Author:** ![ian.mcnicoll](https://discourse.openehr.org/user_avatar/discourse.openehr.org/ian.mcnicoll/32/4430_2.png) [@ian.mcnicoll](https://discourse.openehr.org/u/ian.mcnicoll)\
**Post date:** [27 August 2024 10:06 UTC](https://discourse.openehr.org/t/openehr-tool/3108/27 "2024-08-27T10:06:28Z")

</div>

You need to add at least one valid item under the `data` tree - see Erik’s original xml

```auto
	<events xsi:type="INTERVAL_EVENT" archetype_node_id="at1036">
				<name>
					<value>Maximum</value>
				</name>
				<time>
					<value>2022-02-03T04:05:06</value>
				</time>
				<data xsi:type="ITEM_TREE" archetype_node_id="at0001">
					<name>
						<value>structure</value>
					</name>
					<items xsi:type="ELEMENT" archetype_node_id="at1005">
						<name xsi:type="DV_CODED_TEXT">
							<value>Pulse presence</value>
							<defining_code>
								<terminology_id>
									<value>local</value>
								</terminology_id>
								<code_string>at1045</code_string>
							</defining_code>
						</name>
						<value xsi:type="DV_CODED_TEXT">
							<value>Present</value>
							<defining_code>
								<terminology_id>
									<value>local</value>
								</terminology_id>
								<code_string>at1024</code_string>
							</defining_code>
						</value>
			

```

---

<div class="post-metadata">

**Author:** ![linforest](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/l/ac8455/32.png) [@linforest](https://discourse.openehr.org/u/linforest)\
**Post date:** [27 August 2024 10:11 UTC](https://discourse.openehr.org/t/openehr-tool/3108/28 "2024-08-27T10:11:15Z")

</div>

Thanks a lot, Ian. I’ll give it a try tomorrow morning 😀

---

<div class="post-metadata">

**Author:** ![linforest](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/l/ac8455/32.png) [@linforest](https://discourse.openehr.org/u/linforest)\
**Post date:** [29 August 2024 03:11 UTC](https://discourse.openehr.org/t/openehr-tool/3108/29 "2024-08-29T03:11:39Z")

</div>

> [@ian.mcnicoll](#):
>
> You need to add at least one valid item under the `data` tree

Just followed your guidance and added two **data items** to the state element at the end, and the Composition POST operation was successful (response status code: 204). Thank you very much for your help.

However, I still don’t quite understand the actual clinical/business meaning of the data items I’ve added.

In this case, does the state at the end say that the minimum values of Ambient Temperature and Relative Humidity are 11.0 °C and 25% respectively within the specified time range (event time = 2022-02-03T04:05:06; time width = PT42H)?

**Snippet for fixing the xml** :

```auto
<state archetype_node_id="at0106">
	<name>
		<value>History</value>
	</name>
	<origin>
		<value>2022-02-03T04:05:06</value>
	</origin>
	<period>
		<value>PT0S</value>
	</period>
	<duration>
		<value>PT0S</value>
	</duration>
	<events xsi:type="INTERVAL_EVENT" archetype_node_id="at0107">
		<name>
			<value>Minimum</value>
		</name>
		<time>
			<value>2022-02-03T04:05:06</value>
		</time>				
		<width>
			<value>PT42H</value>
		</width>
		<math_function>
			<value>minimum</value>
			<defining_code>
				<terminology_id>
					<value>openehr</value>
				</terminology_id>
				<code_string>145</code_string>
			</defining_code>
		</math_function>
		<data xsi:type="ITEM_TREE" archetype_node_id="at0001">
			<name>
				<value>structure</value>
			</name>
			<items xsi:type="ELEMENT" archetype_node_id="at0001">
				<name>
					<value>Ambient Temperature</value>
				</name>
				<value xsi:type="DV_QUANTITY">
					<magnitude>11.0</magnitude>
					<units>°C</units>
				</value>
			</items>
			<items xsi:type="ELEMENT" archetype_node_id="at0002">
				<name>
					<value>Relative humidity</value>
				</name>
				<value xsi:type="DV_QUANTITY">
					<magnitude>25.0</magnitude>
					<units>%</units>
				</value>
			</items>
		</data>
	</events>
</state>

```

**Where the state node resides in my template** :

 ![image](https://discourse.openehr.org/uploads/default/original/2X/8/8a9c10acbfc82579eff9c3a6a179e424f07ec071.png)

**The Example Instance (Composition) used above**:

[Example-Data-Linkoping\_University\_Physical\_Activity-Pretty-240829-1005.xml](https://discourse.openehr.org/uploads/short-url/sOdCzBEViBiqQJ9vBv87Y2USbxG.xml) (45.3 KB)

---

<div class="post-metadata">

**Author:** ![ian.mcnicoll](https://discourse.openehr.org/user_avatar/discourse.openehr.org/ian.mcnicoll/32/4430_2.png) [@ian.mcnicoll](https://discourse.openehr.org/u/ian.mcnicoll)\
**Post date:** [29 August 2024 15:35 UTC](https://discourse.openehr.org/t/openehr-tool/3108/30 "2024-08-29T15:35:53Z")

</div>

Hi Lin,

You are almost there and I can see why you are confused.

The generated composition example is obviously dummy data and has populated every single data point in the composition structure.

In doing so, It has populated a couple of structures that although legal in the RM, so far have not been used or represented in archetype tools, and TBH possibly never will.

The main problem that is confusing you is that ‘state’ can be captured in 2 different ways.

see this part of the spec [Data Structures Information Model](https://specifications.openehr.org/releases/RM/Release-1.1.0/data_structures.html#_state)

> In openEHR there are two ways of recording state. One is via the use of a separate `HISTORY` structure within the `OBSERVATION` class (see `ehr.composition.content.entry` package). The other is via the use of the state attribute of type `ITEM_STRUCTURE` defined in the class `EVENT` itself. Experience with openEHR archetypes and systems has shown that the latter method corresponds to the most common clinical need…

The problem you are seeing is that the composition example has populated the second, much less common way of handling state.

The 'normal way , supported by Archetype Designer is  
OBSERVATION  
data  
event[n]  
data  
state  
protocol

Whereas you can do (in theory)  
OBSERVATION  
state  
event[n]  
data  
protocol

I’m not clear in my own mind whether the example generator is actuially over-enthusiastic or just plain wrong!!

But fndamentally, I would have expected the state items to be inside the top datra tree, not alongside it. That would be the normal pattern of use and lines up with the template.

OBSERVATION  
data  
event[n]  
data  
state ←   
protocol

I can’t find any examples ofvthsecond way of using state but from memory it was supposed to help with some sport medicine research. As I said I’ve never used it in practice.

Let me know if you are still stuck and I’ll try to fix the example myself

---

<div class="post-metadata">

**Author:** ![linforest](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/l/ac8455/32.png) [@linforest](https://discourse.openehr.org/u/linforest)\
**Post date:** [29 August 2024 21:25 UTC](https://discourse.openehr.org/t/openehr-tool/3108/31 "2024-08-29T21:25:08Z")

</div>

Thank you very vey much for your valuable and detailed guidance. Such a practice-based experience summary is pretty nutritious, quite beneficial for efficient learning and rapid growth of newcomers, and also helps to form systematic patterns and/or best practices. ❤

---

<div class="post-metadata">

**Author:** ![linforest](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/l/ac8455/32.png) [@linforest](https://discourse.openehr.org/u/linforest)\
**Post date:** [30 August 2024 01:20 UTC](https://discourse.openehr.org/t/openehr-tool/3108/32 "2024-08-30T01:20:34Z")

</div>

> [@ian.mcnicoll](#):
>
> The generated composition example is obviously dummy data and has populated every single data point in the composition structure.
> 
> In doing so, It has populated a couple of structures that although legal in the RM, so far have not been used or represented in archetype tools, and TBH possibly never will.

Indeed, most data can be as simple and straightforward as the following [vital signs template](https://ckm.openehr.org/ckm/templates/1013.26.380) shows:

 ![image](https://discourse.openehr.org/uploads/default/original/2X/a/a32d89fee0685bc2d7b01059ae4bba05f9a6cd85.png)

> [@ian.mcnicoll](#):
>
> Let me know if you are still stuck and I’ll try to fix the example myself

In view of my own practical experience, I still need to digest and understand your detailed explanation and instructions, in combination with the actual hands-on exercises, and the replies and examples you provided in other related posts. Thanks a lot, @ian.mcnicoll !

---

<div class="post-metadata">

**Author:** ![linforest](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/l/ac8455/32.png) [@linforest](https://discourse.openehr.org/u/linforest)\
**Post date:** [30 August 2024 02:27 UTC](https://discourse.openehr.org/t/openehr-tool/3108/33 "2024-08-30T02:27:51Z")

</div>

> [@surfer](#):
>
> ![postcomp](https://discourse.openehr.org/uploads/default/original/2X/d/d95f22105ba88a2c96d5f60a467385d9488f917f.png)

@surfer  
In terms of the openEHR-tool’s UI, users don’t necessarily enter the relevant data or set the corresponding options in top-down order, but whenever they submit the file they want to upload, the values of the other data entry controls on the page will be reset, which could be inconvenient from my personal experience. For example, the drop-down list of templates in this screenshot is like this. So, is it necessary to consult other users and decide whether such an UI behavior needs to be impoved?

---

<div class="post-metadata">

**Author:** ![surfer](https://discourse.openehr.org/user_avatar/discourse.openehr.org/surfer/32/2326_2.png) [@surfer](https://discourse.openehr.org/u/surfer)\
**Post date:** [30 August 2024 05:07 UTC](https://discourse.openehr.org/t/openehr-tool/3108/34 "2024-08-30T05:07:14Z")

</div>

unfortunately you have to choose the file first and click submit then fill out the other field in any order otherwise, as you pointed out, you lose all the previous field input in the lower part of the screen under “Submit”.

Well, to improve user experience I could hide the fields under “Commit” and make them appear after the file has been chosen and committed.

---

<div class="post-metadata">

**Author:** ![linforest](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/l/ac8455/32.png) [@linforest](https://discourse.openehr.org/u/linforest)\
**Post date:** [30 August 2024 09:29 UTC](https://discourse.openehr.org/t/openehr-tool/3108/36 "2024-08-30T09:29:30Z")

</div>

@surfer  
There are three opt template (xml) uploaded to EHRBase:

 ![image](https://discourse.openehr.org/uploads/default/original/2X/a/a230ca16e50808d34a1246d5d8d3cee0b83318c0.png)

The third opt template (xml, highlighted) can be shown in the drop-down list on the page ‘Get Example Composition from a Template’:

 ![image](https://discourse.openehr.org/uploads/default/original/2X/5/556063b3cb0efccda96c4ee4cd7d5871805f1dcf.png)

But this template cannot be shown in the drop-down list on the page ‘Post a Composition’:

 ![image](https://discourse.openehr.org/uploads/default/original/2X/0/0c9e673e654b16d97134b74551a09ed2329bb8ac.png)

**Following-Up** :

When starting the virtual machine (OS image: Ubuntu 22) in the Hyper-V Manager again, the issue above disappears.

---

<div class="post-metadata">

**Author:** ![linforest](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/l/ac8455/32.png) [@linforest](https://discourse.openehr.org/u/linforest)\
**Post date:** [2 September 2024 06:16 UTC](https://discourse.openehr.org/t/openehr-tool/3108/37 "2024-09-02T06:16:43Z")

</div>

Hi, @surfer,

**Another issue** without detailed investgation:

**Unit for Step cadence** ( **mm** ) in the generated example Composition XML:  
 ![image](https://discourse.openehr.org/uploads/default/original/2X/c/c9ba19d8e861b29a0bd84a653a7a0bd212525a9b.png)

**Unit for Step cadence** ( **/min** ) in the OPT XML:

 ![image](https://discourse.openehr.org/uploads/default/original/2X/7/71e4871942ae6208c1d1e2edd2367dcb6cdbe72d.png)

Hi, @birger.haarbrandt . Is this unit issue potentially related to EHRBase?

---

<div class="post-metadata">

**Author:** ![surfer](https://discourse.openehr.org/user_avatar/discourse.openehr.org/surfer/32/2326_2.png) [@surfer](https://discourse.openehr.org/u/surfer)\
**Post date:** [2 September 2024 06:25 UTC](https://discourse.openehr.org/t/openehr-tool/3108/38 "2024-09-02T06:25:57Z")

</div>

Can you provide me any detail about the whole environment where the error occurs: OS, Tool config file, EHRBase version. Which method to launch the Tool did you use? (all in one docker, docker only for the Tool, etc.

About the example unit mistake, you’ll have to ask someone from EHRBase team.

---

<div class="post-metadata">

**Author:** ![linforest](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/l/ac8455/32.png) [@linforest](https://discourse.openehr.org/u/linforest)\
**Post date:** [2 September 2024 06:31 UTC](https://discourse.openehr.org/t/openehr-tool/3108/39 "2024-09-02T06:31:27Z")

</div>

**OS**  
Ubuntu 22.04.3 LTS

**Tool config file**  
 ![image](https://discourse.openehr.org/uploads/default/original/2X/5/5276ee983a9393a63989976de9de288ff843e7f5.png)

_EHRBase version_  
v2.6.0

**Which method to launch the Tool did you use?**  
Separated mode (docker only for the Tool)

Thanks, @surfer

---

<div class="post-metadata">

**Author:** ![linforest](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/l/ac8455/32.png) [@linforest](https://discourse.openehr.org/u/linforest)\
**Post date:** [2 September 2024 06:42 UTC](https://discourse.openehr.org/t/openehr-tool/3108/40 "2024-09-02T06:42:12Z")

</div>

Hello, @birger.haarbrandt  
**Question** : In the example below, I’m wondering whether the **inconsistency** between the instance XML and the OPT template is deliberately designed for illustrating how to use an external code system rather than the local code system , or it’s an issue.

Example Code value for the _[Physical] Activity name_ in the generated example Composition XML:  
 ![image](https://discourse.openehr.org/uploads/default/original/2X/6/6261bd9820419b13c2b8fbdd945d3604ba241c52.png)

Valueset for the _[Physical] Activity name_ in the OPT XML:

 ![image](https://discourse.openehr.org/uploads/default/original/2X/0/0c9de1d26a2854513675825db84a4cbe7a18b1a9.png)

---

<div class="post-metadata">

**Author:** ![linforest](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/l/ac8455/32.png) [@linforest](https://discourse.openehr.org/u/linforest)\
**Post date:** [5 September 2024 09:47 UTC](https://discourse.openehr.org/t/openehr-tool/3108/41 "2024-09-05T09:47:45Z")

</div>

> [@linforest](#):
>
> **Snippet for fixing the xml** :
> 
> ```auto
> <state archetype_node_id="at0106">
> <name>
> <value>History</value>
> </name>
> <origin>
> <value>2022-02-03T04:05:06</value>
> </origin>
> <period>
> <value>PT0S</value>
> </period>
> <duration>
> <value>PT0S</value>
> </duration>
> <events xsi:type="INTERVAL_EVENT" archetype_node_id="at0107">
> <name>
> <value>Minimum</value>
> </name>
> <time>
> <value>2022-02-03T04:05:06</value>
> </time>				
> <width>
> <value>PT42H</value>
> </width>
> <math_function>
> <value>minimum</value>
> <defining_code>
> <terminology_id>
> <value>openehr</value>
> </terminology_id>
> <code_string>145</code_string>
> </defining_code>
> </math_function>
> <data xsi:type="ITEM_TREE" archetype_node_id="at0001">
> <name>
> <value>structure</value>
> </name>
> <items xsi:type="ELEMENT" archetype_node_id="at0001">
> <name>
> <value>Ambient Temperature</value>
> </name>
> <value xsi:type="DV_QUANTITY">
> <magnitude>11.0</magnitude>
> <units>°C</units>
> </value>
> </items>
> <items xsi:type="ELEMENT" archetype_node_id="at0002">
> <name>
> <value>Relative humidity</value>
> </name>
> <value xsi:type="DV_QUANTITY">
> <magnitude>25.0</magnitude>
> <units>%</units>
> </value>
> </items>
> </data>
> </events>
> </state>
> 
> ```

@ian.mcnicoll In the snippet above, why all the data (especially **Ambient Temperature** and **Relative humidity** ) but those in the tag **math\_function** doesn’t exist in the FLAT JSON fromat retrieved from the server? The missing data in the FLAT JSON fromat was inserted just for a successful POST operation and actually they are not needed in my example Composition.  
 ![image](https://discourse.openehr.org/uploads/default/original/2X/1/1ef5a2f84b81854ce717633260d903e74fd14083.png)

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Amir\_Sohail](https://discourse.openehr.org/user_avatar/discourse.openehr.org/amir_sohail/32/4003_2.png) [@Amir\_Sohail](https://discourse.openehr.org/u/Amir_Sohail)\
**Post date:** [5 September 2024 10:09 UTC](https://discourse.openehr.org/t/openehr-tool/3108/42 "2024-09-05T10:09:10Z")

</div>

Hello everyone,

I’m new to openEHR and have a question regarding its structure. In openEHR, is it necessary to create one EHR per patient, with each EHR including all different compositions (such as observations, encounters, and other clinical data) related to that patient?

Or is it possible to use a single EHR to manage multiple patients and their compositions?

I’m looking for guidance on whether the standard practice is to maintain separate EHRs for each patient, or if there are alternative approaches that might allow for a different structure.

Thank you in advance.

[Previous page](https://discourse.openehr.org/t/openehr-tool/3108.md?page=1)

[Next page](https://discourse.openehr.org/t/openehr-tool/3108.md?page=3)
