How does the dataAbsentReason extension look like in an Observation.effectiveDateTime

Hi, we have a profile where the Observation.effectiveDateTime has a dataAbsentReason extension.

I’m trying to create an example with data for that reason but I’m not 100% sure of the syntax. I think something like this should be valid:

"effectiveDateTime": {
    "extension": {
      "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason",
      "valueCode": "unknown"
    }
  },

But when I validate on Observation (r4) FHIR Resource - 1upHealth Developer Documentation and FHIR APIs

I get:

The FHIR resource is not valid ValidationError: child “effectiveDateTime” fails because [“effectiveDateTime” must be a string]

How can I put the dataAbsentReason in the effectiveDateTime?

Thanks.

In JSON, simple types are represented as simple values, not objects. When you need to convey object properties for a simple type (e.g. extension, id, etc.), you need to use the ‘object’ property - which has the same name as the base property, but with “_” in front. So in this case:

"_effectiveDateTime": {
    "extension": [{
      "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason",
      "valueCode": "unknown"
    }]
  },

Note - the extension property needs to be an array, so I tweaked that too.

1 Like

Thank you, can you point me out to the specs where that rule is specified?

http://hl7.org/fhir/json.html#primitive