Skip to content

Data Directory#

Purpose: Store initial seed data for database population


Files#

initial_plants.csv#

Template for initial plant data to seed the Plant model.

Usage:

python manage.py load_plants docs/data/initial_plants.csv
python manage.py load_plants docs/data/initial_plants.csv --clear  # Reset database

Column Reference:

The below information comes from the Database Seeding Guide.

Note that the system is intended to be metric by default, but user can change to imperial units. This will update for all items, so it does not need to be stored in the database.

Field Type Description Valid Values Required Notes
name_common Text Common plant name Any string ✅ Yes
name_scientific Text Scientific (Latin) name Any string ❌ Optional can be blank
plant_type Choice Plant type code an, bi, pe, tp, sh, tr, vi, un ✅ Yes Default: un (unknown)
exposure Choice Sun exposure code fs, fp, pu, pd, sh ✅ Yes Default: fs (full sun)
description Text Plant description Any string ✅ Yes
is_* (boolean flags) Boolean Plant characteristics (0 or 1) 0 or 1 ❌ Optional Default: 0 (false)
hardiness_zone_low Choice Minimum hardiness zone (e.g., 5a) 1a to 13b, na ✅ Yes Default: 8b
hardiness_zone_high Choice Maximum hardiness zone (e.g., 10b) 1a to 13b, na ✅ Yes Default: 8b
spacing_min Integer Minimum spacing 0-999 ❌ Optional Default: 0
Should provide choice of measurement (e.g. inches, cm, feet, etc) based on imperial or metric in personal settings
spacing_max Integer Maximum spacing 0-999 ❌ Optional Default: 0
Should provide choice of measurement (e.g. inches, cm, feet, etc) based on imperial or metric in personal settings
height_min Integer Minimum height 0-999 ❌ Optional Default: 0
Should provide choice of measurement (e.g. inches, cm, feet, etc) based on imperial or metric in personal settings
height_max Integer Maximum height 0-999 ❌ Optional Default: 0
Should provide choice of measurement (e.g. inches, cm, feet, etc) based on imperial or metric in personal settings
suggested_container_size Integer Container size 0-999 ❌ Optional Default: 0
Should provide choice of measurement in gallons or liters (metric or imperial)
medicinal_benefits Choice list of alleged medicinal benefits & properties Any string ❌ Optional These benefits could be on any plant. If no plants, it should not be listed as a possible medicinal benefit.
germination_days Integer Days to germination 0-999 days ❌ Optional Default: 0
maturity_days Integer Days to maturity 0-999 days ❌ Optional Default: 0

Plant Type Codes:

The below information comes from the Database Seeding Guide.

Code Description
an Annual
bi Biennial
pe Perennial
tp Tender Perennial
sh Shrub
tr Tree
vi Vine
un Unknown

Exposure Codes:

The below information comes from the Database Seeding Guide.

Code Description
fs Full Sun (6+ hours)
fp Full to Partial Sun (4-6 hours)
pu Partial Sun (morning, 4-6 hours)
pd Partial Shade (morning, ≤4 hours)
sh Shade

Boolean Flags (18 total):

The below information comes from the Database Seeding Guide.

All boolean fields accept 0 (false) or 1 (true):

  • is_hybrid - Hybrid variety
  • is_deadhead_suggested - Remove spent flowers for continued blooming
  • is_good_for_border - Suitable for garden borders
  • is_good_for_container - Suitable for container gardening
  • is_good_for_landscape - Suitable for landscape planting
  • is_good_for_rock_garden - Suitable for rock gardens
  • is_good_for_shrubs - Suitable for shrub borders
  • is_butterfly_attractor - Attracts butterflies
  • is_pollinator_friendly - Attracts pollinators (bees, hummingbirds)
  • is_deer_resistant - Deer tend to avoid
  • is_mosquito_repellent - Repels mosquitoes
  • is_rabbit_resistant - Rabbits tend to avoid
  • is_drought_tolerant - Tolerates drought conditions
  • is_heat_tolerant - Tolerates high heat
  • is_earth_kind - Earth-Kind certified variety
  • is_waterwise - Efficient water usage
  • is_organic - Organic variety
  • is_non_gmo - Non-GMO variety

Future Files#

These will be added when relationship handling is implemented:

  • initial_plant_links.csv - External resources (articles, videos, books)
  • initial_nurseries.csv - Nursery suppliers and sources
  • initial_companion_plants.csv - Beneficial plant pairings

See docs/tutorials/general/database-seeding-guide.md for complete tutorial on handling relationships.


Workflow#

Initial Setup#

# 1. Edit initial_plants.csv with your plant data
# 2. Load plants into database
python manage.py load_plants docs/data/initial_plants.csv

# 3. Verify in Django shell
python manage.py shell
>>> from Plants.models import Plant
>>> Plant.objects.count()
>>> Plant.objects.get(name_common='Tomato')

Adding New Plants#

# 1. Add new rows to initial_plants.csv
# 2. Load without --clear to append
python manage.py load_plants docs/data/initial_plants.csv

Reset Database#

# Clear and reload all plants
python manage.py load_plants docs/data/initial_plants.csv --clear

Best Practices#

  1. UTF-8 Encoding - Save CSV files as UTF-8 to preserve special characters
  2. Escape Commas - Wrap descriptions with commas in quotes: "Description, with commas"
  3. Use Notes Column - Add internal notes that won't be loaded to database
  4. Test Incrementally - Add a few plants, test load, then add more
  5. Version Control - Commit CSV files to git after validating data

Requirements#

  • Plant Database Scope: REQ-000b_Scope - Formal data needs and requirements
  • Data Management Requirements: REQ-000e_Requirements - CSV loading, validation, and integrity (OR3.N - OR7.N)

Implementation Guides#

  • Complete Seeding Guide: docs/tutorials/general/database-seeding-guide.md
  • Plant Model: 2024-Django-Attempt/Plants/models.py:21-104
  • MVP Planning: docs/decisions/planning/SDD-Planning_MVP.md