Error validating a simple FHIR resource based on profile

518 Views Asked by At

I am currently trying to build some examples for using profiles with complex extensions, but they all fail to validate on SIMPLIFIER and my local HAPI-FHIR server.

I got a simple profile https://simplifier.net/Velferd-test-og-lek/test-flag/~overview This one has two timestamps, and one of them is mandatory. When I try to implement it like this (https://simplifier.net/Velferd-test-og-lek/Flag-example-2/~xml):

<Flag>
<meta>
 <profile value="http://ehelse.no/fhir/vft/STU3/StructureDefinition/test-flag" />
</meta>
 <extension url="kodeverdi">
  <extension url="http://ehelse.no/fhir/vft/STU3/StructureDefinition/vft-timestamp">
   <valueDateTime value="2017-05-09T10:00:00.936+02:00" />
  </extension>
 </extension>
 <extension url="kodeverdi-obligatorisk">
  <extension url="http://ehelse.no/fhir/vft/STU3/StructureDefinition/vft-timestamp">
    <valueDateTime value="2017-05-09T11:00:00.936+02:00" />
  </extension>
 </extension>
 <identifier>
  <value value="test-id" />
 </identifier>
 <status value="active" />
 <code>
  <text value="Bruker utenfor Geofence" />
 </code>
 <subject>
  <identifier>
   <system value="http://ehelse.no/fhir/identifiertypes/FNR" />
   <value value="05073500186" />
  </identifier>
 </subject>
</Flag>

The example fails to validate because it supposedly don't contain a "kodeverdi-obligatorisk" element. ERROR on SIMPLIFIER: Instance count for 'Flag.extension:kodeverdi-obligatorisk' is 0, which is not within the specified cardinality of 1..1

I guess there is some problem related to naming the "kodeverdi-obligatorisk" element so that the validator recognize it, but I have tried different approaches and they all fail somehow.

Any help is appreciated. Thomas

1

There are 1 best solutions below

0
On

The outer URL needs to be a full URL. The inner URL can be just a string if you're dealing with a complex extension. i.e. This might be legal:

 <extension url="http://ehelse.no/fhir/vft/STU3/StructureDefinition/kodeverdi">
  <extension url="http://ehelse.no/fhir/vft/STU3/StructureDefinition/vft-timestamp">
   <valueDateTime value="2017-05-09T10:00:00.936+02:00" />
  </extension>
 </extension>

or this

 <extension url="http://ehelse.no/fhir/vft/STU3/StructureDefinition/vft-timestamp">
  <valueDateTime value="2017-05-09T10:00:00.936+02:00" />
 </extension>

Exactly what's legal depends on the StructureDefinition that defines your extensions