clerk

2023-10-07T09:07:53.884659Z

Hi, all! Just starting to use Clerk and I’m running into whats likely a newbie thing. My environment works like it should (afaik), and, for example, this runs with the expected output:

(-> "data/small.tsv" ;; name of the file
    slurp              ;; read the contents of the file
    csv/read-csv       ;; parse the result as csv data
    clerk/use-headers  ;; tell Clerk to use the first row as headers
    clerk/table)       ;; render the data as a table

2023-10-07T09:09:07.621369Z

But, I’m trying vega lite - and the tutorial example works fine, but, as soon as I change to a local file:

:data {:url "data/small.tsv"}
I get this:

mkvlr 2023-10-07T10:13:01.308039Z

clerk doesn’t serve static files from your working dir. Is your "data/small.tsv" in your current working directory or on the classpath?

mkvlr 2023-10-07T10:13:53.562989Z

if it’s in your working dir, you can prepend "_fs/data/small.tsv" and clerk should serve it

mkvlr 2023-10-07T10:14:05.555369Z

if not, you can always read the file in clojure on the JVM

mkvlr 2023-10-07T10:16:05.042369Z

(clerk/vl {:data {:values (-> "data/small.tsv" slurp csv/read-csv)}})

2023-10-07T10:32:05.273819Z

Thanks! Easy… when you know it. 🤩 ✌️

2023-10-07T11:35:41.511059Z

Definitely something we could make more clear in the docs 🙂

2023-10-07T11:38:32.395589Z

It’s almost obvious when thinking about it 😉 But, easy not to as the Vega docs talk about local relative file paths and you need to sorta know what Clerk is and what is the backend vs the frontend and what is done where and all that. (So much for abstracting away HTTP and all the rest…).

2023-10-07T15:10:16.221359Z

Are there rules of thumb for what amounts of data Clerk is suitable for? I’m trying to bounce around a 186 Mb file with 1.7 million rows… suboptimal? Or doable with care?

mkvlr 2023-10-07T15:19:39.154779Z

plotting 1.7 million rows with vega is probably not ideal

mkvlr 2023-10-07T15:20:05.021359Z

can you cluster on the JVM first?

mkvlr 2023-10-07T15:20:20.539879Z

clerk should be able to handle sizes like that

2023-10-07T15:20:59.110189Z

Cool, thanks. Yeah, I figured parsing and sending to the browser isn’t ideal. 🙂

2023-10-07T09:10:08.803439Z

If I switch the :url above to an https url, it works again. The file can be found just fine as the top example gives me a nice table output.

2023-10-07T09:11:25.374779Z

Any pointers appreciated 🙂