FHIR Chat · Can I change base date type in a profile · implementers

Stream: implementers

Topic: Can I change base date type in a profile


view this post on Zulip Yunwei Wang (Sep 26 2017 at 16:03):

Just for curiosity, how can I profile a CodeableConcept instance in a resource to have 1 and only 1 coding? For example, Patient.contact.relationship is a CodeableConcept. And I want my client know that my server can take only one coding in that property.

view this post on Zulip Stefan Lang (Sep 26 2017 at 17:24):

You just create a profile on the resource and restrict the cardinality of coding to 0..1 (or 1..1, however you need it).
More info about profiling: https://www.hl7.org/fhir/profiling.html
For info about tooling see today's discussion here: https://chat.fhir.org/#narrow/stream/implementers/topic/How.20to.20create.20a.20new.20profile.20in.20existing.20resource

view this post on Zulip Yunwei Wang (Sep 26 2017 at 19:18):

coding is inside CodeableConcept data type. That is my question. I can profile a resource. But can I profile a data type?

view this post on Zulip Lloyd McKenzie (Sep 26 2017 at 20:35):

Yes, you can profile a data type. And you can also profile "into" a data type. For example, if you want, you can have a profile on Observation that says Observation.code.coding.display is 1..1

view this post on Zulip Michel Rutten (Sep 27 2017 at 11:18):

Hi @Yunwei Wang, indeed as Lloyd explains, a profile can introduce constraints on child elements defined by an external datatype profile. Specifically, an Observation profile can define constraints on Observation.code, but also on the Observation.code.coding child element, overriding the original definition in the CodeableConcept datatype. Alternatively, you can define a custom datatype profile, e.g. MySpecialCodeableConcept, and then constrain the Observation.code element to this profile using the type.profile property. This is useful if you want to reuse a set of datatype constraints in multiple profiles.

Note that Forge supports both approaches. If you assign a custom type profile, you may have to reload the referencing profile in order to expand the inherited child element constraints.

view this post on Zulip Stefan Lang (Sep 27 2017 at 13:20):

As an addition from a practical point of view: you would profile the data type when you want to reuse that in multiple places, like resource profiles.
When you need the reduced cardinality only in a single resource profile, you'd constrain it directly in there to reduce overhead. But of course you can use both variants anytime.

view this post on Zulip Yunwei Wang (Sep 27 2017 at 14:12):

Thank you @Stefan Lang @Michel Rutten @Lloyd McKenzie


Last updated: Apr 12 2022 at 19:14 UTC