FHIR Chat · Reference is required resource or identifier reference · IG creation

Stream: IG creation

Topic: Reference is required resource or identifier reference


view this post on Zulip Kevin Mayfield (Jul 20 2021 at 07:16):

Wondering about the best way to enforce this?

What I'm doing is adding a constraint expression on Reference like:

(reference.exists() or (identifier.exists() and display.exists()))

That works and ensures resources vaidate ok.
It also works for rest and message exchanges. However for some messages I want to force one option. At present what I doing is using MessageDefinition.focus e.g. for prescriptionorder's

 <focus>
        <code value="MedicationRequest" />
        <profile value="https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationRequest" />
        <min value="1" />
        <max value="4" />
    </focus>
    <focus>
        <code value="Patient" />
        <profile value="https://fhir.nhs.uk/StructureDefinition/NHSDigital-Patient" />
        <min value="1" />
        <max value="1" />
    </focus>

I don't think focus is the right way of doing this, the focus is really just the MedicationRequest but its clear what the payload requirements are and we as we use MessageDefinitions in our FHIR Validation it can be tested.
It also means we can use the same MedicationRequest profile for both restful and message.

view this post on Zulip Lloyd McKenzie (Jul 20 2021 at 15:13):

The focus must be pointed to by Reference.reference as the reference must be resolvable and must be in the Bundle

view this post on Zulip Kevin Mayfield (Jul 20 2021 at 21:07):

Yes but I'm not convinced thats the easiest way of telling a developer what should be in the Message Bundle. (I am biased and coming from a v2 background - I'm used to seeing messages broken down by segments and MessageDefinition can be used the same way)
Plus its not a lot of code to alter HAPI Validation to take into account the MessageDefinition.

view this post on Zulip Lloyd McKenzie (Jul 20 2021 at 21:13):

MessageDefinition focus only points to the focus of the message, NOT all of the resources in the Bundle. If you want to specify all the resources, you either put a profile on focus that cascades through profiles on other resources to define what's in the Bundle vs. not or you use the .graph element.

view this post on Zulip Lloyd McKenzie (Jul 20 2021 at 21:14):

For example, if you're doing a message where the event is a patient discharge, the only resource that can be a focus is a single Encounter. Focus can't be anything else - because Encounter is the status change trigger.


Last updated: Apr 12 2022 at 19:14 UTC