hagem
hagem

Reputation: 189

HL7 FHIR: Profile for adapting another data type

E. g. In Composition the element date has the data type dateTime.

<Composition xmlns="http://hl7.org/fhir">
    ...
    <date value="[dateTime]"/><!-- 1..1 Composition editing time § -->
    ...

Is it with a Profile possible that the element date also adapts another data type, for instance the data type date?

Upvotes: 0

Views: 209

Answers (2)

Lloyd McKenzie
Lloyd McKenzie

Reputation: 6793

Chris is correct - the type cannot change and new types cannot be added. So if the specification says dateTime, you can't use "string" instead. However, in this specific circumstance, you can communicate "just date" within dateTime. And you can assert constraints against the type. So in theory, you could assert a length constraint of 10 characters on dateTime, essentially making it a date. As well, there's no requirement in FHIR that you store everything that's sent to you. So it's legitimate to throw away any time information that is sent to you (see http://hl7.org/fhir/2015May/updates.html for more information).

As a rule, stripping the time would be better than outright rejecting instances that contain a time. However, even that option is going to be seen as unexpected/undesirable by many communication partners.

Upvotes: 1

Chris Grenz
Chris Grenz

Reputation: 161

See http://hl7.org/fhir/2015May/structuredefinition.html#6.17.5.2

Under the bullet "In practice..." the specification states "the list of types for an element must be the same or a subset of the list of types for the same element in the base structure".

So, no, new types may not be introduced. In general, a Profile (StructureDefinition) can only further restrict the use/content of a resource. It may not loosen the standard.

Upvotes: 1

Related Questions