I was lucky to have a day entirely free, and decided to spend it on a project long at the back of my mind: Chronology of a Judgment.

I remember a period wondering why it was not possible to generate a draft chronological automatically from a Microsoft Word document. The computer just needs to:

  • go through the document
  • pause whenever there is a date
  • save the date and the sentence
  • create a table with a date column, a sentence column and a paragraph number column
  • put everything in chronological order

How hard can it be?

It seemed surreal to read about Big Data in the news, and to stressfully check and re-check a hand-drafted chronology at the same time.

Later I realised the major difficulty came from man-made hurdles. Microsoft Word is not open source, and it is neither easy nor profitable for anyone other than Microsoft to write macros to automate this.

So my attention turned towards judgments. There is not as much time saving (or immediate benefit) to read a chronology of a judgment. But at least it would be a change of perspective.

But there was another hurdle. The most popular free English law database, BAILII, has restrictive terms basically manipulation of data from it. I was told stories of people who got into hot water for using BILII data this way.

Fortunately, I recently came across the UK National Archive’s Find Case Law (Beta), which has a much more permissive Open Justice Licence.

After re-reading the licence, I looked at the Public API documentation, poked around with it on the browser, and made a simple landing page with create-next-app and v0.

I then wired it up with Supabase, got LLM to write a line to clean the URL, and made a UI that would save an XML document whenever the user makes a GET request to the public API.

The next steps are parse all the dates and to save all the sentences along with the dates they contain.

Here, LLMs made a critical difference. Earlier, it had merely saved me time and effort, by for example, writing this out:

  const cleanedUrl = url.split('?')[0]

But here, the Perplexity LLM went much further and provided code which imported and used two NPM packages:

  • xml2js for parsing XML
  • moment for parsing and manipulating dates.

These packages, and Perplexity’s draft code, did more or less what was expected right off the bat.

On my end, it was a simple matter of npm installing them, trying them out on a small scale, refactoring the original function to accept one or two more arguments, and then wiring everything up.

The use of LLM here saved me hours from having to manually research, compare, choose, learn and use different NPM packages.

After some more of trial and error, I completed a first draft of the App to share with friends.

One feature that has to wait for another day is to parse out the paragraph reference: different XML documents seem to treat this differently. Perhaps another 1 day project!