# Using aql for data set in DV\_CODED\_TEXT

**URL:** https://discourse.openehr.org/t/using-aql-for-data-set-in-dv-coded-text/15488
**Category:** Technical (archive)
**Created:** [5 July 2017 12:23 UTC](https://discourse.openehr.org/t/using-aql-for-data-set-in-dv-coded-text/15488 "2017-07-05T12:23:11Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [5 July 2017 12:23 UTC](https://discourse.openehr.org/t/using-aql-for-data-set-in-dv-coded-text/15488/1 "2017-07-05T12:23:11Z")

</div>

HI,

I am just wondering if it is possible to embed an AQL into the archetype so that the data set for a DV\_CODED\_TEXT is formed out of existing compositions.

For example, a hospital registration form that asks for a person’s allergies. Instead of an empty field, it can be populated from existing data through a query so that the front desk can just validate the data. Can this be modeled into the archetype? Or should it be an implementation detail?

regards

---

<div class="post-metadata">

### Author: ![siljelb](https://discourse.openehr.org/user_avatar/discourse.openehr.org/siljelb/32/12_2.png) [@siljelb](https://discourse.openehr.org/u/siljelb)
#### Post date: [5 July 2017 13:15 UTC](https://discourse.openehr.org/t/using-aql-for-data-set-in-dv-coded-text/15488/2 "2017-07-05T13:15:30Z")

</div>

Hi Dileep!

Functionality like you describe should be part of the application implementation, not the archetype.

Kind regards,  
**Silje Ljosland Bakke**

Information Architect, RN

Coordinator, National Editorial Board for Archetypes  
Nasjonal IKT HF, Norway

Tel. +47 40203298

Web: [http://arketyper.no](http://arketyper.no/) / Twitter: [@arketyper\_no](https://twitter.com/arketyper_no)

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [5 July 2017 14:00 UTC](https://discourse.openehr.org/t/using-aql-for-data-set-in-dv-coded-text/15488/3 "2017-07-05T14:00:47Z")

</div>

It could be an application detail.

Or in ADL 2 it can be a query function in the rules section, as defined in the specs. Not sure if you want this in basic archetypes, but you can certainly do this in adl 2 templates.

I'm not sure what you can do in GDL.

Regards,

Pieter Bos  
Nedap Healthcare

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [5 July 2017 14:53 UTC](https://discourse.openehr.org/t/using-aql-for-data-set-in-dv-coded-text/15488/4 "2017-07-05T14:53:46Z")

</div>

Hi  
We have implemented this in the form based on the operational template.  
Then we put reuse information with AQL to query structures to be reused for different purposes.  
Works perfectly well 🙂

Regards  
Bjørn Næss  
Product owner Arena EHR  
DIPS ASA

Mobil +47 93 43 29 10

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [5 July 2017 15:25 UTC](https://discourse.openehr.org/t/using-aql-for-data-set-in-dv-coded-text/15488/5 "2017-07-05T15:25:58Z")

</div>

Hi Dileep,

You are mixing modeling/design with implementation/runtime. Archetypes can define terminology bindings at design time. Those should be resolved at runtime.

You can just create other files with AQLs, and another file that maps archetype paths to the AQL files. Your app will be able to load the archetype, load the AQL and execute AQL to resolve the term subset for each DV\_CODED\_TEXT in your archetype, and use that on a GUI.

Of course files are just examples, implementation can be at a database level.

Hope that helps 🙂
