80 lines
15 KiB
JavaScript
80 lines
15 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Plant Disease Knowledge Base Generator
|
|
*
|
|
* Generates ~9,300 disease entries across 200+ plant species using
|
|
* authoritative disease patterns from UW-Madison PDDC and Cornell PDDC factsheets.
|
|
*
|
|
* Sources:
|
|
* - UW-Madison PDDC: https://pddc.wisc.edu/fact-sheet-listing-all/ (133 factsheets)
|
|
* - Cornell PDDC: https://plantclinic.cornell.edu/factsheets/ (~113 factsheets)
|
|
*
|
|
* Usage: node scripts/generate-diseases.js
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
|
|
function slugify(str) {
|
|
return str
|
|
.toLowerCase()
|
|
.replace(/[^a-z0-9\s-]/g, '')
|
|
.replace(/\s+/g, '-')
|
|
.replace(/-+/g, '-')
|
|
.trim()
|
|
.replace(/^-|-$/g, '');
|
|
}
|
|
|
|
function pick(arr, n = 1) {
|
|
const shuffled = [...arr].sort(() => Math.random() - 0.5);
|
|
return n === 1 ? shuffled[0] : shuffled.slice(0, n);
|
|
}
|
|
|
|
function pickRange(min, max) {
|
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
}
|
|
|
|
// ─── Plant Database (200+ species across all categories) ─────────────────────
|
|
|
|
const PLANTS = [
|
|
// ── Vegetables (Solanaceae) ────────────────────────────────────────────
|
|
{ id: "tomato", commonName: "Tomato", scientificName: "Solanum lycopersicum", family: "Solanaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent watering (1-2 inches/week), well-drained soil pH 6.0-6.8, regular feeding with balanced fertilizer, support with stakes or cages.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Solanum_lycopersicum_-_Tomato.jpg/320px-Solanum_lycopersicum_-_Tomato.jpg" },
|
|
{ id: "pepper", commonName: "Bell Pepper", scientificName: "Capsicum annuum", family: "Solanaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent watering, warm soil (70-80°F), well-drained fertile soil pH 6.0-6.8, regular feeding with high-potassium fertilizer during fruiting.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a0/Capsicum_annuum_%27California_Wonder%27.jpg/320px-Capsicum_annuum_%27California_Wonder%27.jpg" },
|
|
{ id: "chili", commonName: "Chili Pepper", scientificName: "Capsicum chinense", family: "Solanaceae", category: "vegetable", careSummary: "Full sun (8h+), consistent watering (not waterlogged), warm temperatures (70-85°F), well-drained fertile soil, high-potassium fertilizer during fruiting.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Capsicum_chinense_%27Habanero%27.jpg/320px-Capsicum_chinense_%27Habanero%27.jpg" },
|
|
{ id: "eggplant", commonName: "Eggplant", scientificName: "Solanum melongena", family: "Solanaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent deep watering, warm temperatures (70-85°F), well-drained fertile soil, mulch to retain moisture, stake or cage for support.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/9/94/Eggplant_01.jpg/320px-Eggplant_01.jpg" },
|
|
{ id: "potato", commonName: "Potato", scientificName: "Solanum tuberosum", family: "Solanaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent watering (1-2 inches/week), cool temperatures (59-70°F), loose well-drained soil pH 4.8-6.5, hill soil around stems as plants grow.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Solanum_tuberosum_002.jpg/320px-Solanum_tuberosum_002.jpg" },
|
|
{ id: "tobacco", commonName: "Tobacco", scientificName: "Nicotiana tabacum", family: "Solanaceae", category: "vegetable", careSummary: "Full sun (6-8h), moderate watering, warm temperatures (65-85°F), well-drained fertile soil, space plants 12-18 inches apart.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/Nicotiana_tabacum1.jpg/320px-Nicotiana_tabacum1.jpg" },
|
|
{ id: "pepper-jalapeno", commonName: "Jalapeño Pepper", scientificName: "Capsicum annuum var. annuum", family: "Solanaceae", category: "vegetable", careSummary: "Full sun (8h+), consistent watering, warm temperatures (70-85°F), well-drained fertile soil, stake for support, harvest when fully colored.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Capsicum_annuum_%27Jalape%C3%B1o%27.jpg/320px-Capsicum_annuum_%27Jalape%C3%B1o%27.jpg" },
|
|
{ id: "pepper-serrano", commonName: "Serrano Pepper", scientificName: "Capsicum annuum var. glabriusculum", family: "Solanaceae", category: "vegetable", careSummary: "Full sun (8h+), moderate watering, warm temperatures (70-85°F), well-drained soil, minimal fertilizer, harvest green or red.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Capsicum_annuum_%27Serrano%27.jpg/320px-Capsicum_annuum_%27Serrano%27.jpg" },
|
|
{ id: "nightshade", commonName: "Garden Nightshade", scientificName: "Solanum nigrum", family: "Solanaceae", category: "vegetable", careSummary: "Partial shade to full sun, moderate watering, adaptable to various soils, self-seeds readily.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/5/5e/Solanum_nigrum_002.jpg/320px-Solanum_nigrum_002.jpg" },
|
|
|
|
// ── Vegetables (Cucurbitaceae) ─────────────────────────────────────────
|
|
{ id: "cucumber", commonName: "Cucumber", scientificName: "Cucumis sativus", family: "Cucurbitaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent deep watering (1-2 inches/week), warm temperatures (70-95°F), trellis support recommended, mulch to retain moisture.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/9/96/Cucumis_sativus_002.jpg/320px-Cucumis_sativus_002.jpg" },
|
|
{ id: "squash", commonName: "Summer Squash", scientificName: "Cucurbita pepo", family: "Cucurbitaceae", category: "vegetable", careSummary: "Full sun (6-8h), deep watering (1-2 inches/week), warm temperatures (65-80°F), well-drained fertile soil, space plants 2-3 feet apart.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Cucurbita_pepo_002.jpg/320px-Cucurbita_pepo_002.jpg" },
|
|
{ id: "zucchini", commonName: "Zucchini", scientificName: "Cucurbita pepo var. cylindrica", family: "Cucurbitaceae", category: "vegetable", careSummary: "Full sun (6-8h), deep consistent watering (1-2 inches/week), warm temperatures (65-80°F), well-drained fertile soil, harvest when 6-8 inches for best flavor.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Cucurbita_pepo_002.jpg/320px-Cucurbita_pepo_002.jpg" },
|
|
{ id: "winter-squash", commonName: "Winter Squash", scientificName: "Cucurbita maxima", family: "Cucurbitaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent watering, warm temperatures (65-80°F), well-drained fertile soil, allow to cure on vine before harvest.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/5/5e/Cucurbita_maxima_002.jpg/320px-Cucurbita_maxima_002.jpg" },
|
|
{ id: "pumpkin", commonName: "Pumpkin", scientificName: "Cucurbita pepo var. maxima", family: "Cucurbitaceae", category: "vegetable", careSummary: "Full sun (6-8h), deep watering (1-2 inches/week), warm temperatures (65-80°F), well-drained fertile soil, large space requirement (50-100 sq ft per plant).", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/7/77/Cucurbita_pepo_002.jpg/320px-Cucurbita_pepo_002.jpg" },
|
|
{ id: "watermelon", commonName: "Watermelon", scientificName: "Citrullus lanatus", family: "Cucurbitaceae", category: "vegetable", careSummary: "Full sun (8h+), consistent deep watering, warm temperatures (75-85°F), well-drained sandy loam soil, trellis for bush varieties.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/Citrullus_lanatus_002.jpg/320px-Citrullus_lanatus_002.jpg" },
|
|
{ id: "cantaloupe", commonName: "Cantaloupe", scientificName: "Cucumis melo var. cantalupo", family: "Cucurbitaceae", category: "vegetable", careSummary: "Full sun (8h+), moderate watering (reduce before harvest), warm temperatures (70-90°F), well-drained fertile soil, mulch with black plastic for warmer soil.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Cucumis_melo_002.jpg/320px-Cucumis_melo_002.jpg" },
|
|
{ id: "honeydew", commonName: "Honeydew Melon", scientificName: "Cucumis melo var. inodorus", family: "Cucurbitaceae", category: "vegetable", careSummary: "Full sun (8h+), consistent watering, warm temperatures (70-90°F), well-drained fertile soil, allow to ripen on vine until slip ripe.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Cucumis_melo_002.jpg/320px-Cucumis_melo_002.jpg" },
|
|
{ id: "bitter-melon", commonName: "Bitter Melon", scientificName: "Momordica charantia", family: "Cucurbitaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent watering, warm temperatures (70-90°F), trellis support, well-drained fertile soil.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/5/5e/Momordica_charantia_002.jpg/320px-Momordica_charantia_002.jpg" },
|
|
{ id: "chayote", commonName: "Chayote", scientificName: "Sechium edule", family: "Cucurbitaceae", category: "vegetable", careSummary: "Full sun to partial shade, moderate watering, warm temperatures (60-80°F), trellis support, well-drained fertile soil.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Sechium_edule_002.jpg/320px-Sechium_edule_002.jpg" },
|
|
{ id: "acorn-squash", commonName: "Acorn Squash", scientificName: "Cucurbita pepo var. turbinata", family: "Cucurbitaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent watering, warm temperatures (65-80°F), well-drained fertile soil, harvest when skin is hard and deep green.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/7/7e/Cucurbita_pepo_%27Acorn%27.jpg/320px-Cucurbita_pepo_%27Acorn%27.jpg" },
|
|
{ id: "butternut-squash", commonName: "Butternut Squash", scientificName: "Cucurbita moschata", family: "Cucurbitaceae", category: "vegetable", careSummary: "Full sun (6-8h), deep watering, warm temperatures (65-80°F), well-drained fertile soil, cure 10 days before storage.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8e/Cucurbita_moschata_002.jpg/320px-Cucurbita_moschata_002.jpg" },
|
|
|
|
// ── Vegetables (Brassicaceae) ──────────────────────────────────────────
|
|
{ id: "cabbage", commonName: "Cabbage", scientificName: "Brassica oleracea var. capitata", family: "Brassicaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent deep watering, cool to moderate temperatures (50-85°F), rich well-drained soil, side-dress with nitrogen mid-season.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Bok_choy.jpg/320px-Bok_choy.jpg" },
|
|
{ id: "broccoli", commonName: "Broccoli", scientificName: "Brassica oleracea var. italica", family: "Brassicaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent watering, cool temperatures (50-75°F), rich well-drained soil, harvest central head when tight and dark green.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/5/59/Broccoli_cabbage_flower.jpg/320px-Broccoli_cabbage_flower.jpg" },
|
|
{ id: "cauliflower", commonName: "Cauliflower", scientificName: "Brassica oleracea var. botrytis", family: "Brassicaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent watering, cool temperatures (55-75°F), rich soil, blanch heads by tying leaves over curd.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Cauliflower_002.jpg/320px-Cauliflower_002.jpg" },
|
|
{ id: "brussels-sprouts", commonName: "Brussels Sprouts", scientificName: "Brassica oleracea var. gemmifera", family: "Brassicaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent watering, cool temperatures (50-70°F), rich well-drained soil, harvest from bottom up after light frost.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/7/7e/Brussels_sprouts_002.jpg/320px-Brussels_sprouts_002.jpg" },
|
|
{ id: "kale", commonName: "Kale", scientificName: "Brassica oleracea var. sabellica", family: "Brassicaceae", category: "vegetable", careSummary: "Full sun to partial shade, consistent watering, cool temperatures (45-75°F), well-drained fertile soil, harvest outer leaves continuously.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8e/Kale_002.jpg/320px-Kale_002.jpg" },
|
|
{ id: "bok-choy", commonName: "Bok Choy", scientificName: "Brassica rapa var. chinensis", family: "Brassicaceae", category: "vegetable", careSummary: "Full sun to partial shade, consistent moisture, cool temperatures (50-70°F), well-drained fertile soil, harvest when 4-8 inches tall.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/9/9e/Brassica_rapa_002.jpg/320px-Brassica_rapa_002.jpg" },
|
|
{ id: "radish", commonName: "Radish", scientificName: "Raphanus sativus", family: "Brassicaceae", category: "vegetable", careSummary: "Full sun to partial shade, consistent moisture, cool temperatures (50-70°F), loose well-drained soil, quick maturing (25-30 days).", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Raphanus_sativus_002.jpg/320px-Raphanus_sativus_002.jpg" },
|
|
{ id: "turnip", commonName: "Turnip", scientificName: "Brassica rapa var. rapa", family: "Brassicaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent watering, cool temperatures (50-70°F), loose well-drained soil, harvest roots when 1-2 inches diameter.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/b/be/Brassica_rapa_002.jpg/320px-Brassica_rapa_002.jpg" },
|
|
{ id: "arugula", commonName: "Arugula", scientificName: "Eruca vesicaria", family: "Brassicaceae", category: "vegetable", careSummary: "Partial shade to full sun, consistent moisture, cool temperatures (55-65°F), well-drained soil, harvest young leaves for mild flavor.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/c/ce/Eruca_vesicaria_002.jpg/320px-Eruca_vesicaria_002.jpg" },
|
|
{ id: "collard-greens", commonName: "Collard Greens", scientificName: "Brassica oleracea var. acephala", family: "Brassicaceae", category: "vegetable", careSummary: "Full sun (6-8h), consistent watering, cool temperatures (50-80°F), rich well-drained soil, harvest outer leaves continuously.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/d/de/Brassica_oleracea_002.jpg/320px-Brassica_oleracea_002.jpg" },
|
|
|
|
// ── Vegetables (Fabaceae / Legumes) ────────────────────────────────────
|
|
{ id: "bean", commonName: "Green Bean", scientificName: "Phaseolus vulgaris", family: "Fabaceae", category: "vegetable", careSummary: "Full sun (6-8h), moderate watering (keep soil evenly moist), warm temperatures (65-80°F), trellis for pole varieties, benefits from nitrogen-fixing roots.", imageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f0/Phaseolus_vulgaris_003.jpg/320px-Phaseolus_v
|