I wonder if it is or would be possible to lookup a tag in record instead of using hard coded tag names? To be able to write a function like
customFilter = (tables=<-, tagName, ...) =>
tables
|> filter(fn: (r) => if exists r[tagName] then contains(value: r[tagName], set: ...) ...