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: 0Should 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: 0Should 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: 0Should 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: 0Should 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: 0Should 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 varietyis_deadhead_suggested- Remove spent flowers for continued bloomingis_good_for_border- Suitable for garden bordersis_good_for_container- Suitable for container gardeningis_good_for_landscape- Suitable for landscape plantingis_good_for_rock_garden- Suitable for rock gardensis_good_for_shrubs- Suitable for shrub bordersis_butterfly_attractor- Attracts butterfliesis_pollinator_friendly- Attracts pollinators (bees, hummingbirds)is_deer_resistant- Deer tend to avoidis_mosquito_repellent- Repels mosquitoesis_rabbit_resistant- Rabbits tend to avoidis_drought_tolerant- Tolerates drought conditionsis_heat_tolerant- Tolerates high heatis_earth_kind- Earth-Kind certified varietyis_waterwise- Efficient water usageis_organic- Organic varietyis_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 sourcesinitial_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#
Best Practices#
- UTF-8 Encoding - Save CSV files as UTF-8 to preserve special characters
- Escape Commas - Wrap descriptions with commas in quotes:
"Description, with commas" - Use Notes Column - Add internal notes that won't be loaded to database
- Test Incrementally - Add a few plants, test load, then add more
- Version Control - Commit CSV files to git after validating data
Related Documentation#
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