Stream: implementers
Topic: constraining referenced official profiles in custom profiles
Georg Fette (Dec 10 2018 at 08:24):
Hello, I am writing custom profiles and use References that reference offical profiles like Range. Is it possible to constrain the unit or range of these ranges in the definition of the StructureDefinition of my custom profile ?
Ewout Kramer (Dec 10 2018 at 12:21):
I think it's possible, but I am confused about you saying "references that reference official profiles like Range". References reference Resources, not datatypes. In any case, your custom profile CAN constrain the basic types:
- create a separate "type profile" that constrain that type (here: Range)
- In the profile that you are writing now (and that uses Range), make the "typeRef" part of the ElementDefinition (depends a bit on the tool you are using how to do that) point to that "type profile".
Georg Fette (Dec 10 2018 at 13:09):
ah, thank you.
Your right with References referencing Resources. But could be said that the definition of the Reference in the StructureDefinition references a datatype?
Michel Rutten (Dec 10 2018 at 14:08):
Hello @Georg Fette, basically you have two options:
1) Create a custom type profile, derived from a standard datatype profile, with additional constraints. Now other custom profiles can refer to this custom datatype via an ElementDefinition.type.profile constraint.
2) Alternatively, a custom profile can specify inline constraints on referenced external type/resource profiles. For example, your custom profile could further constrain an element with (default) datatype Range by limiting the low/high values.
The first approach is a bit involved, but facilitates re-use.
Forge, the FHIR profile editor, supports both approaches, so you could experiment a bit before deciding which approach suits best.
Last updated: Apr 12 2022 at 19:14 UTC