Storing codes of two external terminologies

This is my understanding too. However, I didn’t understand, as @joostholslag points out, that she wanted to do the mapping in the template and not at run time. In that case AD certainly needs to add support for this. How does this look from your end, @borut.fabjan ?

1 Like

I was thinking in constraining the acceptable terminologies, not the actual coded values, of course.

1 Like

An example intention would be … Patient shows ‘sign/symptom’ such as ‘headache’. I would like to store the ‘headache’ as the value and also the umls code and the snomed code for headache. This would be a runtime activity. But I would need to design my template/archetype to accept the multiple terminologies isnt it ?

2 Likes

For that case you store multiple term mappings at run time like Silje remarked. Data Types Information Model

You don’t need to do anything at design time to be able to store those. But you can record (multiple) term bindings at design time. It’s important these should be considered implementation guidance and not automatically recorded as mappings in patient data for clinical safety reasons.

Thanks all… I am a little confused about storing multiple term mappings. Is there any sample code I can refer. (I do not see the support for setting the TERM_MAPPING attribute in AD. But as I understand it, I do not need to do anything design time).

Here comes my bull in a china shop moment :grin: :

Using the mappings of DV_TEXT, one can indeed store N mappings with references to various terminologies as @siljelb says. However, I cannot see a way to constraint what those terminologies are allowed to be. I.e. you can record mappings to terminologies, but you cannot force validation to reject data if it contains a mapping to a code from SuperDuperAstrologyChartBasedCodingSystem©

You can record the fact that a value must be from a particular terminology, and its subset etc, if you go with DV_CODED_TEXT as @damoca mentions, and that can be expressed at the archetype level.

So if you want to make the terminology of the mapping part of validation, use DV_CODED_TEXT in your archetype, or specialise DV_TEXT fields of the archetype you’re re-using to DV_CODED_TEXT in a template.

If you’re ok with users using any terminology, which means you’ll only query for the ones you’re interested in when using the data, and not be concerned about codes from terminologies you don’t care about, then stay with DV_TEXT.

Can I join the clinical modelling experts group now? :grin: ? I’d be very happy to be educated if the above is wrong.

4 Likes

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.