Skip to content

Commit

Permalink
inlined map of query params
Browse files Browse the repository at this point in the history
  • Loading branch information
bhlieberman committed Aug 22, 2023
1 parent 152adac commit 5bf14cd
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/com/slothrop/clj_baseball/statcast/batter.clj
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
(ns com.slothrop.clj-baseball.statcast.batter
{:doc "Contains the implementation for the Statcast query endpoint."}
(:require [clojure.java.io :as io]
[clojure.string :as string]
(:require [clojure.string :as string]
[clojure.edn :as edn]
[clojure.spec.alpha :as s]
[charred.api :refer [read-csv]]
[tech.v3.dataset :as d]
[tech.v3.dataset :as d]
[clj-http.client :as client])
(:import [java.net URLEncoder]))

(def query-defaults
"The default map of query parameter values. Can be changed to modify the scope
and size of your Statcast query."
(with-open [rdr (-> "public/query.edn" io/resource io/reader)]
(edn/read-string (slurp rdr))))
{:sort-col "pitches" :hfSit nil :hfPT nil,
:hfOutfield nil :game-date-gt nil :min-pitches "0",
:metric-1 nil :hfSA nil :hfInn nil,
:hfTeam nil :game-date-lt nil :batter-stands nil,
:sort-order "desc" :hfOuts nil :hfStadium nil,
:player-event-sort "api_p_release_speed" :hfZ nil :type "details",
:player-type "batter" :hfGT "R|" :hfC nil,
:home-road nil :min-results "0" :hfRO nil,
:hfOpponent nil :pitcher-throws nil :hfPull nil,
:hfFlag nil :min-pas "0" :group-by "name",
:hfBBT nil :position nil :hfSea nil ,
:hfInfield nil :hfMo nil :hfPR nil,
:hfBBL nil :hfAB nil :hfNewZones nil})

(defn make-query-map
{:doc "Modifies the query map stored in query-defaults with a user-specified
Expand Down

0 comments on commit 5bf14cd

Please sign in to comment.