LF ideas - Buffs before the pull

Often, when someone uses a buff that increases your stats before the pull, then the log will display those buffed stats on your page summary page
eg. https://www.warcraftlogs.com/reports/2ZQmNc7aPdgb8nz3#fight=7&type=summary&view=analytical&source=2
I tried to check whether the buff expired before it was applied, but apparently it doesn’t always happen:

Does anyone have any ideas how to work around?

btw, I’m using api to do some queries and need the haste. Just looking for a way to detect whether the summary screen has been corrupted by these buffs and try to fix it.