Adds a repeatable Python import script that populates fruits, fruit_synonyms,
and fruit_images from 03-data/obstsorten.xml and the three image directories.
Idempotent: deletes synonyms and images per fruit before re-inserting; upserts
fruit row by osdb_number. Reads DATABASE_URL from env.
- map_typ: 23 XML typ codes → 17-value fruit_type enum; aggregate types coerced
with logged warning; typ='p' (2 entries) mapped to Pfirsiche
- parse_synonyms: comma-split with whitespace/newline strip, empty filter
- parse_date: YYYYMMDD → date, fallback None → DB default NOW()
- find_images: globs {id}_*_s0.* across einzelfruechte/blueten/baume dirs
- 42 unit tests (no DB required) cover all mapping, parsing, and glob logic
- Makefile test target extended to include Python test suite
- 03-data/ and obstsorten.zip added to .gitignore (large binary data)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
scripts/import_fruits.py— idempotent bulk-importer reading03-data/obstsorten.xml, mapping 23typcodes to 17 fruit_type enum values, splitting comma-separated synonyms, and discovering images across three directories (einzelfruechte,blueten,baume)scripts/import_fruits_test.py— 43 unit tests coveringmap_typ,parse_synonyms,parse_date, andfind_images(no DB required)Makefiletest target to include Python unit tests03-data/andobstsorten.zip(large binary data, not committed)Test plan
cd scripts && python3 -m unittest import_fruits_test -v— all 43 tests passmake test— all backend, frontend, and script tests passDATABASE_URL=... python3 scripts/import_fruits.pyimports 3665 fruits with synonyms and images🤖 Generated with Claude Code
Adds a repeatable Python import script that populates fruits, fruit_synonyms, and fruit_images from 03-data/obstsorten.xml and the three image directories. Idempotent: deletes synonyms and images per fruit before re-inserting; upserts fruit row by osdb_number. Reads DATABASE_URL from env. - map_typ: 23 XML typ codes → 17-value fruit_type enum; aggregate types coerced with logged warning; typ='p' (2 entries) mapped to Pfirsiche - parse_synonyms: comma-split with whitespace/newline strip, empty filter - parse_date: YYYYMMDD → date, fallback None → DB default NOW() - find_images: globs {id}_*_s0.* across einzelfruechte/blueten/baume dirs - 42 unit tests (no DB required) cover all mapping, parsing, and glob logic - Makefile test target extended to include Python test suite - 03-data/ and obstsorten.zip added to .gitignore (large binary data) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>