Storing codes of two external terminologies

Hi @sangeeta.nbose,

this is a snipped from within a composition to create a mapping:

    "setting": {
      "_type": "DV_CODED_TEXT",
      "value": "other care",
      "defining_code": {
        "terminology_id": {
          "value": "openehr"
        },
        "code_string": "238"
      },
      "mappings": {
        "_type": "TERM_MAPPING",
        "match": "=",
        "purpose": {
          "_type": "DV_CODED_TEXT",
          "value": "test",
          "defining_code": {
            "terminology_id": {
              "value": "local"
            },
            "code_string": "test value"
          }
        },
        "target": {
          "terminology_id": {
            "value": "SNOMED-CT"
          },
          "code_string": "345356676789"
        }
      }
    },

Hope this helps

P.S. simply use the RM paths in EHRbase for (partial) querying:

{
  "q":"select
c/content[openEHR-EHR-OBSERVATION.laboratory_test_result.v1]/data[at0001]/events[at0002]/data[at0003]/items[openEHR-EHR-CLUSTER.specimen.v1]/items[at0029]/value/mappings/target/code_string
from EHR e
contains COMPOSITION c
"
}
1 Like

I’m not sure I understand what the question is? :sweat_smile:

Now I’m confused :smiley: I tried to answer @sangeeta.nbose 's question, then implicitly asked if my answer was correct. I’ll stop here before go into an infinite loop :grin:

1 Like

Thank you so much @birger.haarbrandt . The code helped… we have this working now. Just one last question… For storing multiple mappings… I would need to make this a list with multiple mappings. Would this be right.?
“mappings”: [
{
“_type”: “TERM_MAPPING”,
“match”: “=”,
“target”: {
“terminology_id”: {
“value”: “SNOMED-CT”
},
“code_string”: “345356676789”
}
}
{
“_type”: “TERM_MAPPING”,
“match”: “=”,
“target”: {
“terminology_id”: {
“value”: “UMLS”
},
“code_string”: “1234”
}
}
]

If so, how would the RM path work out for accessing the individual item in the list ? Thanks for all your help.

2 Likes

Hi… I. have another question too… Can I use the ‘match’ field to store an accuracy number. It would be my information on the accuracy of the mapping of the source value with the target code. ‘Match’ is a char, so i would be able to store the number… but just checking if there are are guidelines against it.

Hi Sangeeta, I think technically you can use any character, other should confirm this. But only 4 characters are specified in the TERM_MAPPING class to have meaning. I rencentlh proposed to add ~ as a fifth option to indicate a somewhat match (e.g. machine learning suggestion). Is this also your usecase?

Yes @joostholslag my use case would be a machine learning suggestion… but I do have a confidence number… Hence was looking at using ‘match’ for storing the number.

1 Like

for e.g. trying to find out how to traverse the list and get the code_string for ‘snomed-ct’ (This is an addition to my post showing the mappings as a list)

I’m a bit wary of the value of even the broad match categories. the degree of ‘match’ is highly contextual and not solely a function of the codes themselves but of the direct downstream usage of the codes.

1 Like

Right - but you can’t outguess every subsequent use, and we also have to let openEHR users work such things out for themselves. We are not the terminology-matching police after all :wink:

But I would say that there are rational reasons for us to be that in the future.

1 Like

Goes to wardrobe, looks for old uniform from military service days…

2 Likes

Do you do the same for archetype development?

2 Likes

Hi… Just updating that I couldnt use the ‘match’ for storing a number, The field accepts only a single character. Will figure out some other attributes. Do share, if any recommendations.

You are right @Seref - and I have recently come across the need to set this constraint at design time.

In our system we can query a terminology service and get back the terminology with mappings. But for some use-cases I want to add the terminology as local to the archetype or template with bindings. This will be useful for self-contained deployment of an OPT with some UI or integration resources without the need for a specific terminology service.

I would love to see a solution for this in the modelling domain.

4 Likes

I think this probably needs some extra thinking at SEC, as this is different from setting bindings. I’m not clear how it would be supported in ADL/ADL2 right now.

3 Likes

Hi David,

Coming back to this topic, let me see if i understood correctly:
The use case that I am trying to express is the CODED_TEXT validation that happens when storing a code_string into the CDR and terminology_id is checked to see if it contains the code_string.

Having a term (codi_string) that for different reasons may have seen its term set (terminology_id) modified over time, in order to capture all possibilities in the design time, using AD it is necessary to add as many CODED_TEXT as terminology_id for that term?

Hello Pau,

I will make the assumption that when you say “terminology_id is checked to see if it contains the code_string”, you are literally saying that you want to check if the code comes from the terminology, and not checking if the code is part of a specific subset or reference set.

If it was the latter case, there is no mystery: just add as many terminology binding in the archetype as you need for every subset you have. And then you could check if the code is part of any of them.

But, following the initial assumption, you are saying that the terminology_id is modified over time. So, for example, you have a terminology identified as “MY_TERMINOLOGY_ORIGINAL_NAME” that at some point was renamed as “MY_TERMINOLOGY_NEW_NAME”. So, in the data instances you might have stored values as CODE_X::MY_TERMINOLOGY_ORIGINAL_NAME or as CODE_X::MY_TERMINOLOGY_NEW_NAME

To represent that, one option is what you said, add as many DV_CODED_TEXT as you need, one for each terminology_id. Bear in mind that you would also need to constrain the parent items attribute cardinality to 0…1 so that this is interpreted as alternative DV_CODED_TEXT and not as multiple instances.

Another option would be to just add one DV_CODED_TEXT and specify multiple terminologies for it. I have never done this with the Archetype Designer, but I think it is something like this:

1 Like

Hi! Thanks for the answer David.

Let me explore a bit more this option that you mentioned

This seems a possibility which I didn’t know AD is able to do. However, when creating a template, it seems to be necessary to select one or the other

This is what the OPT for that template says - it does not mention catalog_2.

In the use case of having to check one code in more than one value set (in my screenshot “catalog_1” and “catalog_2”), are we back to having to implement as many CODED_TEXT as terminology_id?

Thanks!

You are right, I just did it myself and it seems that the AD don’t like to leave open alternatives in templates. I can’t remember if that is explicitly forbidden in the specifications. Anyone has a clue?