2026-04-15 15:12
Status: #baby
Tags: dominion, work, rust
Rust, rust, and more rust...
My coworker at the lawfirm brought me into a new ai initiative at the lawfirm, where we're seeking to build out an agentic ai platform called k2. A lot of the work has already been done on the primary chatbot product that the lawyers use internally called Kwery. Tra just brought me into one of the newer and really big initiatives with the lawyers for the Meta team, apparently they bring in about 13 percent of the firm's entire revenue! So this is a high visability project.
The way he explained it is, these lawyers will create patents, combing through their meeting trasnscripts with clients searching for information related to potential patents and then they will create documents for the patents and submit the required paperwork. This takes a lot of man hours, and as you can imagine, a alwyers time costs hundreds, sometimes thousands per hour. This new initiative that I'm working on is geared towards automating that.
The uspto website offers datasets on all of the trademark and patent information in their database, which after creating an account you can download for free. They also offer an API for a programatic way to fetch patent data. After making my account and securing an API key, I went to work. I started with two trademark datasets that are stored in XML files for a combined total of 400+ files. I'm going to take these xml files, create a SQL schema based upon the data fields of these XML files, and then write some code to fetch this data from the API, parse the xml files, and insert the data into out SQL Server db.
Since this is a project I get complete ownership over, I wanted to experiment with rust. I've heard that it's blazingly fast, and I've written basic rust scripts and purchased a book on rust, so this seemed like the perfect opportunity. I downloaded RustRover from JetBrains, installed cargo and the rust compiler on my laptop and went to work...
I used Google and Claude to research particular syntax and explain rust concepts to me, that's the best use of AI in my opinion as a programmer, is using it almost like Google 2.0. It's great at automating workflows within very specific parameters, but it goes off the reails so often, I find it often times easier to have it explain things to me and to write the code myself, it's a very fast research tool.
I setup the main.rs file to first send out a GET request to the uspto API, they have a search endpoint that allows you to search for particular products/datasets, but if you leave the search parameter empty it returns infomation about all of the available datasets. After storing the API key inside a .env file, and using the dotenvy cargo package, i loaded it in to main.rs. I also installed tokio and reqwest packages for async rust and making http requests, it was setup in no-time and I got a response back from the API!
I stayed up untill almost midnight working on this project, in total I extended the code to connect to our sql server database using tiberius, a rust create for authentication. By using the integrated authentication method, the firm I'm working for uses Azure Active Directory, so I was able to login automatically through my windows account on the laptop. My program had to hit 3 different enpoints in order to pull files down, the metadata/search endpoint, the product data endpoint, and finally the file endpoint. Since it was over 400 files to download, it moved through all the files in about 60-100 seconds but parsing them was another beast entirely,
References
Linked Citations