Forgot to put the JSON data: "radarStation":"lot","dayPrecipitation":[{"time":1368129600,"probability":0.23,"type":"rain","temp":74,"cloudCover":1,"relHumidity":0.45},......
On Thursday, May 9, 2013 4:10:44 PM UTC-5, Hawkeye02 wrote: > > Thanks Greg for the suggestion. I have added the book to my Safari > account. > > Michael, I tried your suggestion with 'get-in' and it came back with > [object Object] from JSON. I switched the clojure.contrib stuff with > data.json. > > Below is the updated code and a screenshot of the result. Thanks in > advance for any guidance. > > *(ns brainiac.plugins.dark-sky* > * (:require [brainiac.plugin :as brainiac]* > * [clojure.data.json :as json]* > * [clojure.java.io :as io :only (reader)]* > * [clojure.core :as core]))* > * > * > * > * > *(defn format-forecast [forecast]* > * {* > * :temp (:currentTemp forecast)* > * :current-summary (:currentSummary forecast)* > * :hour-summary (core/get-in :dayPrecipitation [:temp] forecast)* > * :minutes-until-change (:minutesUntilChange forecast)* > * })* > * > * > *(defn transform [stream]* > * (let [json (json/read-json (io/reader stream))]* > * (assoc {}* > * :name "dark-sky"* > * :title "Right now, outside..."* > * :data (format-forecast json))))* > * > * > *(defn url [api-key lat lon]* > * (format "https://api.darkskyapp.com/v1/forecast/%s/%s,%s" api-key lat > lon))* > * > * > *(defn configure [{:keys [api-key lat lon program-name]}]* > * (brainiac/simple-http-plugin* > * {:url (url api-key lat lon)}* > * transform program-name))* > * > * > > > <https://lh4.googleusercontent.com/-xkFjz3rOPho/UYwQvBI_oAI/AAAAAAAAFbk/LY-Z19EdDTo/s1600/Screen+Shot+2013-05-09+at+4.09.22+PM.png> > * > * > > On Tuesday, May 7, 2013 8:10:02 PM UTC-5, greg r wrote: >> >> You might want to check out "Clojure Data Analysis Handbook" by Eric >> Rochester. There is an example using org.clojure/data.json and Incanter to >> read JSON format into an Incanter dataset. You might find other recipes in >> the book useful as well: >> >> http://www.packtpub.com/clojure-data-analysis-cookbook/book >> >> I'm going through it (slowly) and learning a lot. It's not a beginner's >> book. Full blast functional programming for sure. >> >> Regards, >> Greg >> >> -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.