Anthropic’s Claude teaches me CsvPath
The other day I quipped that implementing my description of how to productionize CsvPath was an exercise for the reader and Claude. Then I thought about it. What would Claude suggest?
I also had a conversation with a friend who has an interest in converting business rules to data quality rules. He is building a product that can do that — and that is a hard challenge!
I wondered if Claude could help take that challenge on. And then I remembered an experiment in teaching Claude to identify header lines in public-source hospital procedures data, with mixed success. Could giving him a simple, structured language like CsvPath help make the task easier?
Net-net, I realized that spending a few hours with Claude might be time well spent. In the end, it took just a few click-and-paste minutes. As you will see.
The task I set was to translate me. Claude would convert my description of business rules. The result would be an automated way to validate a regularly delivered CSV file of orders.
I already knew Claude could read a formal language description just fine. So I started there. (I know this because as well as being smarter than me Claude is smarter than all of Stack Overflow — I’ll take help where I can find it).
CsvPath’s grammar is pretty small, as these things go. And it is very focused on CSV validation, of course. So Claude had some advantages. Including literal Gigawatts of connectome-power. Still, it was shocking to see how quickly Claude picked up CsvPath, and how well!
The eager beaver gave me a 5-step program for how we were going to implement the Claude-does-CsvPath scheme.
I love this guy. :)
Jumping right in after Claude, I pasted in the grammar and the top page of the functions docs. (The top page sits on top of about 58 more pages describing over 100 functions, so I didn’t think I was giving much help).
The next step was to give Claude an example. That was an easy call. www.csvpath.org has an example that gives six csvpaths in a single file. A nice neat package for Claude to get a sense of how things work. Claude apparently loved it. Cue Little Mikey and the Wheaties box.
His summary was bang-on. I had to double check to make sure he wasn’t just reading the comments. He wasn’t! Think of it. What else could we have Claude do? Perhaps blogging? (You’ll never know…)
Now it was time for the main event. Could Claude write some CsvPath? I thought I probably knew the answer by this time. But the anticipation was still killing me. Then I realized I didn’t actually have an example in mind.
I quickly turned to some messy Boston City data drops. I’d used them in other examples. But the files were a bit big to drop on Claude. I don’t pay Anthropic enough for that.
So… I ad-libbed.
Now, each of our interactions as people takes time. And writing about a conversation takes even more time. I know everyone in the World has chatted with ChatGPT or Claude or their fellow travelers at this point. But it is still worth pointing out how mind-blowing it was to see years of learning, pondering, and tinkering with validation schemes snapped into sharp focus in milliseconds by a machine. And one so friendly. I love Claude. :)
So then, here’s what Claude came up with.
Is it working CsvPath? To my eye, yes, it would run. The business rules aren’t perfect. But that’s normal. Understanding business rules is a conversation — this was a one-and-done ask of an AI. I’d have to create a data file to test it. And I may yet. But the point of the exercise was resoundingly proven: Claude is smarter than me! :)
Nevertheless, if you want to talk about how you (and Claude?) could use CsvPath, please don’t hesitate to reach out.