Repository navigation
Botanical APIs and Data Pipeline
Oussama Elhadji edited this page Nov 7, 2026
·
1 revision
LKHODRA integrates live open-access botanical, nutritional, and agro-meteorological APIs alongside a deterministic local image pipeline so the application works both online and 100% offline.
| API Provider | Endpoint / Service | Purpose in LKHODRA | Authentication |
|---|---|---|---|
| Open-Meteo Agro-Climate API | https://api.open-meteo.com/v1/forecast |
Real-time temperature, relative humidity, soil moisture, and reference evapotranspiration (ET0) across all 8 Moroccan agricultural terroir regions |
Free / No API Key |
| GBIF (Global Biodiversity Information Facility) | https://api.gbif.org/v1/species/match |
Taxonomic verification, kingdom/family hierarchy, and Moroccan occurrence records by binomial scientific name | Free / No API Key |
| Open Food Facts API | https://world.openfoodfacts.org/cgi/search.pl |
Cross-referencing Nutri-Score, NOVA food group, and macronutrient profiles | Free / No API Key |
| Wikidata & Wikipedia REST API | https://en.wikipedia.org/w/api.php |
Botanical lead imagery, multilingual taxonomy, and ethnobotanical references | Free / No API Key |
To guarantee zero broken images (0% 404) and zero repetitive pictures, LKHODRA uses an automated TypeScript pipeline (scripts/fetch-all-produce-images.ts):
-
Primary Image Download (
public/images/produce/<id>-1.jpg):- Queries Wikipedia's
pageimagesAPI and Wikimedia Commons'generator=searchAPI using each species' exact binomialscientificNameand English cultivar name. - Filters out non-photographic files (maps, distribution charts, herbarium sheets,
.svg,.tif,.pdf). - Downloads all 108 species' primary images locally into
public/images/produce/<id>-1.jpgand precaches them via Workbox PWA.
- Queries Wikipedia's
-
3-Photo Non-Repetitive Gallery Registry (
src/data/verifiedProduceImages.ts):- Maintains a global
Set(globalUsedRemoteUrls) across the entire catalog run so no two species ever share the same image URL and every species has 3 distinct gallery photos (1. Whole,2. Inside/Cut,3. Terroir/Culinary).
- Maintains a global
-
Automatic Local Fallback:
- Both
ProduceCard.tsxandProduceModal.tsxattach anonErrorhandler that automatically falls back to/images/produce/${item.id}-1.jpgif the user is offline or rate-limited.
- Both
LKHODRA (الخضرة والغلة) — The Definitive Moroccan & World Fruits, Vegetables & Organ Chronobiology Atlas
Curated & Architected by Oussama EL HADJI (@Bosaj) • Distributed under the MIT License
-
📖 Encyclopedia & Chronobiology
-
🍲 Culinary, Remedies & Souk Culture
-
🌐 Botanical APIs & Engineering