Suppose $f(x,y)$ is a rational function. Typically the solution curves of the differential equation $$ \frac{dy}{dx}=f(x,y) $$ are not algebraic (for example, if $f(x,y)=y$, the solutions are the non-algebraic curves $y=ce^x$). There are certain $f$, however, for which all solutions are algebraic (for example, if $f$ is a rational function in just $x$, having $0$ residue at every pole).
Given $f$, is there a way to check whether all the solutions to $\frac{dy}{dx}=f(x,y)$ are algebraic?