This raised a question during the #coffee-break call:
When editing an observation, should we re-calculate the reference range?
Currently, we copy over the original reference range. However, what if the patient criteria used to determine that range have changed since the observation was first created?
For example:
A patient’s date of birth was initially recorded incorrectly.
An observation is recorded, and the reference range is calculated based on the incorrect age.
The date of birth is later corrected.
The observation is edited.
In this case, the reference range would still reflect the incorrect age from the time of creation (*granted its possibly highly unlikely that this would happen in the first place)
So the question is:
Should the reference range be recalculated based on the patient’s updated data when editing an observation, or should it always preserve the reference range as it was at the time of original entry?
In addition to calculating the reference range, we use the reference range to calculate the interpretation, and the interpretation definitely needs to be recalculated.
It’s likely that we should recalculate the reference range since criteria might changed based on facts about the observation itself that have changed in the edit.
However, as a practical matter, the current setup doesn’t support the concept of “age at effective date of obs”, which means that re-calculating the reference range when the patient’s birthday is changed could result in applying the completely incorrect reference range.
Until 3 is fixed, we probably should just copy the existing reference range but ensure that the interpretation is always re-done.
There’s a problematic twist to the above, though, which is that we also want to preferentially support manually provided interpretations, since these presumably could originate with, e.g., a piece of lab equipment itself, so we’d only want to re-calculate the interpretation if we calculated it originally, but there’s currently no record of this fact.