0
votes

So I've been tearing my hair out the past couple of days trying to create a fhir profile based on the Basic resource, and create an instance of that resource compliant with the profile.

I cannot for the life of me find a simple straight forward example of how you are supposed to do this as the documentation is explains everything in functional chunks and doesn't at any point seem to put anything together.

Essentially I'm just looking for one xml StructureDefition defining a profile based on Basic, and another xml Basic resource which can correctly validate against the profile. I've tried writing it myself but I can't make sense of the documentation and HAPI throws an error with each attempt.

If there are no straight forward examples, please could someone write one in place here to serve for other people looking for the same thing, as an example, the profile has the following:

Name: String, Required, min:1, max:1
TimeOfRecording: Timestamp, Required, min:1, max:1
AttendingStaff: String, Not Required, min: 1, max: unlimited.

Thanks

1

1 Answers

1
votes

Profile: http://hl7.org/fhir/us/qicore/2016Sep/StructureDefinition-qicore-adverseevent.xml

Instance: http://hl7.org/fhir/us/qicore/2016Sep/Basic-basic-adverseevent-example.xml

Be sure to view both as source so you don't just see the narrative. They were created against the September 2016 release, so you'll need to validate them using that infrastructure (and that's a little tricky to do, so I haven't verified that they actually validate). Actually, as I visually inspect the instance, I can already see at least one issue - the urls inside complex extensions should just be the name of the nested node. I.e.

<extension url="http://hl7.org/fhir/qicore/StructureDefinition/adverseevent-cause#item">
  <valueReference>
    <reference value="Medication/qicore"/>
  </valueReference>
</extension>

Should be

<extension url="item">
  <valueReference>
    <reference value="Medication/qicore"/>
  </valueReference>
</extension>

The validator in place at the time that IG was published wasn't smart enough to detect the issue. The new one will be (but won't work with the Sept 2016 release).

If you're looking at using DSTU 2, the structure definition for the profile will be a bit different, but the instance should be pretty much the same - I don't think Basic has changed much.

Hope that helps.