Without the database, I can't run it so can't debug directly. Looking over it though, it doesn't seem as if it needs to be a shiny app - all you are doing is displaying images, text and plotly graphs, which can all be done in a static html document. You only need to use shiny when you have input widgets that are being used to allow a user to modify the plots. I'd suggest converting your scripts that produce the plotly graphs to functions and then just call them in the chunks, or just moving all your code into a single document.
I guess this goes beyond shiny at this point then, i figured i had to use shiny for rendering plotly documents because when i try without it like so,
# {r echo=FALSE, results='asis', fig.width=4, fig.height=4, warning=FALSE}
# similar behavior with just {r}
source("./r_scripts/review_count_sp_v_mp/a.r")
print(fig) # fig being a plotly figure that works with Shiny
it'll just print out the contents instead of actually rendering the plot