0

Does a FHIR extension always have to be defined in its own StructureDefinition before it can be used in a resource profile?

Or can its definition exist solely within the StructureDefinition of a profiled resource?

E.g.

<StructureDefinition xmlns="http://hl7.org/fhir">
        <base value="http://hl7.org/fhir/StructureDefinition/Order" />
        <name value="Order" />
        ...
            <differential>
                <element>
                    <path value="Order.extension" />
                    <name value="type" />
                    <label value="Type" />
                    <short value="BookAppointment | TelephonePatient | PatientNote | Note | Other" />
                    <definition value="Order type" />
                    <min value="1" />
                    <max value="1" />
                    <type>
                        <code value="code" />
                    </type>
                    <binding>
                        <strength value="required" />
                        <valueSetReference>
                            <reference value="http://test.org/fhir/ValueSet/task-type" />
                        </valueSetReference>
                    </binding>
                </element>
            ...

Is the above valid?

Jonny Rylands
  • 193
  • 4
  • 12

1 Answers1

1

No, that's not valid - because Order.extension can't have a type of "code". You could, in theory, slice extension and constrain the value[x] type to be valueCode with the specified properties. You'd also have to constrain the URL to a specified fixed value. The tricky part is that the URL you indicate as the fixed value is supposed to resolve to a StructureDefinition that defines the extension. So you really won't have saved yourself any work. Sending an instance where any immediate receiver can't discover the extension definition would make you automatically non-conformant.

Lloyd McKenzie
  • 6,345
  • 1
  • 13
  • 10
  • Would the correct implementation therefore be to have ` ` with taskType structure def... ` ` – Tirinoarim Nov 03 '15 at 16:49
  • You'll need a repetition of Order.extension that declare you're slicing. And you'll still need to define the extension externally - you can fully define it inside if you want to further constrain or be super-explicit for some reason, but the extension definition still needs to be created in its own stand-alone StructureDefinition. – Lloyd McKenzie Nov 03 '15 at 20:26