diff options
| author | Marius Peter <dev@marius-peter.com> | 2025-11-24 15:44:58 +0100 |
|---|---|---|
| committer | Marius Peter <dev@marius-peter.com> | 2025-11-24 15:44:58 +0100 |
| commit | b4b113796455b85389df1c826f6e7ec93e804001 (patch) | |
| tree | da3f143888cf883dd1f109962c84cf58a74e523f /db/seed.rkt | |
| parent | 507844a30cbbdaf166a2fd56c9a6e4985c7d7c97 (diff) | |
Add French name to nutrient model.
Diffstat (limited to 'db/seed.rkt')
| -rw-r--r-- | db/seed.rkt | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/db/seed.rkt b/db/seed.rkt index 9693e89..7530651 100644 --- a/db/seed.rkt +++ b/db/seed.rkt @@ -23,28 +23,27 @@ seed-existing-fertilizer-products!)) (define (seed-nutrients!) - (define nutrient-names (map nutrient-name (get-nutrients))) + (define nutrient-names (map nutrient-canonical-name (get-nutrients))) (define default-nutrients - '(("Nitrate Nitrogen" . "NNO3") ("Phosphorus" . "P") - ("Potassium" . "K") - ("Calcium" . "Ca") - ("Magnesium" . "Mg") - ("Sulfur" . "S") - ("Sodium" . "Na") - ("Chloride" . "Cl") - ("Silicon" . "Si") - ("Iron" . "Fe") - ("Zinc" . "Zn") - ("Boron" . "B") - ("Manganese" . "Mn") - ("Copper" . "Cu") - ("Molybdenum" . "Mo") - ("Ammonium Nitrogen" . "NNH4"))) - (with-tx (for ([pair (in-list default-nutrients)]) - (match-define (cons name formula) pair) - ;; Ensure idempotence - (unless (member name nutrient-names) - (create-nutrient! name formula))))) + '(("Nitrate Nitrogen" "Azote nitrique" "NNO3") ("Phosphorus" "Phosphore" "P") + ("Potassium" "Potassium" "K") + ("Calcium" "Calcium" "Ca") + ("Magnesium" "Magnésium" "Mg") + ("Sulfur" "Soufre" "S") + ("Sodium" "Sodium" "Na") + ("Chloride" "Chlore" "Cl") + ("Silicon" "Silicium" "Si") + ("Iron" "Fer" "Fe") + ("Zinc" "Zinc" "Zn") + ("Boron" "Bore" "B") + ("Manganese" "Manganèse" "Mn") + ("Copper" "Cuivre" "Cu") + ("Molybdenum" "Molybdène" "Mo") + ("Ammonium Nitrogen" "Azote ammoniacal" "NNH4"))) + (with-tx (for ([nutrient-data (in-list default-nutrients)]) + (match-define (list canonical-name french-name formula) nutrient-data) + (unless (member canonical-name nutrient-names) + (create-nutrient! canonical-name french-name formula))))) (define-runtime-path measurement-csv "data/dolibarr_nutrient_measurements_ppm.csv") (define (seed-historical-nutrient-measurements!) |