Advice for dealing with CSV data set

100 views
Skip to first unread message

Kyle Sexton

unread,
Jan 5, 2014, 11:39:55 PM1/5/14
to clo...@googlegroups.com
I am new to clojure and working on a small jabber bot as a starter
project. One of the things I am adding is a simple weather lookup, but
in doing so I need to convert zip code to lat/long. I've found a
suitable CSV from http://www.boutell.com/zipcodes/ and am wondering the
best way to deal with the data. I'd like to keep it "contained" in an
uberjar and not have to add a database as a requirement. I've
considered sqlite, but again not sure if it can be inside the uberjar.

The data set is rather small:

,----
| bash-3.2$ ls -larh zipcode.csv
| -rw-r--r--@ 1 kes staff 2.4M Aug 6 2004 zipcode.csv
| bash-3.2$ wc -l zipcode.csv
| 43205 zipcode.csv
| bash-3.2$
`----

What would be the recommended way for dealing with this data?

--
Kyle Sexton

Shantanu Kumar

unread,
Jan 6, 2014, 2:20:52 AM1/6/14
to clo...@googlegroups.com
If you are only going to read the CSV files, you can put the CSV file in `resources` directory (so that it is part of the jar/uberjar), and use https://github.com/clojure/data.csv with http://clojuredocs.org/clojure_core/clojure.java.io/resource to read the data. If you need to make some change to the CSV file then it must lie outside of the JAR.

Shantanu
Reply all
Reply to author
Forward
0 new messages