Cardinality?

Hi,

At our previous archetype workgroup meeting we chanced upon an archetype (openEHR-EHR-EVALUATION.goal.v1) in which the cardinality of a cluster (“Target”) was different than most of the others we’d seen. We were unsure what cardinality is used for in this context, and we couldn’t find any documentation on the topic. Could anyone point us towards the documentation, alternatively explain in simple terms what is meant by cardinality in archetypes, what to use it for and how?

Hi Silje,

Cardinality only applies to containers e.g Clusters. It specifies how
many children can or should be within that container.

So

0.* means that children are optional and any number of children are allowed
1..1 means that there must be at least one child but no more.

In the EVALUATION.goal example the Target cluster has a cardinality
of 1..4, and occurences of 0.*

The occurences constraint means that the whole Target Cluster is
optional but can repeated indefinitely.
The cardinality constraint says that within each of these Target
Clusters you must have at least one child node and a maximum of 4
nodes.

The Cardinality 1.. is set because one of the child elements
"Archetype Node path" has 1..1 for ocurrences i.e is mandatory, so the
minimum cardiality is simply aligned with the demands of the child
constraints. If you make another child node mandatory, cardinality
should change to 2..4.

The maximum ..4 is, I think, a carry over from previous versions of AE
where the maximum cardinality kept step with the maximum number of
nodes in the cluster i.e if you add another node it would change to
1..5.

In general I would not recommend setting a maximum cardinality
constraint, as it can cause problems with specialisations and
revisions. I suspect that we would change this example to 1..* when it
is formally reviewed.

There are few rare occasions when setting maximum cardinality can be
helpful e.g to mimic an XSD-style 'choice' construct but even then it
is pretty opaque to clinical users and probably best avoided.

Ian

Dr Ian McNicoll
office +44 (0)1536 414 994
fax +44 (0)1536 516317
mobile +44 (0)775 209 7859
skype ianmcnicoll
ian.mcnicoll@oceaninformatics.com

Clinical Modelling Consultant, Ocean Informatics, UK
Director/Clinical Knowledge Editor openEHR Foundation www.openehr.org/knowledge
Honorary Senior Research Associate, CHIME, UCL
BCS Primary Health Care www.phcsg.org