Andy
Andy

Reputation: 3522

Why isn't my fhir resource validating against a profile?

I'm trying to validate an instance of the resource type 'Basic' against the following profile which I've created: https://simplifier.net/Crew/questionResponse

I have uploaded the profile to my local HAPI server, I then try to upload a resource and have it validate using the following url: {{URL}}/Basic/$validate?profile={{URL}}/StructureDefinition/stelar/profile/questionResponse

This is the resource:

<Basic>
    <meta>
      <versionId value="1.0"/>
      <lastUpdated value="2016-11-04T16:54:45Z"/>
      <profile value="http://stelar.org/StructureDefinition/stelar/profile/questionResponse"/>
    </meta>
    <text>
      <status value="generated"/>
    </text>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/subjectNo">
      <valueString value="ABCDE"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/followUp">
      <valueCoding value="FollowUp.1Y"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/methodOfFollowUp">
      <valueCoding value="FollowUpMethod.ClinicVisit"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/variableLabel">
      <valueString value="Has your child had bronchiolitis? At what age?"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/quName">
      <valueString value="Questionnaire 1"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/aIW">
      <valueInteger value="564"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/respondent">
      <valueCoding value="Person"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/dateID">
      <valueDate value="1989-06-02"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/quSubject">
      <valueCoding value="Person.StudySubject"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/dataSource">
      <valueCoding value="DataSource.Questionnaire"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/dataResponse">
      <valueDouble value="6.7"/>
    </extension>
</Basic>

When I upload it to happy I get a non numbered error code returned with the message 'Unexpected failure while validating resource'. I'm not really sure how to find out why it was failing though.

How do I go about this? Can anyone spot what the issue with my form is?

Upvotes: 2

Views: 1559

Answers (1)

Mirjam Baltus
Mirjam Baltus

Reputation: 2299

The Basic resource has a code field that is mandatory, see the definition. Your resource doesn't specify this field. Not sure if this is why Hapi isn't happy, but it is a validation error.

Upvotes: 1

Related Questions