Skip to content

Commit

Permalink
Merge pull request #40 from MastodonC/fix/consistent-naming
Browse files Browse the repository at this point in the history
new file names and fix target dir bug
  • Loading branch information
Michael Ford authored Feb 28, 2018
2 parents 5bc47bc + 51132eb commit dce66c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/clj/witan/send/charts.clj
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
(gather-set-data :from "NCY 6" "NCY 7")
(seq-of-maps->data-frame)
(sankey {:title (str "Aggregate setting transitions: " calendar-year "/" (apply str (drop 2 (str (inc calendar-year)))))}))
(move-file "Rplots.pdf" (str "target/Historic-Transitions_" calendar-year ".pdf")))
(move-file "Rplots.pdf" (str "target/Historic_Transitions_" calendar-year ".pdf")))

(defn sankey-joiners [data]
(->> data
Expand All @@ -71,7 +71,7 @@
(gather-set-data :from "From" "To")
(seq-of-maps->data-frame)
(sankey {:title "Joiner transitions"}))
(move-file "Rplots.pdf" (str "target/Joiner-Transitions.pdf")))
(move-file "Rplots.pdf" (str "target/Joiner_Transitions.pdf")))

(defn sankey-setting-specific [data setting-to]
(->> data
Expand All @@ -82,7 +82,7 @@
(gather-set-data :to "From" "To")
(seq-of-maps->data-frame)
(sankey {:title (str "Joiner transitions")}))
(move-file "Rplots.pdf" (str "target/" (name setting-to) "-mover-transitions.pdf")))
(move-file "Rplots.pdf" (str "target/" (name setting-to) "_Mover_Transitions.pdf")))

(defn pull-year
[data pos]
Expand Down
16 changes: 9 additions & 7 deletions src/clj/witan/send/send.clj
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,8 @@
keys
(map #(vec (drop 1 %)))
distinct)]
(if (not (.isDirectory (io/file "target/")))
(.mkdir (io/file "target/")))
(when (every? (fn [transition] (transition-present? transition transform-projection)) transform-transitions)
(report/info (report/bold "Not every historic transition present in projection!") "Consider checking valid state input.\n"))
(when output
Expand Down Expand Up @@ -564,7 +566,7 @@
(report/info "Final year of input data: " (report/bold (inc (last years))))
(report/info "Final year of projection: " (report/bold (+ (last years) (count (map :total-in-send send-output)))))
(output-transitions "target/transitions.edn" projection)
(with-open [writer (io/writer (io/file "target/output-ay-state.csv"))]
(with-open [writer (io/writer (io/file "target/Output_AY_State.csv"))]
(let [columns [:calendar-year :academic-year :state :mean :std-dev :iqr :min :low-ci :q1 :median :q3 :high-ci :max]]
(->> (mapcat (fn [output year]
(map (fn [[[academic-year state] stats]]
Expand All @@ -573,7 +575,7 @@
(map (apply juxt columns))
(concat [(map name columns)])
(csv/write-csv writer))))
(with-open [writer (io/writer (io/file "target/output-ay.csv"))]
(with-open [writer (io/writer (io/file "target/Output_AY.csv"))]
(let [columns [:calendar-year :academic-year :mean :std-dev :iqr :min :low-ci :q1 :median :q3 :high-ci :max]]
(->> (mapcat (fn [output year]
(map (fn [[academic-year stats]]
Expand All @@ -583,7 +585,7 @@
(map (apply juxt columns))
(concat [(map name columns)])
(csv/write-csv writer))))
(with-open [writer (io/writer (io/file "target/output-need.csv"))]
(with-open [writer (io/writer (io/file "target/Output_Need.csv"))]
(let [columns [:calendar-year :need :mean :std-dev :iqr :min :low-ci :q1 :median :q3 :high-ci :max]]
(->> (mapcat (fn [output year]
(map (fn [[need stats]]
Expand All @@ -593,7 +595,7 @@
(map (apply juxt columns))
(concat [(map name columns)])
(csv/write-csv writer))))
(with-open [writer (io/writer (io/file "target/output-setting.csv"))]
(with-open [writer (io/writer (io/file "target/Output_Setting.csv"))]
(let [columns [:calendar-year :setting :mean :std-dev :iqr :min :low-ci :q1 :median :q3 :high-ci :max]]
(->> (mapcat (fn [output year]
(map (fn [[setting stats]]
Expand All @@ -603,7 +605,7 @@
(map (apply juxt columns))
(concat [(map name columns)])
(csv/write-csv writer))))
(with-open [writer (io/writer (io/file "target/output-count.csv"))]
(with-open [writer (io/writer (io/file "target/Output_Count.csv"))]
(let [columns [:calendar-year :mean :std-dev :iqr :min :low-ci :q1 :median :q3 :high-ci :max]]
(->> (map (fn [stats year]
(-> (medley/map-vals round stats)
Expand All @@ -612,7 +614,7 @@
(map (apply juxt columns))
(concat [(map name columns)])
(csv/write-csv writer))))
(with-open [writer (io/writer (io/file "target/output-cost.csv"))]
(with-open [writer (io/writer (io/file "target/Output_Cost.csv"))]
(let [columns [:calendar-year :mean :std-dev :iqr :min :low-ci :q1 :median :q3 :high-ci :max]]
(->> (map (fn [stats year]
(-> (medley/map-vals round stats)
Expand All @@ -621,7 +623,7 @@
(map (apply juxt columns))
(concat [(map name columns)])
(csv/write-csv writer))))
(with-open [writer (io/writer (io/file "target/output-ay-group.csv"))]
(with-open [writer (io/writer (io/file "target/Output_AY_Group.csv"))]
(let [columns [:calendar-year :ay-group :mean :std-dev :iqr :min :low-ci :q1 :median :q3 :high-ci :max]]
(->> (mapcat (fn [output year]
(map (fn [[ay-group stats]]
Expand Down

0 comments on commit dce66c7

Please sign in to comment.