June 16, 2025
Still a work-in-progress, but I have broken up a lot of the big hard-to-understand functions into more manageable smaller functions, and split up functions with different purposes into different files to make future organization easier. I have now got my first INSERT statement (almost) working!!! I'm close to getting the first bits of real data into the database, and it's pretty exciting.
Been a while since I wrote a devlog, took ~2 weeks off to break over summer, and to work on some of my other projects. Since I last wrote: I fixed HTML decoding for alerts and messages to be compatible with encoded special characters, like . I also started writing the SQL for my database, and setting up a connection to PostgreSQL!
I think I'm ready to ship! I added a pride-coloured background behind the article view, and also made it get brighter in a circle around your cursor, for interactivity. Sadly, the cursor thing doesn't work on Internet Explorer, but everything else does! I also fixed an issue where the article view would extend beyond 100% of view space on mobile.
Since the last devlog, I went through all features of my website and got them fully working on IE11! I had to change a javascript for loop to use older syntax, and I got rid of the CSS variables. BUT it looks beautiful and behaves perfectly on every browser now!
Since the last devlog, I have added my face to the front page, and used a flexbox to put it side by side or above/below the introduction section.
Still need to test how this appears on IE.
Started logging the time that I spend on my website! So far, I have written an introductory paragraph, and summarized how I got started coding. I have also improved compatibility of the site with all browsers, by removing the use of flexbox styles - it renders perfectly even on Internet Explorer 11! I also set the font to default to the system-ui font of the OS that people are running to significantly reduce load times by not requiring a font download for the page to render.
My (IE11 compatible) personal homepage written from scratch in HTML. It looks good in light or dark mode, on mobile or desktop, and even when printed. Written without the use of AI.
I've done it! All possible Darwin messages can now be fully decoded into structures, with all correct defaults set, and it's all fully tested too!
I'll probably rest for now, but next TODO is to interpret all of the data into useful values (eg convert the string 12:02:30 into a time+date value - more difficult than you think when trains cross midnight boundaries!)
Since my last devlog, I have finished fully decoding all possible Darwin messages into go structs, and have added test cases for most unmarshal functions.
Since the last devlog, I have added in string descriptions of almost every activity, and fully enumerated and string-ed train types too. I also wrote out all of the structures for train formation data, train association data, and train forecast data.
Phew!
I think I'm about half way to getting every possible message unmarsalled into usable structs. Once I'm done with this bit, I can start interpreting the data somewhat, just to get everything into a database.
I started using a program called XMLSpy to graphically draw out the XML definitions into a printable graph, and it works amazing! I only get a 30 day free trial though. Attached is a picture of what a printed out XMLSpy tree looks like, for just the train forecast data.
This isn't tracked by hackatime, but I spent quite a few hours on a banner design for the project. I attached the PNG version to this log (real one is SVG).
Turns out that the document that lists all activity codes etc. v29 from 2014, is actually still the latest version! This is both disappointing and exciting - disappointing because there is no better documentation than the existing stuff, and exciting because I can just use v29 without having to worry about waiting for a reply to my email.
This does unfortunately mean I have probably sent an email that has already been sent thousands of times before by hundreds of others since 2014, and will get no answer. Oh well!
https://groups.google.com/g/openraildata-talk/c/J7L2rnvpMhc/m/06H_nACeAgAJ
Since my last devlog, I have separated out the unmarshalling code even more, added every possible activity code in an enum, and started re-marshalling data back into XML too, so it can be compared to the original!
I have spent a LONG time reading through as much train/rail documentation I can find about Darwin and TRUST, from Network Rail and National Rail. Attached is one of the documents I have read through, but I have read a lot of others, quite a lot of data is hidden in the XML specification! Currently waiting on response from Network Rail via email to get the latest copy of the document that lists every Activity Code, Status, and others. This API takes a LOT more time reading docs to figure out than writing code to make it work.
My goal for finishing the API component of my app that decodes the train data is to have code that can be read and understood even with minimal knowledge of the internals of the UK's train system, because all of the useful API information is very spread out across many many sources, so hopefully my repo can be a complete code example for using and interpreting train data.
Most recently, I have fully fleshed out the ScheduleInformation type to include all possible train schedule location types, decoding into a generic type for all locations, then specializing based on the name of the XML element.
I have setup default values for the ScheduleInformation structure by implementing a custom XML parsing function that fills in defaults automatically. I have also started parsing locations from the schedule.
TODO is to have separate types for every location type.
I have switched from using the JSON feed to using the XML feed, as the XML is the original format, and is better documented. I have also spent lots of time researching all of the different elements of the train data, so I can provide comments for documentation! So far, I have schedule data as a structure, but TODO is all of the other possible update types.
First update about 'Rail Regard'! (working title)
So far I have:
- Gotten (free) access to National Rail's Darwin data stream from raildata.org.uk
- Read and annotated the entirety of the Darwin Interface Specification to understand the crazy amount of data available.
- Written the start of my API, a Go program that (so far) subscribes to the API, and asynchronously unmarshales some of it into usable structures!
A UK train app that shows as much detail as possible about the train you are taking.
This was widely regarded as a great move by everyone.