FHIR Chat · FHIRValidator.org: the property reference must be an object · implementers

Stream: implementers

Topic: FHIRValidator.org: the property reference must be an object


view this post on Zulip Carl Anderson (Jul 07 2021 at 15:06):

Can I get some help interpreting this validation error?

Here's what I'm validating:

{
      "resourceType": "Bundle",
      "id": "scratchpad-read-all-example",
      "type": "collection",
      "entry": [
        {
          "fullUrl": "http://example.com/ServiceRequest/1",
          "resource": {
            "resourceType": "ServiceRequest",
            "id": "1",
            "status": "draft",
            "intent": "proposal",
            "subject": {
              "reference": "http://example.com/Patient/123"
            }
          }
        },
        {
          "fullUrl": "http://example.com/MedicationRequest/1",
          "resource": {
            "resourceType": "MedicationRequest",
            "id": "1",
            "status": "draft",
            "intent": "proposal",
            "medication": {
              "reference": "http://example.com/Medication/123"
            },
            "subject": {
              "reference": "http://example.com/Patient/123"
            }
          }
        }
      ]
    }

The validation error is in regard to the medication reference. The full error is:

Error Line: 27
The property reference must be an Object, not a primitive property (at Bundle.entry[1].resource.medication.reference)

I assume this is a straightforward problem, but I'm not super familiar with using the validator yet.

Thanks!

view this post on Zulip Carl Anderson (Jul 07 2021 at 15:26):

So, I was able to silence the validator by changing my medication reference to look like this:

            "medication": {
              "reference": {
                "reference": "http://example.com/Medication/123"
              }
            },

But... is this really correct?

view this post on Zulip Daniel Venton (Jul 07 2021 at 15:26):

There is no such attribute medication, it is either
.. medication[x] SΣ 1..1 Medication to be taken
Binding: Medication Clinical Drug (extensible)
.... medicationCodeableConcept CodeableConcept
.... medicationReference Reference(US Core Medication Profile)

the attribute should be called medicationReference in your case.

view this post on Zulip Carl Anderson (Jul 07 2021 at 15:31):

That's what I thought at first, but when I had it this way:

            "medicationReference": "http://example.com/Medication/123",

I got these errors:

Error Line: 25
Unrecognised property '@medicationReference'
Error Line: 26
MedicationRequest.medication: minimum required = 1, but only found 0 (from http://hl7.org/fhir/StructureDefinition/MedicationRequest)

I'm assuming I'm doing something obviously wrong, but I just don't see it.

view this post on Zulip Carl Anderson (Jul 07 2021 at 15:32):

FWIW - my first attempt was something like this, which yielded the same error.

            "medicationReference": {
              "reference": "http://example.com/Medication/123"
            },

view this post on Zulip Daniel Venton (Jul 07 2021 at 15:42):

This example on uscore: https://www.hl7.org/fhir/us/core/MedicationRequest-uscore-mo2.json.html
shows it as:
"status" : "active",
"intent" : "order",
"medicationReference" : {
"reference" : "#med2",
"display" : "Nizatidine 15 MG/ML Oral Solution [Axid]"
},
"subject" : {
"reference" : "Patient/example",
"display" : "Amy Shaw"
},

1st question to ask when dealing with a validator, do you think the validator is right?

view this post on Zulip Carl Anderson (Jul 07 2021 at 15:47):

@Mark Iantorno ?

view this post on Zulip Chris Moesel (Jul 07 2021 at 15:48):

Based on your description of what is happening, and the error "MedicationRequest.medication: minimum required = 1", I think that the validator is validating against the R5 MedicationRequest. It has a medication element that is a CodeableReference. In that case, "medication": { "reference": { "reference": "http://..." } } would be valid. In fact, I also just tried "medication": { "concept": { "text": "My Med" } } and it worked w/ 0 errors -- so that seems to confirm; it is validating against R5 -- not R4.

view this post on Zulip Mark Iantorno (Jul 07 2021 at 15:50):

Yeah what version are you validating against?

view this post on Zulip Josh Mandel (Jul 07 2021 at 15:50):

You're looking at how the CodeableReference datatype is defined in the current build: http://build.fhir.org/references.html#CodeableReference

view this post on Zulip Josh Mandel (Jul 07 2021 at 15:51):

image.png

In other words, a CodeableReference uses thereference property associated with Reference-type element. This in turn uses a reference property associated with the URL of the referenced thing.

view this post on Zulip Chris Moesel (Jul 07 2021 at 15:51):

@Mark Iantorno -- when I tried it, the options said FHIR 4.0.1, but as noted above, it seems it is using FHIR 4.6.0 (or some other R5).

view this post on Zulip Chris Moesel (Jul 07 2021 at 15:54):

@Carl Anderson -- if you try the Inferno FHIR Validator it gives the results you would expect for validating against FHIR 4.0.1 (i.e., it allows medicationReference).

view this post on Zulip Mark Iantorno (Jul 07 2021 at 15:54):

Let me look into why it's not validating against the correct version

view this post on Zulip Mark Iantorno (Jul 07 2021 at 15:56):

Github issue opened here: https://github.com/hapifhir/org.hl7.fhir.validator-wrapper/issues/60

view this post on Zulip Carl Anderson (Jul 07 2021 at 16:00):

@Mark Iantorno - I'm just using the online validator: https://fhirvalidator.org/ - I'm not sure how to tell which spec it's using

view this post on Zulip Mark Iantorno (Jul 07 2021 at 16:01):

It will say in the options

view this post on Zulip Mark Iantorno (Jul 07 2021 at 16:01):

I will fix it

view this post on Zulip Mark Iantorno (Jul 07 2021 at 16:01):

...and put an indicator on the main validation page to indicate the version more clearly

view this post on Zulip Carl Anderson (Jul 07 2021 at 16:02):

Ah, there it is. According to the options it's 4.0.1 - like Chris said.

view this post on Zulip Carl Anderson (Jul 07 2021 at 16:02):

Thanks for looking into this!

view this post on Zulip Mark Iantorno (Jul 07 2021 at 16:02):

yeah, it's def an error

view this post on Zulip Mark Iantorno (Jul 07 2021 at 16:02):

probably just sending "current" or "4" as the version, and the validator is upping the version to the one that it thinks is reasonable behind the scenes

view this post on Zulip Mark Iantorno (Jul 07 2021 at 16:03):

should be a simple ish fix

view this post on Zulip Mark Iantorno (Jul 07 2021 at 16:03):

I appreciate your patience, this is the first full blown website from scratch I've done, so it's provided a bunch of challenges along the way

view this post on Zulip Mark Iantorno (Jul 08 2021 at 18:38):

This fix should be in now btw.


Last updated: Apr 12 2022 at 19:14 UTC