FHIR Chat · Extending a primitive type in a profile · implementers

Stream: implementers

Topic: Extending a primitive type in a profile


view this post on Zulip Ville Lindholm (Jun 07 2017 at 17:15):

Hi! I've been following this blog post https://fhirblog.com/2017/01/10/extending-a-required-valueset-binding/ since I want to add two more types to Questionnaire.item.type. From the blog it's easy to see how to use the extended values, but I can't find any info about how the extension should be defined (or how to use it in a profile). At the moment I have this extension (just noticed that forge doesn't escape double quotes in strings):

<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="https://duodecim.fi/fhir/stu3/extensions/symptom-checker-item-type"/>
  <name value="SymptomCheckerItemType"/>
  <status value="draft"/>
  <description value="Add types "subtitle" and "feedback" to Questionnaire.item.type."/>
  <fhirVersion value="3.0.0"/>
  <kind value="primitive-type"/>
  <abstract value="false"/>
  <contextType value="resource"/>
  <context value="Questionnaire.item.type"/>
  <type value="Extension"/>
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension"/>
  <derivation value="constraint"/>
  <differential>
    <element>
      <path value="Extension.url"/>
      <fixedUri value="https://duodecim.fi/fhir/stu3/extensions/symptom-checker-item-type"/>
    </element>
    <element>
      <path value="Extension.valueString"/>
      <short value="Expanded Questionnaire item type"/>
      <definition value="Extend allowed item types to include "feedback" and "subtitle"."/>
      <type>
         <code value="string"/>
      </type>
      <binding>
         <strength value="required"/>
         <valueSetUri value="https://duodecim.fi/fhir/stu3/ValueSet/symptom-checker-questionnaire-item-type"/>
      </binding>
    </element>
  </differential>
</StructureDefinition>

where I've defined a ValueSet that includes a CodeSystem that contains my two new types. Is this even close to correct? type is a string field bound to the value set https://www.hl7.org/fhir/valueset-item-type.html .

view this post on Zulip Lloyd McKenzie (Jun 07 2017 at 17:43):

The no quotes in strings is an XML thing, not a Forge thing. You can use ". For examples of how to use extensions on Questionnaire, take a look at the SDC profile

view this post on Zulip Michel Rutten (Jun 07 2017 at 21:29):

Hi @Ville Lindholm, if you save the XML and inspect the file in a text editor, you will notice that the quote actually is encoded as """. So attribute values are correctly encoded, however you cannot see the encoding in the Forge XML tab.

view this post on Zulip Michel Rutten (Jun 07 2017 at 21:35):

Concerning extensions; first you need to define the extension itself (as above). Then you create a profile, add an extension element and map it to the previously created extension definition.

view this post on Zulip Ville Lindholm (Jun 08 2017 at 04:17):

@Lloyd McKenzie Thanks, it seems like examples are the easiest way to go :)

And @Michel Rutten yes, I'm aware of the workflow, but what actually goes into the extension and how it's attached to the element correctly is less clear :D You seem to work for Furore, are there any "user stories" type of guides for Forge? As in, "this is the exact set of steps to do task X". The general documentation does provide an overview of the user interface, but it's sometimes hard to know which buttons to push / text boxes to fill to get to the same XML that some FHIR tutorial shows as an example! :) And good to know about the double quotes, I just assumed that the XML tab contains whatever will be written to disk.

view this post on Zulip Ville Lindholm (Jun 08 2017 at 04:18):

Of course, if one can find good example files, it's possible to open them in Forge and try to reverse engineer from there. But getting the documentation straight from the source is of course preferable.


Last updated: Apr 12 2022 at 19:14 UTC