# Dynamic archetype in slot based on preconditions

**URL:** https://discourse.openehr.org/t/dynamic-archetype-in-slot-based-on-preconditions/1329
**Category:** Clinical
**Tags:** archetype, template
**Created:** [28 February 2021 10:41 UTC](https://discourse.openehr.org/t/dynamic-archetype-in-slot-based-on-preconditions/1329 "2021-02-28T10:41:31Z")
**Posts on this page:** 1
**Showing post:** 8

<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: [10 April 2025 10:42 UTC](https://discourse.openehr.org/t/dynamic-archetype-in-slot-based-on-preconditions/1329/8 "2025-04-10T10:42:50Z")

</div>

I’m coming back to this on the basis of this topic

> [@Linking multiple compositions with a "compound composition"](https://discourse.openehr.org/t/linking-multiple-compositions-with-a-compound-composition/6549):
>
> Hello Community, My company is thinking about how to best connect multiple compositions that are used within the same context (e.g. a single visit or a status report). Using a single large template for all datapoints is not possible for us for this use case. As mentioned in [this thread](https://discourse.openehr.org/t/link-multiple-compositions-to-a-single-visit/2326), we tried out folders, but are not convinced that this is the optimal solution. Specifically, we found no way to get the folders that a composition is part of (and even if we did, it would be a list of IDs that …

which was really raised because of an attempt to do something very similar to the idea of a ‘dynamic template’.

By that we mean that a template can in some way be extended at run-time to allow dynamic validation of a composition.

A classic use-case is the GP consultation where an almost infinite number of Observation archetypes might need to be used to cover all the clinical possibilities.

The normal solution is the ‘mega-template’ but this does become unmanagable at some point.

I wondered about the another possibility, possibly enabled by ADL2, which handle Entry level templates (embedded templates) more elegantly, and the ability to leave slots open and fillable at run-time.

The core of a GP Encounter is a traditional Composition template but it is possible for the app, at run-time to fill any valid open slots with Entry level templated data, as long as these Entry-level templates are registered on the CDR (essentially as .opts).

When the composition is committed, the Entry-level TemplateId is carried in ENTRY.LOCATABLE.archetype\_details.

At commit the CDR would assemble a virtual .opt against which to validate the Composition.

Could that work. It might even work for Clusters but ?? issues with nesting (or not)

---

_[View the full topic](https://discourse.openehr.org/t/dynamic-archetype-in-slot-based-on-preconditions/1329)._
