Prostate cancer risk group classification shifts between NCCN and EAU 2025. See full paper at https://doi.org/10.1016/j.eururo.2025.07.023
nccn_eau_2025.clj edited
194 lines 5.3 kB view raw
1(ns eau-nccn 2 "Script to explore how different patient groups are classified 3 according to the 2025 EAU Guidelines for Prostate Cancer and the 4 NCCN. 5 6 It starts by creating a list of all the permutations of the 7 relevant markers, then applying the different classifications to each permutation. 8 9 Finally, we calculate the % of each classification and the frequency 10 of each EAU<>NCCN combination. 11 12 The Sankey diagram can be accessed via this public link: 13 https://sankeymatic.com/build/?i=PTAEFEDsBcFMCdQDEA2B7A7gZ1AI1tBrLJKAHJoAmsWANKCgJYDWso0AFo1gFwBQIUEOHCAymgCu8AMZsA2gEEAsgHkAqmQAqAXVCaAhvADmBPnzIBhC2VAAZTKHjdmoOQBZd4BWrsOnWZnMrGyR9ADdJeH1cFHkAVk9vZHDI6Nig61A1SAAzFKk0%2BQBGAA5En2y8iIKY2AybAAlGIw5HZ1cigGYAJnLQJpa2gLNLTNDqqNqOvoHW%2D0DRm0r8ydjXAE4%2B8dTa%2BqzclcKOopnmueczM0EATUlQaX1SLAJQfXIqWAByHGk0dHh6ExWOwuLwBGAeAAhCSUEzQUAAYgADHEAOzgkSY4QAOlxaEQb1%2B%2D1AOXxr1AWEYkCMa1QmH4gmhsJechOoBUnAQ5FgsiwlOgjBoiIAbEjhVcwAAiOQAKm0ktAAFtYI8cJK1M9XpAAJ6vRWSGAMWA5eFoMIISUMsBMuGuOWgUThKlGLASrKazn3NAweB%2DHD4dAYdhoe4SLDQNCKxgALzqgm1kVAlEY%2BiMUUV31eAAcsyqopBZLjsXxKbHQEHRUi%2BEJWpW%2BIrDEYqQxQEVutXHK320J4aUO7hQN0q7gjF7iQicpOpx3oPmsFnDCR4WQ%2BJAPuWux3WnEq0J5%2DppM7QKi4v38dRELuQbBla8O0SyQiSs%2BXx20AvD9BdUU%2BDlA6H4DCfRoCkNgkWxU8hCpDgEEYaAcl9RVQEkaBKWoABaKl7z%2BR91jw%2DC3w%2DODdXAtxTxQfQEwkU14AvV5qMjYDGGkDsACswwFHIEycJtIBwFchHY8NGC4khKH4jt4Fgc14GeNN9CzVoBNeaBoAPLgC0jLNYjgcMQ0gPMaGgPgKIDH4cMQZEkWs6yt0YahyDslomBaeFwJPDtSRgPJZApVV0OeJwcg7JgDP3Q9qVAcDu0cWAKIFc1SzYIoiivBsjEgETv1s0y4sgfRbwU3NDBwa4OyS1txSEIgznhNwcuiOKgJQCQ2CKvNSs8iQUBQLMpMPSlvVAMqhCzNB%2BUYIaA0wDsatc0B6qrXLevGuDJtIfQGP0FzSCvLBpBgwqGM8xhZPhfBSSk%2DspP0ZgxqpeFOj4ZrWpJfEG3hT5aGxT4Oz641GAAD1AT5fr3CRJyBkHfs5ZU0EnZ54TedZ%2Byi%2B9QCeoRKAx%2BsCDeZUYHWrBHlYbUPuYxyhCYYTFVwbbHl5YagA 14 ") 15 16 17(def perms 18 (for [psa [9 15 21] 19 biopsy [1 2] 20 isup [1 2 3 4 5] 21 t-stage [1 2 3 4 5 6]] 22 {:psa psa 23 :biopsy biopsy 24 :isup isup 25 :t-stage t-stage})) 26 27 28(defn t 29 " 30 Map t-stage to an integer for easier math. 31 " 32 [k] 33 (let [t-stages [:t1 :t2a :t2b :t2c :t3 :t4] 34 t-mapping (zipmap t-stages [1 2 3 4 5 6])] 35 (if (contains? t-mapping k) 36 (k t-mapping) 37 (throw (ex-info (str t " is not a valid t-stage! Valid stages " t-stages) 38 {:k k :t-mapping t-mapping}))))) 39 40 41(defn eau-low 42 [{:keys [psa isup t-stage]}] 43 (and 44 (= isup 1) 45 (< psa 10) 46 (<= t-stage (t :t2a)))) 47 48 49(defn eau-favorable 50 [{:keys [psa isup t-stage]}] 51 (or 52 (and 53 (= isup 2) 54 (< psa 10) 55 (<= t-stage (t :t2b))) 56 (and 57 (= isup 1) 58 (<= 10 psa 20) 59 (<= t-stage (t :t2b))) 60 (and 61 (= isup 1) 62 (< psa 10) 63 (= t-stage (t :t2b))))) 64 65 66(defn eau-unfavorable 67 [{:keys [psa isup t-stage]}] 68 (or 69 (and 70 (= isup 2) 71 (<= 10 psa 20) 72 (<= t-stage (t :t2b))) 73 (and 74 (= isup 3) 75 (<= t-stage (t :t2b))))) 76 77 78(defn eau-high 79 [{:keys [psa isup t-stage]}] 80 (or 81 (> isup 3) 82 (> psa 20) 83 (>= t-stage (t :t2c)))) 84 85 86(defn eau 87 [m] 88 (cond 89 (eau-high m) :high-risk 90 (eau-low m) :low-risk 91 (eau-favorable m) :favorable 92 (eau-unfavorable m) :unfavorable 93 :else :uncategorized)) 94 95 96(def eau-freqs 97 (->> perms 98 (map #(assoc % :eau (eau %))) 99 (map :eau) 100 (frequencies))) 101 102 103(defn add-percent 104 [perms freqs] 105 (reduce 106 (fn [p c] 107 (update p c (fn [v] [v (str (int (* (/ v (count perms)) 100)) "%")]))) 108 freqs 109 (keys freqs))) 110 111 112;; ---------------------------------------------------------------------------- 113 114 115(defn nccn-low 116 [{:keys [psa isup t-stage]}] 117 (and 118 (= isup 1) 119 (< psa 10) 120 (<= t-stage (t :t2a)))) 121 122 123(def nccn-intermediate-factors 124 [(fn [{:keys [isup]}] 125 (<= 2 isup 3)) 126 (fn [{:keys [psa]}] 127 (<= 10 psa 20)) 128 (fn [{:keys [t-stage]}] 129 (<= (t :t2b) t-stage (t :t2c)))]) 130 131 132(defn nccn-n-intermediate-risk-factors 133 [perm] 134 (->> nccn-intermediate-factors 135 (map #(% perm)) 136 (filter true?) 137 (count))) 138 139 140(defn nccn-favorable 141 [{:keys [isup biopsy] :as perm}] 142 (and 143 (= (nccn-n-intermediate-risk-factors perm) 1) 144 (< isup 3) 145 (= biopsy 1))) 146 147 148(defn nccn-unfavorable 149 [{:keys [isup biopsy] :as perm}] 150 (or 151 (<= 2 (nccn-n-intermediate-risk-factors perm) 3) 152 (= isup 3) 153 (= biopsy 2))) 154 155 156(defn nccn-high 157 [{:keys [psa isup t-stage]}] 158 (or 159 (> isup 3) 160 (> psa 20) 161 (>= t-stage (t :t3)))) 162 163 164(defn nccn 165 [m] 166 (cond 167 (nccn-high m) :high-risk 168 (nccn-low m) :low-risk 169 (nccn-favorable m) :favorable 170 (nccn-unfavorable m) :unfavorable 171 :else :uncategorized)) 172 173 174(def nccn-freqs 175 (->> perms 176 (map #(assoc % :nccn (nccn %))) 177 (map :nccn) 178 (frequencies))) 179 180 181(def percentages 182 {:eau (add-percent perms eau-freqs) 183 :nccn (add-percent perms nccn-freqs) 184 :combinations (->> perms 185 (map #(assoc % :eau (eau %))) 186 (map #(assoc % :nccn (nccn %))) 187 ;; (filter #(and (= (:eau %) :favorable) 188 ;; (= (:nccn %) :unfavorable)))) 189 (map #(assoc % :same? (= (:eau %) (:nccn %)))) 190 (map (fn [p] [(:eau p) (:nccn p)])) 191 (frequencies))}) 192 193 194percentages