I track information about companies. For myself, for others that pay me, for fun. And I’m pretty good at it. But it still requires I spend time I wouldn’t need to if I had some kind of auto-updating vendor information system!
What do I mean by that? Well, vendor sheets rarely change, in my experience. Whenever I enter into a commercial transaction with a company, it’s information rarely changes. That’s great for me, since I keep text files on the vendors and copy and paste them into the docs of whichever project I’m working on.
Well, I’ve imagined something kinda neat, and we’ll be able to apply the lessons to more fun stuff that vendor data, but here we go, embracing some web tech and data communities, we’re gonna build our useful tool!
I even have part of it ready for demo, at Vendors.
Those are my initial vendors, with rather sparse data included.
The next part will be me implementing my site deployment method so my templates are available online, but here is the template that produces each of those articles in the list:
<article>
{{ $wikidataid := .Params.wikidataid -}}
{{- $wikidata := getJSON "https://www.wikidata.org/w/api.php?action=wbgetentities&ids=" $wikidataid "&languages=en&format=json" -}}
{{- $data := index $wikidata "entities" $wikidataid -}}
{{- $claim := index $wikidata "entities" $wikidataid "claims" -}}
<h2>{{ .Title }} {{ with index $data "descriptions" "en" "value" }}({{ . }}){{- end -}}</h2>
{{ with $claim.P856 -}}<p>Website: {{ index $claim "P856" 0 "mainsnak" "datavalue" "value" | markdownify }}</p>{{- end }}
{{ with $claim.P1581 -}}<p>Blog: {{ index $claim "P1581" 0 "mainsnak" "datavalue" "value" | markdownify }}</p>{{- end }}
{{ with $claim.P9138 -}}<p>Status website: {{ index $claim "P9138" 0 "mainsnak" "datavalue" "value" | markdownify }}</p>{{- end }}
</article>
Here’s what has happened so far:
- I make a list of vendors used on a single project
- I found all the vendors on wikidata.org
- Of the available data, I found some claims (website, blog, status website), and conditionally list them if present
My next steps are to learn the practices on Wikidata to add data. For instance, URLs are considered self-evident references, but I want to add other data to each vendor as well, which will require knowing how each claim is verified. Also, there are WikiProjects (Wikidata:WikiProjects - Wikidata), teams working on Wikidata, and there is Wikidata:WikiProject Companies - Wikidata, where I’ll start asking for mentoring in adding data.
The immediate next step is to add the three URLs (if available), to each of their Wikidata entries. When I’ve done that, those records will be updated on a subsequent site build (which I’ll probably do daily, but cache results for much longer, as I don’t expect Wikidata to change much after I’ve added a vendor and updated it, myself.
Anyhow, I hope you see the beginning of what I’m doing here. It’s pretty exciting.