Last active
October 19, 2021 09:41
-
-
Save NPException/bd123f19ba0f6f3596e129ffe894231a to your computer and use it in GitHub Desktop.
Futtermittel-Allergie IgE-IgG Sortierung
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns allergie-sort | |
(:require [clojure.string :as str])) | |
(def ^:private categories | |
'{Weizen :Pflanze | |
Soja :Pflanze | |
Reis :Pflanze | |
Mais :Pflanze | |
Gerste :Pflanze | |
Kartoffel :Pflanze | |
Hafer :Pflanze | |
Zuckerruebe :Pflanze | |
Hirse :Pflanze | |
Rind :Fleisch | |
Schwein :Fleisch | |
Lamm :Fleisch | |
Ente :Fleisch | |
Huhn :Fleisch | |
Truthahn :Fleisch | |
Fischmischung :Fleisch | |
Kaninchen :Fleisch | |
Lachs :Fleisch | |
Thunfisch :Fleisch | |
Hirsch :Fleisch | |
Strauss :Fleisch | |
Ei :Tierprodukt | |
Kuhmilch :Tierprodukt}) | |
(defn ^:private load-lines | |
[file] | |
(->> (slurp file) | |
(str/split-lines) | |
(map str/trim) | |
(remove empty?))) | |
(defn ^:private load-vals | |
[file] | |
(->> (load-lines file) | |
(map #(subs % 1)) | |
(map #(if (= "O" %) "0" %)) | |
(mapv #(Integer/parseInt %)))) | |
(defn build-allergy-map | |
[names-file ige-file igg-file] | |
(let [names (map symbol (load-lines names-file)) | |
ige (load-vals ige-file) | |
igg (load-vals igg-file)] | |
(->> (map vector names ige igg) | |
(sort-by #(subvec % 1)) | |
(group-by (comp categories first))))) | |
(comment | |
;; Werte und Namen mittels Google-Lens vom Laborbericht kopiert und in Dateien gespeichert | |
(build-allergy-map "names.txt" "ige.txt" "igg.txt") | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
R5 | |
RO | |
RO | |
RO | |
RO | |
RO | |
RO | |
RO | |
RO | |
RO | |
RO | |
R4 | |
RO | |
RO | |
RO | |
RO | |
RO | |
RO | |
RO | |
RO | |
R3 | |
RO | |
RO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
R5 | |
R4 | |
R4 | |
R4 | |
R4 | |
R4 | |
R3 | |
R3 | |
R3 | |
R2 | |
R2 | |
R5 | |
R2 | |
R4 | |
R3 | |
R3 | |
R3 | |
R3 | |
R4 | |
R3 | |
R5 | |
R5 | |
R3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rind | |
Schwein | |
Lamm | |
Ente | |
Huhn | |
Truthahn | |
Weizen | |
Soja | |
Reis | |
Mais | |
Ei | |
Kuhmilch | |
Fischmischung | |
Kaninchen | |
Lachs | |
Thunfisch | |
Gerste | |
Kartoffel | |
Hafer | |
Zuckerruebe | |
Hirsch | |
Strauss | |
Hirse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:Pflanze [[Mais 0 2] | |
[Weizen 0 3] | |
[Soja 0 3] | |
[Reis 0 3] | |
[Gerste 0 3] | |
[Kartoffel 0 3] | |
[Zuckerruebe 0 3] | |
[Hirse 0 3] | |
[Hafer 0 4]], | |
:Fleisch [[Fischmischung 0 2] | |
[Lachs 0 3] | |
[Thunfisch 0 3] | |
[Schwein 0 4] | |
[Lamm 0 4] | |
[Ente 0 4] | |
[Huhn 0 4] | |
[Truthahn 0 4] | |
[Kaninchen 0 4] | |
[Strauss 0 5] | |
[Hirsch 3 5] | |
[Rind 5 5]], | |
:Tierprodukt [[Ei 0 2] | |
[Kuhmilch 4 5]]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment