Fetching Latest and Earliest Obs in HFE

According to this commit to implement this functionality there seems to have been an interchange in what the two functions do thus a tag like

<lookup expression="fn.latestObs('CIEL:5089').valueNumeric"/>

returns the earliest obs and

<lookup expression= "fn.earliestObs('CIEL:5089').valueNumeric"/>

returns the latestObs

Proposed fix might be to interchange this line of code with this line of code @mogoodrich @mksd could weigh in on this.

Related to How Fetch a Value Using Velocity and assign it to an Obs Field

1 Like

Thanks @reagan for reporting this. However IMO, the best way to handle this would have been by first of all producing a failing unit test for the above bug.

4 Likes

Thanks @reagan… it looks like the methods depend on the order obs are returned by the .getObservationsByPersonAndConcept method… did the order those obs get returned change at some point?

@ball have you noticed a problem with these methods before?

Take care, Mark

Thanks @samuel34 for this…I have tried scrutinizing the tests for the functionality and they are passing.

Thanks @mogoodrich I have examined how the sorting is being done in the criteria and now the two methods u implemented make sense

However when I was using the tag for example in this commit I noticed the reality was different. Perhaps I missed something that someone could pick up.

It’s entirely possible that the functionality is broken @reagan, I was just a little surprised because I figured it would have been noticed before since those tags have been around for a long time.

I will try to take some time in the next couple of days to test it on my own.

Thanks! Mark

2 Likes