How does Octoprint's code reads the Gcode files?

Hi guys! hope y'all are doing great. I forked Octoprint's gitHub repository to setup it on my own local desktop. It is all done, and I am serving the application as well and It is working great.
However, my concerns started when I tried to read and understand the codebase. I am not sure, what the code flow is like, and majorly I want to understand that how does Octoprint reads a gcode file after it has received it. What is the function that implements the logic of this algorithm, and then further what logic is used to send those extracted commands to the printer through serial connection? Like, does it reads the whole file first, then extract single-single commands and then send it one-by-one to the printer?
If someone could draw out a flow diagram with the actual function names, It would be a bliss for developers.
Thank You!

It analyzes the whole file and uses that for stuff like print time estimates - but when it comes to printing/sending the file to the printer it's read and send line by line.
There's nothing special with that part of the code.
The magic happens in the flow control part and where the behavior for different firmware variants is specified.

The maintainer unfortunately got no time to draw you something, but maybe someone else will do it for you.

You can find everything you need in here: