FHIR Chat · Min, max, mean · implementers

Stream: implementers

Topic: Min, max, mean


view this post on Zulip Dan C (Dec 09 2021 at 16:36):

I'm pretty new to the HL7 standard. Is there any way to add min, max, mean, average etc. stats to an observation, in a case where the data set is collected over time?

view this post on Zulip Lloyd McKenzie (Dec 09 2021 at 16:39):

You can certainly capture those as their own observations. They typically wouldn't be on the same Observation instance as one that captures a point-in-time value.

view this post on Zulip Daniel Venton (Dec 09 2021 at 16:51):

In a database you don't generally store these aggregate values. You calculate them at need upon the set of data you care about. When you start storing the values then you are also storing the set (indirectly). Say you store your avg weight for the year. Tomorrow you store another weight measurement. Do you update the avg observation or store another one? Avg as of today, Avg as of tomorrow. It's probably better to just calculate on the fly "What is the avg using set of jan-1 to today" "What is the avg using the set of jan-1 to tomorrow"
What if you calculate and store the avg based on your set and tomorrow you notice that Jul1 measure had a typo, 171 instead or 117. If you update that, it invalidates the avg observation.

view this post on Zulip Dan C (Dec 09 2021 at 16:56):

Ah gotcha, makes sense then. So the FHIR data is more meant as a long term data storage as opposed to something that changes day to day?

view this post on Zulip Daniel Venton (Dec 09 2021 at 17:09):

Generally, resources once finalized don't change. New resources can be added at any moment. It's data storage (model) and interface. If you want functions built on that data, you fetch the data and do your calculations on the data as it exists at that moment. Tomorrow, if you want new calculations, fetch the current (as of tomorrow) data again.

view this post on Zulip Dan C (Dec 09 2021 at 17:20):

Ah makes sense now. Thank you so much for the help!

view this post on Zulip Dan C (Dec 09 2021 at 17:21):

It's really weird because the person I'm doing intern work for has like a totally wrong picture of what HL7 is supposed to be used for. Glad I have this chat group to keep coming back and asking questions :)

view this post on Zulip Lloyd McKenzie (Dec 09 2021 at 17:40):

There's a $stats operation on Observation that can determine the current statistics for a particular subset of Observations.


Last updated: Apr 12 2022 at 19:14 UTC