# openEHR-tool **Category:** [Tools](https://discourse.openehr.org/c/tool-dev/36) **Created:** 2022-10-28 08:30 UTC **Views:** 1603 **Replies:** 44 **URL:** https://discourse.openehr.org/t/openehr-tool/3108 --- ## Post #1 by @surfer We at crs4 have created a simple GUI for EHRBase. The project still in beta is at the following url: https://github.com/sasurfer/openEHR-tool It has most of the main methods from the openEHR API specification.I hope to extend it to other backends. Enjoy it --- ## Post #2 by @borut.jures Great instructions! Can you please add few screenshots here/GitHub? It is a GUI tool :wink: --- ## Post #3 by @surfer I added at the end of the README.md in the github repo some screenshots to give an idea of the interface. I attach them here too. ![postcomp|690x491](upload://v0XqPqo0CaNwCzZTfC3zsI2zlcX.png) ![sessionactivities|690x494](upload://hpWFCLyrnbhP8vhfHKkMxur6aCI.png) ![homepage|690x492](upload://sS5t5OeTjXDBFuCanzWjyyTU6f.png) ![gettemplate|690x492](upload://d7Q0TA3R0tEDuZs4YQtKxCKouJ1.png) ![examplecomp|687x500](upload://gtA58hZa3TeCcvVYTkZKSwGI44a.png) --- ## Post #5 by @joostholslag https://linkehr.veratech.es/getlinkehr.html This is the download site of the vendor. If you have special security concerns you could discuss integrity checks with @yampeku --- ## Post #6 by @joostholslag Just tried for the first time today. Super useful! Might deserve some attention from @Sidharth_Ramesh in a video. --- ## Post #7 by @linforest openEHR-tool is very useful indeed! I can start it in separated mode with my EHRBase instance. Now, I can't delete a specified Template. **404 Error** ![image|627x500](upload://bGstPOXSsG7BjCiIbpfI0caxxsj.png) **Current Settings** ![image|690x489](upload://pgP06mOK6cpuVtCxLdIVe4W20Z8.png) --- ## Post #8 by @surfer 1)Did you check in the template list if the template was deleted? 2)Did you use any other "admin" method before this one? did it work? If the template is still there and other admin method work, can you provide me the template ? that way I try it myself to better understand what is going on you can open an issue in any of these two repo: https://github.com/crs4/openEHR-tool https://github.com/sasurfer/openEHR-tool --- ## Post #9 by @linforest Hi Giovanni! The template is still there (in the list). It tried to deleted it only with the user/role showed in the snapshot above. Tomorrow morning, I'll share the opt with you. Hi, [Giovanni](https://discourse.openehr.org/u/surfer). Here is the OPT template I uploaded to my EHRBase instance: **[Cause of death.opt|attachment](upload://t9j7N8zYKthf5nYk6dlfJRKCZeB.opt) (35.4 KB)** A database query shows that the template still exists in the ehr.template_store. ![image|690x193](upload://upBifdxip2tVZjBcqcgGjLFl1kf.png) And the GET operation '**List Templates**' still returns the template in the result list as following: ![image|474x500](upload://fPQBu5GSZzETsVGuRMcvBtGqoqA.png) When trying to do the operation '**Delete Template**' in the 'ADMIN methods' menu, *EHRBase console* gave the following Warning: ![image|690x78](upload://108CKD2IlKbnz6ojS8xwxoGHPGW.png) *openEHR-tool console* gave the following messages: ![image|690x251](upload://pCIOSpy6SBXkMKax3XUwriVLIgt.png) In fact, through testing, it was found that all templates had such a deletion issue. --- ## Post #10 by @linforest **Solution**: Add these related EHRBase **environment vars** in the docker-compose.yml and restart the docker images: ``` ADMINAPI_ACTIVE=true ADMIN_API_ACTIVE=true ADMINAPI_ALLOWDELETEALL=true ``` **Reference**: https://discourse.openehr.org/t/admin-delete-composition/4943/3 --- ## Post #11 by @surfer I tried to reproduce the problem. In my environment the deletion works. I thought it could be related to the name that has spaces but it's not that, the deletion works irrespective of the added/removed spaces. As you said it must be related to the environment variables. About the environment variables, they are already included in .env.ehrbase which is loaded by the docker "total" yaml file (the only exception being "admin-api.enabled" which is not present in .env.ehrbase). thank you for your post. I updated the README to include the environment variables you mentioned apart from admin-api.enabled. --- ## Post #12 by @linforest Thanks, Surfer. At last, I had to delete the only one opt without any comp instance by SQL. Is this possibly related to indexing? --- ## Post #13 by @surfer I really don't know --- ## Post #14 by @ian.mcnicoll I just realised that the Caszue of Death .opt is based on an EVALUATION archetype and irt should only really be possible to create an .opt from a COMPOSITION archetype. Entry-based templates only act as pre-constrained components to pull into a Composition template, they cannot (or should not) be used to create .opts directly. @Lin - how did you create that .opt? --- ## Post #15 by @linforest Oh, I see. This is my first time uploading a template. Thanks, Ian. --- ## Post #16 by @linforest @heather.leslie In addition, what purpose(s) are these non-Composition Templates (OET) for? ![image|690x357](upload://eOvACFjMIOK9HjEY3T1isfxfrZ5.png) --- ## Post #17 by @linforest [quote="ian.mcnicoll, post:14, topic:3108"] irt should only really be possible to create an .opt from a COMPOSITION archetype [/quote] Why such an OET Template couldn't loaded normally by Ocean Template Designer, but CKM can? Because Ocean Template Designer is using my local copy of the CKM repo downloaded by CKM Bulk Export, which doesn't include previous versions of the Archetype(s) renferenced by the OET Template? ![image|576x215](upload://1pe3bq6R1jlPYAxU92I1EykQ8dt.png) ![image|690x308](upload://rEIPhwhQXk4wGTUJYTPiOdHeJKn.png) --- ## Post #18 by @siljelb Non-composition templates (we often call them "embedded templates") are used as preconstrained components to build composition templates, to avoid having to do the same constraints multiple times, and/or standardise them. --- ## Post #19 by @ian.mcnicoll Yup - so what has happened here is that the .oet was built with an older version of the archetype that is not exported by the bulk import (or by the Git mirror). We do probably need to cull these 'broken' .oets or rebuild with the latest archetype equivalent. --- ## Post #20 by @linforest Thanks, [Silje](https://discourse.openehr.org/u/siljelb). You mean such an embedded template can be directly imported into a new template to accelerate the template editing process? --- ## Post #21 by @siljelb That's exactly right 😊 --- ## Post #22 by @linforest 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|690x200](upload://df6Sa02MkOcE4sTxICnGiGEGnPv.png) --- ## Post #23 by @ian.mcnicoll It is still in CKM, just superceded and so not normally visible. To find it ... ![image|492x172](upload://5iJIaWv4F8ab9YggrnYwlOpDLX7.png) then click on Published only, so that all versions becomes visible. ![image|535x486](upload://me7tDnTsKt97kR65Hf8pgWBTqCS.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. --- ## Post #24 by @linforest 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 :grinning: --- ## Post #25 by @ian.mcnicoll No worries. It is useful to document this stuff for a wider audience. Keep asking these great questions!! --- ## Post #26 by @linforest Using openEHR-tool, an example Composition XML([ Example-Data-Linkoping_University_Physical_Activity-Pretty.xml|attachment](upload://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|690x310](upload://8ooBpRanjHGhYS7FqKwhVYlWidk.png) ![image|524x500](upload://6vIL21OABCDCyU4uqfh1aWBSEtJ.png) --- ## Post #27 by @ian.mcnicoll You need to add at least one valid item under the `data` tree - see Erik's original xml ``` Maximum structure Pulse presence local at1045 Present local at1024 ``` --- ## Post #28 by @linforest Thanks a lot, Ian. I'll give it a try tomorrow morning :grinning: --- ## Post #29 by @linforest [quote="ian.mcnicoll, post:27, topic:3108"] You need to add at least one valid item under the `data` tree [/quote] 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**: ``` History 2022-02-03T04:05:06 PT0S PT0S Minimum PT42H minimum openehr 145 structure Ambient Temperature 11.0 °C Relative humidity 25.0 % ``` **Where the state node resides in my template**: ![image|360x500](upload://jMcg3l8r75ilCUUsfEtGlyozqeZ.png) **The Example Instance (Composition) used above**: [Example-Data-Linkoping_University_Physical_Activity-Pretty-240829-1005.xml|attachment](upload://sOdCzBEViBiqQJ9vBv87Y2USbxG.xml) (45.3 KB) --- ## Post #30 by @ian.mcnicoll 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 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 --- ## Post #31 by @linforest 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. :heart: --- ## Post #32 by @linforest [quote="ian.mcnicoll, post:30, topic:3108"] 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. [/quote] 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|656x500](upload://nhxosZgek2Dr1JT3LNR37hcZcGN.png) [quote="ian.mcnicoll, post:30, topic:3108"] Let me know if you are still stuck and I’ll try to fix the example myself [/quote] 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 ! --- ## Post #33 by @linforest [quote="surfer, post:3, topic:3108"] ![postcomp](upload://v0XqPqo0CaNwCzZTfC3zsI2zlcX) [/quote] @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? --- ## Post #34 by @surfer 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. --- ## Post #36 by @linforest @surfer There are three opt template (xml) uploaded to EHRBase: ![image|442x500](upload://n8NSCJOP4Qg8bN0pn6Vk2sPimEo.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|690x435](upload://cbh66tpb5OLNmFARNxgyIQxSURV.png) But this template cannot be shown in the drop-down list on the page 'Post a Composition': ![image|558x500](upload://1ND6DQP3QyisnmoYq7ZaLGnKegk.png) **Following-Up**: When starting the virtual machine (OS image: Ubuntu 22) in the Hyper-V Manager again, the issue above disappears. --- ## Post #37 by @linforest Hi, @surfer, **Another issue** without detailed investgation: **Unit for Step cadence** (**mm**) in the generated example Composition XML: ![image|513x161](upload://sMyGQmqA3dNwrJbf3lbmHUsOxtx.png) **Unit for Step cadence** (**/min**) in the OPT XML: ![image|690x302](upload://gfxzuVF4Xc8aF65EN2JcgUKOfHT.png) Hi, @birger.haarbrandt . Is this unit issue potentially related to EHRBase? --- ## Post #38 by @surfer 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. --- ## Post #39 by @linforest **OS** Ubuntu 22.04.3 LTS **Tool config file** ![image|344x242](upload://bLvXIFzTMExwPiEQjDNiLAo1vjD.png) *EHRBase version* v2.6.0 **Which method to launch the Tool did you use?** Separated mode (docker only for the Tool) Thanks, @surfer --- ## Post #40 by @linforest 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|590x467](upload://e2kcqfWVqHwM57i4iR2Bel641YC.png) Valueset for the *[Physical] Activity name* in the OPT XML: ![image|690x180](upload://1NBZpyQXgcX9XYJnvfEUPIc4iTL.png) --- ## Post #41 by @linforest [quote="linforest, post:29, topic:3108"] **Snippet for fixing the xml**: ``` History 2022-02-03T04:05:06 PT0S PT0S Minimum PT42H minimum openehr 145 structure Ambient Temperature 11.0 °C Relative humidity 25.0 % ``` [/quote] @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|690x51](upload://4pSB570Qv1fsT5FhXU8GQ6IgK1d.png) Thanks in advance. --- ## Post #42 by @Amir_Sohail 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. --- ## Post #43 by @Seref @Amir_Sohail please ask this question on its own, maybe under new to openehr category. You're posting it as a reply to a topic that is not relevant to your question. You'd get more responses if you post your question on its own, under the relevant category. --- ## Post #44 by @Amir_Sohail Sure, Thanks --- ## Post #45 by @sebastian.garde [quote="linforest, post:22, topic:3108"] 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. [/quote] Sorry - I am a bit late to the party here, but just wanted to add that the easiest way to physically get all archetypes for a template in their correct revision as used by the template is via the "Export Template File Set (zip)" button: ![image|421x500](upload://lbBKxbI1VRRbbYSt6qf2HuUtbEW.png) On this page, you can also see that Structured address has been Rejected - this is why it is not visible at all anymore unless you explicitly search for Rejected archetypes as well (in Find Resources go to the Lifecycle tab) --- ## Post #46 by @linforest Great! Thanks a lot for your detailed guidance. --- ## Post #47 by @linforest Explicitly resetting the unit of Step candence from "**/min**" (specified by *[openEHR-EHR-CLUSTER.distance_activity-walking_running.v0.adl](https://github.com/regionostergotland/Physical_activity/tree/master/proposals/2019-07-12_clst/openEHR-EHR-CLUSTER.distance_activity-walking_running.v0.adl)*) to frequency unit "**1/min**" solves the issue. ![image|456x190](upload://mOmRp7KO4yejjSjalR9S8ciVGQq.png) ``` Step candence 42.0 1/min ``` --- **Canonical:** https://discourse.openehr.org/t/openehr-tool/3108 **Original content:** https://discourse.openehr.org/t/openehr-tool/3108