Building my own tide tables with an AI coding partner


Posted in:

When you live near the coast, enjoy the beach and fish tidal rivers, knowing what the tide is doing at the river mouths is somewhat important when planning leisure time. Littlehampton sits at the mouth of the nearby River Arun and Shoreham at the mouth of the River Adur, with Worthing in between, so those three are the ones I keep an eye on.

Why put tide times on my own website? Mostly because I can and I find it more interesting than a Sudoku. The UK Hydrographic Office (UKHO) makes its ADMIRALTY tidal predictions available through a free API, and I wanted to see how much easier and quicker it would be to build something with an AI coding partner rather than on my own.

So today I sat down with Code Bot, one of my team of AI assistants, and we built a small WordPress plugin called Powerhut Tides. By mid-morning we had settled on and created our working environment and the first version was working: a shortcode that fetches a week of high and low water times for a single station and shows them as a simple table. By mid-afternoon we’d added a second version that shows up to three stations side by side on a wider screen, ordered by whichever has the next tide, stacking into one column on a phone.

There were a few rules to respect along the way. The free tier allows a set number of API calls a month and doesn’t allow the data to be stored, so the tables fetch fresh predictions each time the page loads, and every table carries the ADMIRALTY acknowledgement.

Working with an AI partner was a breeze. The code lives in a central repository on GitHub with version control, so both my own changes and the bot’s suggestions, once I’d approved them, were pushed and pulled in one place. The code itself is well structured, follows my own naming and namespacing conventions, and has useful comments throughout. Clear explanations where I needed them were a bonus.

You can see the end result on my Local Tide Tables page.