Creating a basic Personal Inventory Management System using Obsidian, Templater and DataView
This article will cover how to create a basic Personal Inventory Management Systems (PIMS) inside Obsidian. The intended audience is someone who knows how to use Obsidian and is comfortable installing community plugins. Some experience with Dataview is a plus but I will seek to explain how the queries work to achieve the desired result. The net effect of this is you’ll land up with the ability to create custom gear lists based upon items you own. An example is my Photography Gearlist below which tracks the purchase price, the age and the weight of each of the various items I own. This list automatically populates whenever I create individual files in this case.
Why Would I Do This?
One of my personal use cases is the need to keep track of different items and tools. I’ve looked into commercial solutions in the past (Why is everything a SaaS product that costs $100/year??) as well as rigging up convoluted sets of spreadsheets and the like in both Google Sheets and Excel. Nothing ever really seemed to fit for me in this case and they always felt disjointed in this case.
I also like the ability to take different notes about an item in a free-flowing method. In this form I can simply add those notes to the file for each item without how to stress exactly about adding additional columns like I would in a spreadsheet.
Keeping track of different items is great for determining when you need to upgrade them or, if they break, whether you should replace them with the same item and whether it was good value for money. I find this to be a really powerful method.
Finally, since I tend to actually document my projects inside Obsidian anyway having individual items of gear lets me quickly drop a reference to them in the project description or the build steps. This then creates a backlink that I can then review from inside the item itself to see what projects I’ve used it on.
Basic Obsidian Setup
I love using Obsidian, it’s probably one of the single most useful and personal pieces of software that I’ve ever used. It starts off incredibly minimalistic but over time it will grow with you towards whatever workflow you can dream up. It doesn’t try to force you down a particular pathway at all and represents one of the tools with the capability to really grow with you.
Where Obsidian really shines is in the use of three linked systems and plugins.
- Obsidian Properties - These were introduced in Obsidian 1.4 and represent a nice interface over a YAML block at the top of every document. Whilst I initially didn’t like properties they’ve come to grow on me over time.
- The Templater Plugin - This is a more powerful version of the inbuilt version of Obsidian Templates which lets you do a lot of great things
- The Dataview Plugin - If you’ve never used this before you’re in for a treat, the best way I can describe it is SQL + JS over your plain text notes like a relational database
If you haven’t already, you’ll need to install these two plugins in order to get the desired result
Setting up the Gear Template
The heart of this system is the template that I use for each individual item. This one is incredibly simple, all it does it create a set of empty properties about the item that I may be interested in keeping track of. If there are other properties about an item you want to track, simply change the template to add these in. If you’re not interested in tracking a particular property. Delete it. Nothing in Obsidian forces you to use it this way.
The only field which is a little bit special is the gear-image property in this case. This represents an internal Obsidian link to a locally stored image within your vault. This is very important, it won’t work for images that Obsidian doesn’t know about and nor will it work for external URLs in this case.
File and Tag Structure
I place every “gear” item into a single folder which I call Database/Gear
, this is just where I’ve chosen to store things. You can put things in your own location, you’ll just need to change the query accordingly.
The second component here is the introduction of the #Gearlist
tag. This is the meta catchall tag which specifies that you want to include it in Gearlists (if you choose to write a catch all Dataview query). I typically create subtags of this tag such as #Gearlist/Photography
or #Gearlist/Hiking
in this case which I can then call directly in the Dataview query
Writing the Dataview Query
Once you’ve started to populate out Obsidian with some items you’ll want a single place in order to draw these all together. I call these “Gearlists” because, well, for me they’re about organising gear but I’m sure you can modify this accordingly.
The query is as follows:
TABLE
embed(link(gear-image, "200")) AS Image,
purchase-date as "Purchase Date",
purchase-cost as "Cost",
durationformat(date(today) - date(purchase-date), "y ' Years' M ' Months'") as "Age",
item-weight as "Weight (g)",
purchased-from as "Purchased From",
item-url as "URL"
FROM "97 Database/Gear" AND #Gearlist/Photography
SORT purchase-date DESC
A brief explainer on some of what is happening here line by line if things are a little bit unclear.
TABLE
- Tells Dataview that we want to use the Table format here, not aLIST
embed(link(gear-image, "200")) As Image
- This line is uses to generate the small placeholder image in the table. It works by getting thegear-image
property from the template and then embeding the link in the table. I modified the code from the s-blu example Dataview Vault to get this working, it’s a great resource to check out if you’re new to dataview.durationformat(date(today) - date(purchase-date), "y ' Years' M ' Months'") as "Age"
- This is a small little bit of Dataview logic which compares current date to the purchase date property and then neatly formats the age as a string. There are two parts to this query, the date comparison ofdate(today) - date(purchase-date)
and then the formatting of the duration that results from this using thedurationformat
function in DataviewFROM "97 Database/Gear" AND #Gearlist/Photography
- The double lookup here, a file needs to match both these conditions. I use theDatabase/Gear
filter to prevent Dataview from needing to look over every file to see if it has the#Gearlist/Photography
tag included. My understanding is that this helps performanceSORT purchase-date DESC
- Sorts by the most recent purchased item, this is just personal preference, you can modify it accordingly.
As you can hopefully see you can modify this however you would like in this case. If there are other fields you’re interested in just add them to the template and then add them to the query. Likewise, if you don’t like my fields then remove them. Easy.
Conclusion
Obsidian is one of the most powerful tools I’ve used, using just simple plain text notes and some plugins I’ve been able to customise the application to my own purposes saving me money and time, a killer combination. I can’t recommend it enough.