My next hobby project – dare I say called it a “vibe project”? – will be a tool to help me split color-assorted piles of LEGO parts into their constituting sets. Before I get started there are some philosophical considerations to make.
First lets look at the problem. I bought 2 used LEGO collections in the past and enjoyed the detective process of finding out which sets these parts came from. I developed a strategy to first wash the parts and then split them by color. From stickers, minifigures or unique parts you are able to make a list of sets. I created a list for each such collection on BrickEconomy, because this also gives me a current value of the collection. Granted it’s for new and sealed sets, but typically the used and complete value would be something like half of that.
The first collection is purchased had 31 sets, the second one was supposed just to be a Friends Hotel, but still contained 7 other sets. Now this latest one I counted 76 sets. For the last one I also got a big stack of original instructions which made the identification process much quicker. Certainly there are also a few more hidden sets that I would only discover later on.
After washing and color-splitting the most time-consuming set is to get a list of parts for each set from BrickLink and pick the constituent parts in the right amounts from the color piles. The problem here is that some colors have huge amounts of parts, in particular white, black and the grays. So you see that you might need 4 of a certain part and you have to go dig around for those.
If you cannot find all you should make a note somewhere to order the missing part on BrickLink. Or maybe you’ll stumble accross them as the piles got smaller. It’s a very tedious and time consuming process.
One thing that already showed great promise is the BrickScan app which you can point at individual parts or whole mini figures and it would find them in their database. That would then tell you which sets this part occurred in. If it is a unique part (like a minifigure or a stickered/printed part) you would find the exact set this is supposed to be from. Without a subscription BrickScan limits you to a couple of scans per day, so I sprang for the subscription as soon as I had verified that it is fulfilling its promise admirably.
I have a separate box of stickered/printed parts and minifigures and I could go through them one by one and then always drop them into the zip lock bags for the sets they belong to. The challenge here though is this: I’d have to put up 76 bags next to each other – maybe sorted by LEGO set number – and then for every scanned part I have to go the the right back for it.
And this is only a small part of the overall problem. What do I do with generic parts that have dozens of sets they might be from?
There should be an app for that
So I’ve been thinking if I couldn’t build an app for myself to help me with this. So here’s my thoughts on what I need:
I would want an iPad App, where I can add a number of lists of sets. Then for each set I would get the list of parts from BrickLink. The number of parts I have already in the set’s bag I would count and store.
In a way this is the reverse of the wanted list feature available in BrickLink. There you can make lists of parts for specific color and then in the notes I would write for which set I would need them. In the past I would then order missing parts and once I received the order I would go to the wanted list and find my comment to know which set’s bag I should drop it into. A workable but long winded process to be sure.
Instead I imagine being able to say pick out all 2×4 plates from the white pile. Then I would enter their BrickLink ID plus color into my app and I would get a list of sets where those are missing and how many. And since I don’t have a part scanner to put into my app – boy that would be handy – I’d have to use BrickScan for that.
So with the basic premise for this app described the next question now is how would I make it? Build it in the open – like an exhibitionist. Or build it in private for only myself. Of course I could start in private and if somebody else is interested in it then share it. Or could it even be on the app store?
It would be lovely to find some friends with similar interests (LEGO, Swift, SwiftUI, AI) and then geek out with them together. But then again, I might be the only one so crazy as to want to devote some screen time to building such an app. And since probably nobody will care for what I am proposing here anyway, I should maybe just try to make myself happy. What do you think?
Getting the Parts
There are potentially multiple ways how I can get the list of parts for a set, here’s the list of parts of the LEGO Titanic for example – in printing mode – from BrickLink. The problem is that BrickLink itself only has an API for sellers. Alternative option Rebrickable has an API but it is only for hobbyists and has some rate limiting. Also it seems to use different IDs for parts than BrickLink I see as hindrance down the road.
This brings me to the scraping approach. For AgentCorp I put together a way to parse the HTML DOM of a web page and convert it into markdown. I made a few minor adjustments and now the above parts list from BrickLink converts into a markdown file which I could easily store into a SwiftData DB.
The problem here is that AgentCorp is presently not open source because there are quite a few things in there that I don’t want to “give away for free” so easily. So I cannot have it as dependency in an open source project.
I could extract the scraping code into an open source component and then reference that instead. Or just plain copy the code into the open source project. But such code duplication makes me cringe. But the path of least resistance would be to first just vibe code an MVP.
Make it exist first. Make it nice later.
Call to Action
Normally I would have written “Conclusion” here, but we haven’t even started yet. What do you think? Or feel about such a project? Would it be interesting to witness its progress? Would you have a use case for that as well?
I think I’ll just go ahead with a public SwiftLEGO project on GitHub and see where this leads me.
Categories: Fun