Fork me on GitHub
#clerk
<
2023-10-07
>
Mattias09:10:53

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

Mattias09:10:07

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:

mkvlr10:10:01

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

mkvlr10:10:53

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

mkvlr10:10:05

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

mkvlr10:10:05

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

Mattias10:10:05

Thanks! Easy… when you know it. :star-struck: ✌️

jackrusher11:10:41

Definitely something we could make more clear in the docs 🙂

Mattias11:10:32

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…).

Mattias15:10:16

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?

mkvlr15:10:39

plotting 1.7 million rows with vega is probably not ideal

mkvlr15:10:05

can you cluster on the JVM first?

mkvlr15:10:20

clerk should be able to handle sizes like that

Mattias15:10:59

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

Mattias09:10:08

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.

Mattias09:10:25

Any pointers appreciated 🙂