FHIR Chat · Adding valueInteger to Observation resource · implementers

Stream: implementers

Topic: Adding valueInteger to Observation resource


view this post on Zulip Sadiq Saleh (Dec 22 2016 at 16:41):

I am trying to add a new type to the Observation.value[x] and am faced with the following error when I try to build:
illegal constrained type integer from Quantity, CodeableConcept, string, Range, Ratio, SampledData, Attachment, time, dateTime, Period

I don't understand what constraint is being broken? Is it a constraint placed on value[x]? How can identify the constraint? It is especially confusing for me, because value[x] for extensions can have integers as a type.

Thanks for any help that you can provide.

view this post on Zulip Richard Kavanagh (Dec 22 2016 at 17:01):

What type are you trying to add?

view this post on Zulip Eric Haas (Dec 22 2016 at 19:40):

valueInteger is not a choice for Value[x]. you can a) use ValueQuantity or b) create an extension. What is your use case?

view this post on Zulip Sadiq Saleh (Dec 22 2016 at 19:59):

I am trying to add a count type value, but find that the the current extension (using valueQuantity with unit=1) may be a bit confusing for our end users. I will try to create an extension.

Just for my understanding, why is valueInteger not a choice for value[x]?

view this post on Zulip Sadiq Saleh (Dec 22 2016 at 20:08):

@Richard Kavanagh I am trying to add type Integer to value. I just tried this with an extension under value but this has the same error. Are the types that value[x] support fixed, and if not, how do I add to the types?

view this post on Zulip Grahame Grieve (Dec 22 2016 at 20:14):

yes the types that are allowed in Observation.value[x] are fixed in the definition of the Observation resource, to Quantity|CodeableConcept|string|Range|Ratio|SampledData|Attachment|time|dateTime|Period

view this post on Zulip Grahame Grieve (Dec 22 2016 at 20:15):

They are restricted to this because each type that is added is new work for everyone who deals with Observation

view this post on Zulip Grahame Grieve (Dec 22 2016 at 20:16):

what do you think is confusing?

view this post on Zulip Sadiq Saleh (Dec 22 2016 at 20:17):

@Grahame Grieve Thanks for the clarification. I hadn't understood that the definition of value[x] was fixed and could not be extended.

So I would have to create an extension at the main level of Observation if I want to add a count attribute?

view this post on Zulip Grahame Grieve (Dec 22 2016 at 20:18):

you mean, if the Observation value is a count?

view this post on Zulip Sadiq Saleh (Dec 22 2016 at 20:19):

Yes, sorry that is what I meant

view this post on Zulip Grahame Grieve (Dec 22 2016 at 20:22):

then you should use quantity in Observation.value, not an extension

view this post on Zulip Sadiq Saleh (Dec 22 2016 at 20:26):

I should clarify, as I did not earlier. I am trying to create a profile to extend Observation, so there should not be additional work for people not using my profile.

As far as I understood, using quantity requires both a value and a unit, which does not apply to counts which do not have units.

view this post on Zulip Grahame Grieve (Dec 22 2016 at 20:28):

unit is not required, but the UCUM unit for count = 1

view this post on Zulip Grahame Grieve (Dec 22 2016 at 20:28):

so counts do have a unit

view this post on Zulip Grahame Grieve (Dec 22 2016 at 20:29):

and if you do it any other way than that, there'll be additional work for anyone not using your profile

view this post on Zulip Eric Haas (Dec 22 2016 at 20:33):

I prefer using the UCUM pseudounits '{count}' since this allows for better display. What we mean by an extension here is you could create valueInteger extension on observation, but that is lot of work when valueQuantity will do. And if you look here you will see the allowed types for value[x] and a link to a general discussion on the '[x]' elements. I would recommend reviewing that a bit.

view this post on Zulip Sadiq Saleh (Dec 22 2016 at 20:36):

Thanks for your input @Grahame Grieve and @Eric Haas
I had reviewed the link you attached Eric, but I had not understood that the types were fixed and that I could not add additional types.

view this post on Zulip Eric Haas (Dec 22 2016 at 20:39):

[x] types are enumerated in the definition. if they say '*' then any type is fair game. :-)

view this post on Zulip Sadiq Saleh (Dec 22 2016 at 20:46):

Thanks for taking the time to respond to my post.


Last updated: Apr 12 2022 at 19:14 UTC