FHIR value set with different code system in a DV_CODED_TEXT constraint

Hi,

In FHIR a value set can have codes from many code systems, there is a URI to identify the whole value set, and each code system also has it’s own URI.

In data instances, nodes that are bound to a value set will have the code system URI alongside with the code and not the value set URI.

So how is this modeled in openEHR to constraint a DV_CODED_TEXT terminology_id?

Should we use the value set URI? Or the many code system URIs associated with the value set?

Thanks!

1 Like

In the Archetype Designer I tried to add two constraint_bindings with the code system URIs, though when exporting the OPT, only one appears, it’s like AD totally ignores the constraints. I’ll test in LinkEHR exports the right constraint in the OPT.

	constraint_binding = <
		["Otras relaciones de contactos del paciente"] = <
			items = <
				["ac0001"] = <http://terminology.hl7.org/yyy>
			>
		>
		["Relaciones de contactos del paciente"] = <
			items = <
				["ac0001"] = <http://terminology.hl7.org/xxx>
			>
		>
	>
              <children xsi:type="C_COMPLEX_OBJECT">
                <rm_type_name>DV_CODED_TEXT</rm_type_name>
                <occurrences>
                  ...
                </occurrences>
                <node_id />
                <attributes xsi:type="C_SINGLE_ATTRIBUTE">
                  <rm_attribute_name>defining_code</rm_attribute_name>
                  <existence>
                     ...
                  </existence>
                  <children xsi:type="C_CODE_REFERENCE">
                    <rm_type_name>CODE_PHRASE</rm_type_name>
                    <occurrences>
                      ...
                    </occurrences>
                    <node_id />
                    <referenceSetUri>http://terminology.hl7.org/yyy</referenceSetUri>
                  </children>
                </attributes>
              </children>

No luck with LinkEHR, there are some bugs in the last Linux version that prevent me to even create the archetype with a DV_CODED_TEXT node. @damoca @yampeku

Even with the generic tree editor (non-openEHR specific) is giving you an error?. That’s really weird, happy to create the example or exporting some ADL into OPT

1 Like

If I create, for instance a PERSON with details > tree > element, there is no option for adding a DV_CODED_TEXT directly, so I added a DV_TEXT and set it to use the subclass DV_CODED_TEXT. Then the editor started to do strange things, like removing items from the ontology.

After that, it didn’t allow me to add constraints.

Then I created an ADMIN_ENTRY with tree > element, there the DV_CODED_TEXT appears as an option. Then in the constraints, I can’t add a constraint_binding (constraint ref), I can’t find an option to do so. I see options to add existing terminologies but not a custom URL like:

["ac0001"] = <http://terminology.hl7.org/yyy>

terminologies are defined on a file inside linkEHR data folder, you can add them there if needed. In principle you should be able to add acXXXX codes whenever you can define a string constraint (in generic editor) for openEHR specific editor, you should be able to define over “Code” classes too

Thanks @yampeku the only thing I need to to set two FHIR code system URIs as the constraint_bindings for ac000X on a DV_CODED_TEXT, not adding the full terminology.

Can I do that in LinkEHR?

In Archetype Designer I can do it just by setting the constraint of the DV_CODED_TEXT to external terminologies, but the AE removes the second constraint when exporting the OPT.

In principle is straightforward
From the DV_TEXT itself you can define a constraint ref


These would be bound to the same acxxxx code.
You’ll have to add the vocabularies to data/linkEHR/teminology/terminology.xml in order to be able to add them as bindings

1 Like

@yampeku did you try to export an OPT that includes that archetype? Will that have the two URIs? Thanks!

while the reference is being stored as an acXXXX code the acXXXX themselves are not being exported in the OPT, which makes sense as there is only term_definitions and term_bindings defined in the OPT xml schema https://specifications.openehr.org/releases/ITS-XML/Release-2.0.0/components/AM/Release-1.4/Template.xsd

I’ll look at that. What’s strange is that in the OPT’s I’ve seen and in the ones exported from the AD, what gets exported is the URI in referenceSetUri, not the ac code in reference.

Which OPT schema is used in LinkEHR? Does it allow both? Can it allow to put multiple referenceSetUri with the URIs? (which is the case I’m trying to model, because once I export the OPT and use it on a system, the system doesn’t have access to the original archetypes, so there is no way to look for those URIs referenced by the ac code).

Thanks!

Should we use the value set URI? Or the many code system URIs associated with the value set ?

I’m not answering the archetype editor question, but from a FHIR point of view, the answer is very clear: you use the code system URI in the DV_CODED_TEXT, not the value set - the value set URI belongs in the constraint. (I think that’s what I see in this thread, so I’m answering the original question)

3 Likes

Thanks @grahamegrieve this is clear for me, I think it was Loyd that help me understand that in the FHIR community chat.

My question is about how to model that in openEHR, since editors don’t seem to handle this case very well, especially when exporting the final template to be used in a CDR, which seems like a problem for current integrations using openEHR and FHIR (as I’m working on at this very moment).

Only in one archetype editor it seems possible to put multiple code system URI constraints on a single DV_CODED_TEXT, in the rest it doesn’t seem possible, but in all the exported template has just one URI.

Maybe that’s an item to consider by the group working in the openEHR+FHIR collaboration agreement: this should be supported by openEHR tools.

ADL2 does handle this a little better but TBH I would just offload the whole responsibility to a FHIR server-based Valueset and Codesystems. I’m not sure I see the need to replicate that functionality in openEHR.

1 Like

Tough how can we implement the constraint in 1.4? 2 Is not an option.

Using an external server works for validation, not at design time. Or I’m missing something?

You can hook ArchetypecDesigner up to a fhir TS. id create the Valueset manually ir with snapper snd host in a local fhir service

@ian.mcnicoll I don’t understand how that setup is going to help with the constraint needed in the opt. Can you expand?

I think formally, all OPTs 1.4 need is to be able to have multiple (1..*) referenceSetUri at the C_CODE_REFERENCE level, which right now is 1..1 (implicit because it doesn’t have minOccurs or maxOccurs):

That will allow multiple terminology_id values allowed for a single DV_CODED_TEXT node.

Though I can update our own XSDs easily, it’s a pain to remember this case on every OPT export from modeling tools and needing to manually add the missing refs, but life isn’t perfect. Another option is to build our own modeling tool to comply with these practical requirements.

Anyway, I’m wondering why this case isn’t more frequent in openEHR modeling, or how modelers workaround this issue, because it seems a pretty common case in the FHIR world.

Again, I think this is something the FHIR-openEHR collaboration group might take into account, though I’m not sure who is in that group from the openEHR side. I would love to help if I knew how to participate in that group.

Best,
Pablo.

1 Like