In my professional life I’m a web developer. Occasionally those skills come in handy for hobby stuff (like this blog, The Conrail Photo Archive or TrainCrew). That entire world is in a state of change due to the power of Generative AI. I wanted to get some hands on experience with a new technology and using GenAI to build something so I decided to build an online Train Dispatcher application.
Let me start with the problem statement: I wanted an application that could help a dispatcher manage verbal track authority for a segment of a railroad. This came out of my work in setting up a “pop up T-TRAK ops session” but I realized it’s applicable for a wide range of situations. I’m a Conrail guy so I wanted to generally follow NORAC practices. That means that the actual clearances would be called “Form D’s” but I also haven’t gone overboard in making them completely faithful to prototype practices (although maybe in the future I will).
I’ve been wanting to learn Next.JS for a while now. It’s an amazing technology that I have actually written about professionally, but have never actually gotten my hands dirty with. I’ve tried a number of tutorials on getting started but I wasn’t having much luck. I do much better when I learn from examples, but all of the examples were really too simplistic to be useful in understanding how to use it in the real world. That’s where the second new technology came in: Vercel’s v0.dev. Vercel is the company behind Next and has created this tool to make it easy for developers to actually use it (and other technologies as well).
I started by going to v0 and giving it instructions:
lets make an application that allows a train dispatcher to keep track of the clearances they have issued to train crews to use segments of the line and prevent them from issuing clearances that conflict. we want to present the dispatcher a schematic of the railroad that uses data stored in a google spreadsheet to define the physical characteristics of the railroad (control points, track schematics, etc…) and to store the track clearances themselves
It thought for eight seconds and started writing code.
Things were very rough looking, but it was something.
I’ve since spent the past few days “conversing” with the tool as it’s built our more functionality and visually styled it.
It hasn’t always been perfect and it sometimes makes mistakes, but it can even fix itself when it doesn’t work right.
The idea here was that I’d learn Next.JS myself. While v0 did almost all of the coding and problem solving for me, it’s also given me concrete examples to actually learn from allowing me to do a little of my own development right inside the development environment. Speaking of development environments, one of the many great features of the tool is that it all happens directly in a browser window, including deploying the developed code to a website. This means there’s no painful local setup, no downloading stuff to your computer, hell, you could even do the whole thing on an iPad!
So lets dig into what the app actually does.
First, it uses Google Spreadsheets to hold its data. This makes data entry a lot easier and also allows me to have my friends enter and use their own data for it. Spreadsheets to be used in it are shared with a special email address which gives the app access to them.
It shows a schematic of the railroad using data in the spreadsheet. This is a bit fiddly but works well enough. The schematic is created by defining “Control Points” and “Segments” between them. I gave v0 instructions to allow me to create connections like on sidings and the data for that is also in the sheet.
With the data in the spreadsheet the app creates the schematic of the railroad.
Below that you have a form to create a new clearance and a list of active ones.
The app will also prevent the dispatcher from issuing aclearance that conflicts with an existing one.
When a new Form D is created it pops up a window with the information to give the crew which lines up conveniently with some paper forms I designed in Adobe Indesign.
The dispatcher can see all of the available clearances and either annul or complete them.
Active clearances are also shown on the schematic, each being clickable to pull up its info.
Because the app uses Google Sheets for its data its easy to configure multiple railroads in it. I’ve been showing examples using my beloved Strasburg Rail Road, but I’ve also created a few other examples.
The app is far from a perfect recreation of the way this stuff works in the real world, but it is sophisticated enough to actually be used during an ops session. We did this the past weekend with my friend David Betz’s WM East Sub. I set up the schematic, loaded up the train data, and then he used it all afternoon keeping traffic moving over the road. This was truly remarkable for an app that was only an idea less than a week earlier.
Things looked quite a bit more hectic a little earlier. David’s layout isn’t incredibly complex, but the app was incredibly helpful in managing the traffic across it.
Over 20 clearances were issued over the course of the ops session and things moved quite smoothly. One of the exciting things is that I can easily continue to refine it to both improve ease of use, add functionality, and bring it even closer to prototype practices with a combination of hand coding things that I want to and prompting v0 to do the heavy lifting for me.