# How to make mappings easier to query and to document in openEHR

**URL:** https://discourse.openehr.org/t/how-to-make-mappings-easier-to-query-and-to-document-in-openehr/5063
**Category:** Terminology
**Created:** [3 April 2024 08:49 UTC](https://discourse.openehr.org/t/how-to-make-mappings-easier-to-query-and-to-document-in-openehr/5063 "2024-04-03T08:49:43Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![ian.mcnicoll](https://discourse.openehr.org/user_avatar/discourse.openehr.org/ian.mcnicoll/32/4430_2.png) [@ian.mcnicoll](https://discourse.openehr.org/u/ian.mcnicoll)
#### Post date: [3 April 2024 09:20 UTC](https://discourse.openehr.org/t/how-to-make-mappings-easier-to-query-and-to-document-in-openehr/5063/3 "2024-04-03T09:20:36Z")

</div>

Terminology queries are already standardised via AQL and supporting FHIR -see [Support for AQL MATCHES and TERMINOOLGY in EhrBase? - #4 by vidi42](https://discourse.openehr.org/t/support-for-aql-matches-and-terminoolgy-in-ehrbase/3789/4)

and is supported in both EhrBase and Better AFAIK.

Though note some slight confusion on exact syntax in the specs!

We can query both defining\_code and mappings in AQL but when trying to query both for e.g as LOINC or SNOMED code, it is cumbersome.

I think treating the defining\_code and mappings list as a single list for matching purposes, possibly with an AQL function, might be helpful, especially if we can combine the TerminologyID and term in a single token.

e.g. `hasTerm('SNOMED-CT::123456", "SNOMED-CT::45345")` which searches both defining\_code and the mappings list.

The other issue is how to document term mappings that the modeller wants enforced to be carried at run-time. Archetype term bindings are design-time suggestions only, and may not actually be correct in local template use. There may be a place for template -level bindings but these would still be different from mapping constraints i.e design-time recommendations .not actual mapping constraints.

@damoca - have you ever tried constraining mappings in LinkEHR or do we need a new kind of construct (especially as some of the mappings may be conditional or lookup driven. Is this a seperate layer even?

---

_[View the full topic](https://discourse.openehr.org/t/how-to-make-mappings-easier-to-query-and-to-document-in-openehr/5063)._
