|
16 | 16 | {:sex "2", :care-status "N1", :legal-status "V3", :uasc "True", :dob "1999", :ceased "2017-07-18", :id "124", :report-year "2017", :placement "U2", :report-date "2017-06-10"} |
17 | 17 | {:sex "2", :care-status "N1", :legal-status "V4", :uasc "True", :dob "1999", :ceased "2017-07-18", :id "124", :report-year "2017", :placement "U2", :report-date "2017-06-10"})) |
18 | 18 |
|
19 | | -(def example (p/prepare-ages (->> example-data |
20 | | - (map c/format-episode) |
21 | | - c/episodes |
22 | | - c/episodes->periods) |
23 | | - (r/make-random 50))) |
| 19 | +o(def most-recent {:sex "2", :care-status "E1", :legal-status "C2", :uasc "False", :dob "1999", :ceased "2017-07-18", :id "120", :report-year "2017", :placement "E2", :report-date "2017-04-18"}) |
| 20 | + |
| 21 | +(defn prep-ages [data] |
| 22 | + (p/prepare-ages (->> data |
| 23 | + (map c/format-episode) |
| 24 | + c/episodes |
| 25 | + c/episodes->periods) |
| 26 | + (r/make-random 50))) |
| 27 | + |
| 28 | +(def example-1 (prep-ages example-data)) |
| 29 | + |
| 30 | +(def example-2 (prep-ages (conj example-data most-recent))) |
24 | 31 |
|
25 | 32 | (deftest update-fuzzy-test |
26 | | - (let [age (:admission-age (first example)) |
| 33 | + (let [age (:admission-age (first example-1)) |
27 | 34 | fuzzy-age [(- age 1) age (+ age 1)] |
28 | | - yrs (/ (:duration (first example)) 365.0) |
| 35 | + yrs (/ (:duration (first example-1)) 365.0) |
29 | 36 | fuzzy-yrs (mapv int [(Math/floor yrs) (Math/ceil yrs)]) |
30 | | - episodes (:episodes (first example)) |
| 37 | + episodes (:episodes (first example-1)) |
31 | 38 | result (update-fuzzy {} [age yrs] conj episodes)] |
32 | 39 | (testing "returns range of ages close to example" |
33 | 40 | (is (= (vec (distinct (map #(-> % first first) result))) |
|
50 | 57 |
|
51 | 58 | (comment |
52 | 59 | "build test around this" |
53 | | - ((episodes-model example) 0 (duration-model-0 (r/make-random 50)) (first example) (r/make-random 50))) |
| 60 | + ((episodes-model example-2) 0 (duration-model-0 (r/make-random 50)) (nth example-1 3) (r/make-random 50))) |
0 commit comments