Searching for ValueSets

@ibacher and others… sorry, more FHIR questions!

So we have ValueSet working effectively within the Dispensing module, and are using ValueSets to populate a couple of questions on the Dispensing form.

However, when configuring what value sets to use for these questions, we are referencing the ValueSets by uuid (where uuid maps directly to the uuid of the underlying concept set).

Referencing concepts by uuid in the config seems like a common pattern, but uuids are unwieldy, not human-friendly, and typo-prone.

We do currently have the ability within the FHIR module to search for a ValueSet by “title”, which basically searches by name. But searching by name is problematic for various reasons (names are mean to be human-readable, so aren’t great to key on, and a concept likely have multiple names).

We’d prefer to search by concept source and mapping, Looking at the ValueSet…

https://build.fhir.org/valueset.html

…I think the proper way to implement this would be use the “identifier” search parameter, so something like:

ValueSet?identifier=[source]|[code]

… where “source” is the URI parameter in the fhir_concept_source table, so something like:

ValueSet?identifier=http://terminology.hl7.org/CodeSystem/medicationdispense-status|completed

Ian, let me know if this makes sense and I can ticket (and likely implement).

Take care, Mark

So, I do see where you’re coming from with this. I’d like to propose something a little different because I think it gets us closer to the way FHIR is supposed to work, but I do get that this scheme has the advantage of pretty cleanly mapping onto how we use concepts in OpenMRS already.

Where I’m starting from is this: each ValueSet in FHIR is meant to have a url that canonically defines the ValueSet, similar to how OIDs could be used for value sets in HL7v2 or v3. I think that leveraging that and @akanter’s suggestion from Slack of using a mapping to store the “canoical” URL for the ValueSet would get us to a place where we’d basically be using FHIR as intended.

So, I get that with the [source]|[code] scheme, we have a pretty direct translation for OpenMRS concept mappings, e.g. PIH:Dispense Status and http://pih.org/|Dispense Status are pretty straight-forwardly the same thing with a slight syntax variation.

But wasn’t doesn’t really map well into that scheme are things like the built-in ValueSets. In FHIR terms, ValueSets and ConceptSources are different things and their aren’t necessarily clean-cut relationships between them (and certainly a ValueSet is not part of a ConceptSource unlike the way that OpenMRS ConceptSets are just concepts and so part of a concept source). So, for example, there is no ValueSet that would have the identifier http://terminology.hl7.org/CodeSystem/medicationdispense-status|<some concept>. Instead, there’s a ValueSet called http://hl7.org/fhir/ValueSet/medicationdispense-status that as part of it’s definition includes all the codes defined in the http://terminology.hl7.org/CodeSystem/medicationdispense-status code system (the technical definition of that ValueSet as a FHIR resource can be seen here).

I think that if we could move towards using canonical URL mappings for ValueSets, we’d have the advantage of being able to refer both to OpenMRS-instance defined value sets (via some mapping, maybe with the type FHIR-URL) and standard FHIR ValueSets when we need to (like we did with the SubstanceAdminSubstitutionReason value set).

What do you think?

Thanks @ibacher!

If I’m understanding the idea, we’d need to define a new concept source that represents “Canonical FHIR-URL” and, for instance, the following concept set would have mapping to http://terminology.hl7.org/ValueSet/v3-ActSubstanceAdminSubstitutionCode, instead of just storing it in the description with a "REF: " prefix:

https://app.openconceptlab.org/#/search/?q=ActSubstanceAdminSubstitutionCode

Then if, say, PIH (or another implementation) wanted to define a different value set for the the “substitution type” question in Dispensing, we would create our own canonical url, like http://terminology.pih.org/ValueSet/DispensingSubstitutionTypes?

One issue I see with this is that a concept/valueset could only have one canonical url… what happens in the (entirely plausible) case where an implementation says for the “substittuion type” question, we want to use some some subset of the members of the http://terminology.hl7.org/ValueSet/v3-ActSubstanceAdminSubstitutionCode? We’d end up creating a new ValueSet with canonical uri http://terminology.pih.org/ValueSet/DispensingSubstitutionTypes but if we wanted to use existing concepts from the http://terminology.hl7.org/ValueSet/v3-ActSubstanceAdminSubstitutionCode, those would already have canonical urls with the http://terminology.hl7.org/ prefix? Would that be valid?

Hope that question makes sense, happy to talk through further!

Take care, Mark

Short version of this: the concepts that are members of a ValueSet aren’t directly related to the ValueSet. The canonical URLs for the ValueSet would only be mapped to the ConceptSet itself… The concepts themselves have an independent identity (in FHIR terms, concepts belong to a code system). So it’s perfectly valid to have a ValueSet that’s, e.g., “all the codes in http://terminology.hl7.org/CodeSystem/v3-substanceAdminSubstitution except TE”. That’s a different ValueSet than the http://terminology.hl7.org/ValueSet/v3-ActSubstanceAdminSubstitutionCode, but it uses mostly the same members, so, e.g., the EC code is still (canonically) http://terminology.hl7.org/CodeSystem/v3-substanceAdminSubstitution|EC in both the standard ValueSet and the customised one; it’s just that, e.g. http://terminology.hl7.org/CodeSystem/v3-substanceAdminSubstitution|TE is a value in the canonical value set but not the customised one I’ve defined.

Does that make some kind of sense? I.e., the URLs that refer to the concepts are not affected by the ValueSet URLs at all.

1 Like