Rewrote user_complete_history to use CSV module instead of streaming, although I suspect that the error is instead because of application context