We have had a obsterm problem for several years where we have used two obsterms for the same value/observation. I was wondering if there is a way to take two obsterms and have a handout show whichever is newest. E.g. we have one lab that sends us LDL as "LDL" and the other "LDL (CALCUL)" but they represent the same value. When a patient is sent to the different labs it messes up the letters and handouts. We are fixing this going forward but I need a solution to fix the last several years of data which just affects our handouts and letters.
Thank you,
Richard
I just read somewhere else on the board a similar issue.
In that case, they had switched from an old obsterm to using a new obsterm.
Similar to your situation if you decided (for example)
to settle on just using "LDL" moving forward instead of using both "LDL" and "LDL (CALCUL)".
The code below will assign OBSNOW("LDL") to whichever has the most recent date – either LASTOBSVALUE("LDL") or LASTOBSVALUE("LDL (CALCUL)")
// Assign most recent LASTOBSVALUE obs1 or obs2 into OBSNOW obs1
if DURATIONDAYS(LASTOBSDATE("LDL (CALCUL)"), LASTOBSDATE("LDL")) > 0 then
OBSNOW("LDL", LASTOBSVALUE("LDL"), LASTOBSDATE("LDL"))
else
OBSNOW("LDL", LASTOBSVALUE("LDL (CALCUL)"), LASTOBSDATE("LDL (CALCUL)"))
endif
So you could create this as a function, modify it however you need (maybe to just return the most recent obsvalue), then use that function throughout your handouts / letters as needed.
Hope this helps !