So I know that the Samurai towards the end of their time no longer really fought in duels and instead became bureaucrats but when exactly did that happen?
Technically the samurai have been bureaucrats since ever. There was no divide between bureaucrats and soldiers outside of the Kyōto court. Samurai were warrior-aristocratic families. The same person overseeing tax collection and construction one month could be on the battlefield killing people next month.
But that's not what you want to know. I would say after unification of Japan in 1590 by Toyotomi Hideyoshi, samurai started transitioning to more peace-time administration and culminated in 1615 with the destruction of the Toyotomi clan at Osaka, the publication of the Law code for Warrior Families, and the order of one castle per domain all in the same year. Afterwards there were no major wars to fight and no clan had even the slightest possibility of challenging the Bakufu. It will continue to be like this until the mid 19th century.