# Problem with constraint\_binding

**URL:** https://discourse.openehr.org/t/problem-with-constraint-binding/15469
**Category:** Clinical (archive)
**Created:** [15 March 2017 10:29 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469 "2017-03-15T10:29:56Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [15 March 2017 10:29 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/1 "2017-03-15T10:29:56Z")

</div>

Dear readers,

I have a problem and I want to ask your advise.

The problem is that I want to use openEHR-EHR-EVALUATION.problem\_diagnosis.v1 which is in CKM.

In that archetype is the item “Problem/Diagnosis name”, which is of type DV\_TEXT. We want to use it as DV\_CODED\_TEXT, because we want to add code to the entered name.

In this situation where I work, the customer wants to use 2 different codes, one company crerated internal codelist, and ICD10.

It seems easy to arrange in the archetype, I think I need to specialize it, because I want to add the constraint-bindings to give room for the codes. The archetype-editor from Ocean allows two constraint-bindings on the same node, like displayed below. But this seems wrong to me.

In the reference model in the DV\_CODED\_TEXT is one CODE\_PHRASE (1..1). And CODE\_PHRASE has terminology\_id and code\_string also 1..1

So how will the construct below be interpreted following the specs?

constraint\_bindings = \<  
[“ETDA”] = \<  
items = \<  
[“ac0001”] = terminology:ETDA

> 

[“ICD10”] = \<  
items = \<  
[“ac0001”] = terminology:ICD10

> 

My second question, if you say this is impossible to add two terminology constraints to one data-item, which construct do you advise to make two terminology constraints\_bindings available to one DV\_CODED\_TEXT (or maybe another datavalue-type)?

Thanks for any help.

Best regards  
Bert Verhees

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [15 March 2017 11:13 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/2 "2017-03-15T11:13:27Z")

</div>

Hi Bert

This is correct. If you were to add those constraints in a specialised archetype, at run-time the submitted term in the defining\_code attribute would have to come from one of the two terminologies specified.

The constraint can define multiple potential terminologies but only one defining\_code is allowed in the instance data.

Ian

---

<div class="post-metadata">

### Author: ![yampeku](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yampeku/32/25_2.png) [@yampeku](https://discourse.openehr.org/u/yampeku)
#### Post date: [15 March 2017 11:19 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/3 "2017-03-15T11:19:36Z")

</div>

What about having two sibling DV\_CODED\_TEXT nodes as alternatives on the parent? (or specialize two different ones from the single parent one). That would allow to arbitrarily define constraint binding as needed, and in data only one would be correct one

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [15 March 2017 11:21 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/4 "2017-03-15T11:21:18Z")

</div>

Thanks Ian, that explains.

Best regard  
Bert

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [15 March 2017 21:31 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/5 "2017-03-15T21:31:27Z")

</div>

We are considering that Diego, the fact is that the customer wishes to code the name -item two times. Both coding - systems are not easy to map and the mapping cannot be calculated easily by software.

So we need two Dv\_coded\_text’s to carry the codes, and only one value to carry the name.

The problem with to Dv\_coded\_text’s is however that it offers two value - fields and that is not what we want.

It is a pity that a Dv\_coded\_text only can carry one code. I don’t understand that restriction but we cannot solve that now, I hope this can be considered in a RM change.

So I think, we will have two Dv\_coded\_text’s and from one having the value put of in a template if that is possible. I look into that tomorrow.

Best regards  
Bert

---

<div class="post-metadata">

### Author: ![Beatriz\_de\_Faria\_Le1](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@Beatriz\_de\_Faria\_Le1](https://discourse.openehr.org/u/Beatriz_de_Faria_Le1)
#### Post date: [15 March 2017 21:39 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/6 "2017-03-15T21:39:13Z")

</div>

Perhaps the best solution for the time being is to add an additional diagnosis component with the secondary terminology binding that might be used. This is not so common and would need a BR specialization.

Beatriz

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [15 March 2017 22:05 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/7 "2017-03-15T22:05:15Z")

</div>

Hi All

The idea was that the code\_phrase was directly entered as part of choosing the text from the terminology.

Anywhere where coding is done as a secondary process, the code mappings allow multiple codes.

I think this meets all the needs you have specified. Mappings allow each terminology to be specified.

It is likely in the future that EHRs will have multiple mappings for different purposes and different eras of computing, allowing upgrading of historical data.

Cheers, Sam

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [15 March 2017 22:20 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/8 "2017-03-15T22:20:51Z")

</div>

Hi Bert,

A dv\_coded text can carry a single defining\_code but as many code mappings as you wish. This makes sense to me as I would always expect one code to be regarded as the original clinical source of truth, and other mappings to be regarded as secondary. All of these can be queried via AQL. The defining\_code should be the one that is selected by the user.

I would strongly suggest that you use mappings for this purpose. I would also not bother with trying to place constraints via archetypes or templates. You are really not achieving much that cannot be otherwise simply documented or applied in software.

Perhaps I’m still not understanding the requirement here?

Ian

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [16 March 2017 07:58 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/9 "2017-03-16T07:58:06Z")

</div>

Hi, I need to defer this discussion to next Monday. I will come back to this. Thanks all for your input.

Best regards  
Bert

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [16 March 2017 09:34 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/10 "2017-03-16T09:34:14Z")

</div>

Hi,

Multiple codes create the problem of deciding which one is ‘_the truth_’.  
One code needs be declared to be ‘_the truth’_.

But…

‘_The truth_’ depends on the context the code is used in.  
So how can one declare what the clinical/administrative/research context is?

And…

‘_subject_’ has ‘_associated data_’  
Is the code used for defining the subject of associated data?  
Or is the code used to define the data provided itself?

Gerard Freriks  
+31 620347088  
[gfrer@luna.nl](mailto:gfrer@luna.nl)

Kattensingel 20  
2801 CA Gouda  
the Netherlands

---

<div class="post-metadata">

### Author: ![yampeku](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yampeku/32/25_2.png) [@yampeku](https://discourse.openehr.org/u/yampeku)
#### Post date: [16 March 2017 09:58 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/11 "2017-03-16T09:58:34Z")

</div>

I assume that mappings could also contain constraint bindings right?

---

<div class="post-metadata">

### Author: ![Karsten\_Hilbert](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/k/e56c9b/32.png) [@Karsten\_Hilbert](https://discourse.openehr.org/u/Karsten_Hilbert)
#### Post date: [16 March 2017 11:06 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/12 "2017-03-16T11:06:43Z")

</div>

But isn't the "name" field in any coded terminology "just  
another code" for a concept ? Or, in other words, the  
"canonical", human-readable, stylised, formal label for a  
concept the user of a terminology may wish to actually name  
differently in day-to-day use ?

Karsten

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [16 March 2017 13:33 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/13 "2017-03-16T13:33:48Z")

</div>

I’m not sure Diego. I guess so. We definitely need to be able to specify at template level how/if any code bindings should be handled at runtime. I suspect this might need some sort of rules that are a bit more complex than just a simple constraint.

This conversation might be a chance to tease out exactly what is required in terms of implementer guidance. I.e. In Bert’s case, exactly what does the customer expect to happen.? Is ICD preferred to icpc. How is any actual code mapping carried out. I can supply some similar use cases from uk allergies work where we are transitioning to snomed but need to carry legacy codes.

Ian

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [17 March 2017 10:43 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/14 "2017-03-17T10:43:33Z")

</div>

Yes.

Any item in an archetype potentially has:

- an ad-hoc, locally defined, display name
- an official canonical name in a specific language domain
- and, in order to disambiguate it, an unique code in
- a specific terminology/classification domain

Gerard Freriks  
+31 620347088  
[gfrer@luna.nl](mailto:gfrer@luna.nl)

Kattensingel 20  
2801 CA Gouda  
the Netherlands

---

<div class="post-metadata">

### Author: ![Karsten\_Hilbert](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/k/e56c9b/32.png) [@Karsten\_Hilbert](https://discourse.openehr.org/u/Karsten_Hilbert)
#### Post date: [17 March 2017 11:08 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/15 "2017-03-17T11:08:26Z")

</div>

Hence the notion that the "name" in\*side\* the terminology  
domain could be discussed to be ignored in the context of  
Bert's question such that it becomes

&nbsp;&nbsp;user-level name  
&nbsp;&nbsp;&nbsp;&nbsp;code from domain A  
&nbsp;&nbsp;&nbsp;&nbsp;code from domain B

in which

&nbsp;&nbsp;name from domain A/B/...

doesn't occur which means

&nbsp;&nbsp;user-level name

IS TO BE mapped at any rate, typically in a way where  
user-level name in clinical artifacts isn't directly  
associated with particular codes but rather a mapping  
"relation" (of whatever kind) is used.

Karsten

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [17 March 2017 11:39 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/16 "2017-03-17T11:39:40Z")

</div>

It is a customer requirement. It is a real life problem.

It is not very helpful to me to have discussions about the good, bad or ugly of solutions. But, of course, go ahead for your own interests.

It is about an international organization which processes data from several countries.

The several countries have independent organizations, and the overall organization cannot enforce a common terminology. There are two terminologies in this case, and those two terminologies cannot be mapped easily, because the granularity is different.

How this is handled until so far this problem is to add the two required codes to an item. So everybody was happy.

Now this customer is moving over to OpenEHR, and because DV\_Coded\_Text accepts only one terminology per occurrence, this is a problem..

It would be nice to have the RM accept more codes, but that is not likely to happen (anyway not soon), although I don't see any problem in having this feature.

So we need to find another solution which is elegant and efficient.

My best guess is, to have two DV\_CODED\_TEXT's in a Cluster, and from one DV\_CODED\_TEXT, have the value-property put off in the template (I hope that is possible, I did still not look at that, if it is not possible we need the GUI to handle this, which is, I think, the worst case solution).

Thanks,

Bert

---

<div class="post-metadata">

### Author: ![Peter\_Gummer](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/p/eb9ed0/32.png) [@Peter\_Gummer](https://discourse.openehr.org/u/Peter_Gummer)
#### Post date: [17 March 2017 13:42 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/17 "2017-03-17T13:42:52Z")

</div>

Hi Bert,

I think you have missed the response yesterday from a couple of people, who suggested that you could use the DV\_TEXT (or DV\_CODED\_TEXT) mappings.target:

&nbsp;&nbsp;[http://www.openehr.org/releases/RM/latest/docs/data\_types/data\_types.html#\_dv\_text\_class](http://www.openehr.org/releases/RM/latest/docs/data_types/data_types.html#_dv_text_class)

Your text item could have 2 mappings. The target of each mapping is a CODE\_PHRASE, which has a terminology id and a code.

Does that help?

Peter

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [17 March 2017 14:29 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/18 "2017-03-17T14:29:57Z")

</div>

Thanks Peter, I must have missed it.

blush blush (missing my regular workstation/email client)

It is indeed the solution.

Sorry for that

Best regards

Bert

---

<div class="post-metadata">

### Author: ![Heath\_Frankel1](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/h/aca169/32.png) [@Heath\_Frankel1](https://discourse.openehr.org/u/Heath_Frankel1)
#### Post date: [19 March 2017 22:32 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/19 "2017-03-19T22:32:25Z")

</div>

Perhaps I have come in at the wrong point of the conversation and missed the original question but I believe that the SEC has already approved a change (or at least got a change proposal from me, I’ll need to follow up to find the Jira card) to add a value to the mappings code phrase. Is this a solution to your issue?

Heath

---

<div class="post-metadata">

### Author: ![Heath\_Frankel1](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/h/aca169/32.png) [@Heath\_Frankel1](https://discourse.openehr.org/u/Heath_Frankel1)
#### Post date: [19 March 2017 22:34 UTC](https://discourse.openehr.org/t/problem-with-constraint-binding/15469/20 "2017-03-19T22:34:08Z")

</div>

See SPECPR-132 and proposed solution in SPECPR-165 which is designed to not break the current schema. They appear to be assigned to R1.1 but not progressed to a CR.

Heath

[Next page](https://discourse.openehr.org/t/problem-with-constraint-binding/15469.md?page=2)
