2

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?

Andy
  • 3,228
  • 8
  • 40
  • 65
  • I think the ID of your extensions looks a bit weird. I would expect something like [fhirbase]/StructureDefinition/my-extension, without sub-parts to that. Is there a reason you have this construction? – Mirjam Baltus Nov 14 '16 at 11:16
  • Yes, I'm auto generating the profiles/extensions from another similar system to fhir. In that system the source of profiles/extensions are different object types so don't have a conflict of path when they are named the same thing. Basically the source of a profile can have exactly the same name as the source of an extension. I can't really see why that should cause a problem though, if they're using uri's to define things, why would you be limited to only using a flat hierarchy? – Andy Nov 14 '16 at 11:21
  • You can setup your hierarchy as you want, but the form of a FHIR compliant ID is always [fhirbase]/[resource type]/[id], where the id is of the id datatype. so what you could do to become FHIR compliant is use '-' instead of '/', or put this "stelar/extension/" part before the resource type. – Mirjam Baltus Nov 14 '16 at 12:09
  • I've just realised that you're the same person as the first answer. Thanks for commenting, I've added additional information related to this in response to your answer, shall we continue this discussion there. – Andy Nov 14 '16 at 13:15

1 Answers1

1

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.

Mirjam Baltus
  • 2,035
  • 9
  • 13
  • I did miss that, just added it but still getting the same issue. Is there a log where I might find a more detailed print of how it is failing? My other thought is perhaps the profile itself is incorrect? It parses in Simplifier, but I think Simplifier uses a different validation protocol to HAPI. As far as I'm aware, the profiles aren't validated on upload, so I can only assume they are parsed when they are needed. – Andy Nov 14 '16 at 11:29
  • A Fhir server should validate a resource against the base definition on upload. This can just be a basic kind of validation. I do think that Hapi might have a problem with the way your IDs are setup. A Fhir server would expect [fhirbase]/[resource type]/ID as valid technical ID. So if you are asking the server to lookup profile={{URL}}/StructureDefinition/stelar/profile/questionResponse, perhaps the server cannot handle that, since IDs cannot have a '/' in them. – Mirjam Baltus Nov 14 '16 at 11:57
  • I just changed it to {{URL}}/Basic/$validate?profile={{URL}}/StructureDefinition/419 however the same issue still seems to occur. My worry about going down that route is that I can't guarantee those id's since it's up to the server to define though, so I would not be able to construct fhir bundles which are portable between different fhir server instances. – Andy Nov 14 '16 at 13:13
  • I've commented on your [question about extensions](http://stackoverflow.com/questions/40679422/how-for-i-search-fhir-resources-based-on-extension-values) with the errors I found in your example resource there. Some of those errors are also present in the resource you've listed above. Please correct those and try validating again. Perhaps it could even help just to upload your resource to the server to get the validation errors against the base resource type, before you try to validate against your own profile. – Mirjam Baltus Nov 21 '16 at 09:56