Dtabase Schema

Database Schema and Data Structure

Overview

This document defines the data structure for the GrowNative NZ plant database, designed to support both WordPress content management and future mobile application development.

Design Principles:

  • Structured data for consistent information
  • Extensible for future features
  • API-friendly for mobile apps
  • User-contributed content support
  • Maintain WordPress compatibility

Current Site Structure Analysis

Existing Plant Pages Example: https://feaa.info/wordpress/grownative/piper-excelsum/

Current Structure (to be Enhanced):

  • Free-form content sections
  • Basic image embedding
  • Comment-based user interaction
  • External link references

Proposed Enhancement:

  • Structured custom fields
  • Organized image galleries
  • Moderated user contributions
  • Relationship data between plants and growing conditions

DECISION REQUIRED: Data Complexity Level

Option A: Simple Structure (Recommended for Phase 1)

Single custom post type with extensive custom fields

Option B: Relational Structure (Future-Proof)

Multiple related post types and custom tables

Your preference affects complexity and timeline: ________________

Core Data Structure

1. Plant Species (Custom Post Type: plant_species)

WordPress Standard Fields

Title: Scientific Name (e.g., "Piper excelsum")
Slug: URL-friendly version (e.g., "piper-excelsum")
Content: General description and overview
Excerpt: Brief summary for listings
Featured Image: Primary identification photo

Custom Taxonomies

plant_type:
├── Tree
├── Shrub  
├── Herb
├── Fern
├── Climber
├── Grass
└── Other

growth_habit:
├── Upright
├── Spreading
├── Climbing
├── Prostrate
└── Clumping

conservation_status:
├── Not Threatened
├── Naturally Uncommon
├── Relict
├── Recovering
├── Declining
├── Nationally Critical
├── Nationally Endangered
└── Nationally Vulnerable

suitable_regions: (New Zealand regions)
├── Northland
├── Auckland
├── Waikato
├── Bay of Plenty
├── Gisborne
├── Hawke's Bay
├── Taranaki
├── Manawatu-Whanganui
├── Wellington
├── Tasman
├── Nelson
├── Marlborough
├── West Coast
├── Canterbury
├── Otago
└── Southland

2. Custom Fields Structure (Advanced Custom Fields)

DECISION REQUIRED: Field Complexity

Essential Fields Only:

  • Basic identification and growing info
  • Simple propagation notes
  • External references

Comprehensive Fields:

  • Detailed characteristics and measurements
  • Complex propagation data with success rates
  • User contribution tracking

Basic Information Group

Field Group: "Basic Plant Information"

common_names (Repeater Field):
├── name (Text)
├── language (Select: English, Māori, Other)
└── region (Text, optional)

plant_summary (Textarea):
├── Brief description for identification
└── Key distinguishing features

cultural_significance (Textarea):
├── Traditional Māori uses
├── Modern cultural importance
└── Historical information

Physical Characteristics Group

Field Group: "Physical Characteristics"

size_mature:
├── height_min (Number, meters)
├── height_max (Number, meters)  
├── width_min (Number, meters)
└── width_max (Number, meters)

growth_characteristics:
├── growth_rate (Select: Very Slow, Slow, Medium, Fast, Very Fast)
├── lifespan (Select: Annual, Short-lived Perennial, Long-lived Perennial, Very Long-lived)
└── growth_notes (Textarea)

physical_features:
├── leaf_description (Textarea)
├── flower_description (Textarea)
├── fruit_description (Textarea)
├── bark_description (Textarea)
└── distinguishing_features (Textarea)

seasonal_information:
├── flowering_months (Checkbox: Jan, Feb, Mar, etc.)
├── fruiting_months (Checkbox: Jan, Feb, Mar, etc.)
└── seasonal_notes (Textarea)

Growing Conditions Group

Field Group: "Growing Conditions"

environmental_needs:
├── light_requirements (Checkbox: Full Sun, Partial Sun, Shade, Deep Shade)
├── soil_types (Checkbox: Clay, Loam, Sand, Organic, Rocky)
├── drainage (Select: Well-drained, Moist, Wet, Boggy)
├── ph_preference (Select: Acidic, Neutral, Alkaline, Any)
└── water_requirements (Select: Drought Tolerant, Average, Moist, Wet)

climate_tolerance:
├── frost_tolerance (Select: Frost Tender, Light Frost, Moderate Frost, Heavy Frost)
├── wind_tolerance (Select: Sheltered, Some Wind, Windy, Coastal Winds)
├── salt_tolerance (Checkbox: Yes/No)
└── altitude_range (Text)

companion_plants (Post Object, Multiple):
├── Link to other plant species
└── Relationship notes

Propagation Information Group

Field Group: "Propagation Methods"

seed_propagation:
├── seed_collection_timing (Textarea)
├── seed_collection_method (Textarea)
├── seed_storage (Textarea)
├── seed_viability (Text)
├── seed_treatment (Textarea)
├── germination_method (Textarea)
├── germination_time (Text)
├── germination_rate (Text)
└── germination_notes (Textarea)

alternative_propagation:
├── cutting_propagation (Textarea)
├── division_method (Textarea)
├── layering_method (Textarea)
└── other_methods (Textarea)

growing_on:
├── container_growing (Textarea)
├── feeding_requirements (Textarea)
├── watering_young_plants (Textarea)
├── transplanting_notes (Textarea)
└── time_to_planting_size (Text)

planting_information:
├── site_preparation (Textarea)
├── planting_timing (Textarea)
├── spacing_requirements (Text)
├── establishment_care (Textarea)
└── common_problems (Textarea)

External Resources Group

Field Group: "External Resources"

authoritative_links (Repeater Field):
├── link_url (URL)
├── link_title (Text)
├── source_type (Select: NZPCN, DOC, Scientific Paper, Other)
└── description (Text)

image_credits (Repeater Field):
├── image (Image)
├── photographer (Text)
├── source (Text)
├── license (Select: CC BY, CC BY-SA, Permission Granted, Copyright)
└── description (Text)

3. User Contributions Structure

DECISION REQUIRED: Contribution Method

Option A: Comments Plus (Simple)

  • Enhanced comment system with custom fields
  • Moderation workflow
  • Basic user profiles

Option B: Separate Post Type (Advanced)

  • Dedicated user experience posts
  • Rich media support
  • Advanced filtering and display

User Experience Posts (if Option B chosen)

Custom Post Type: "user_experiences"

standard_fields:
├── Title: Auto-generated from plant + user + date
├── Content: User's detailed experience
├── Author: WordPress user who submitted
└── Parent: Link to plant species post

custom_fields:
├── plant_species (Post Object: Required link to plant)
├── experience_type (Select: Seed Collection, Germination, Growing, Planting, General)
├── success_rating (Select: 1-5 stars)
├── location (Text: General region/area)
├── timing (Date: When experience occurred)
├── method_used (Textarea: Specific technique used)
├── results (Textarea: What happened)
├── photos (Gallery: Progress photos)
├── would_repeat (Select: Yes, No, With Modifications)
├── tips_for_others (Textarea: Advice for future growers)
└── verification_status (Select: Pending, Verified, Expert Reviewed)

4. Search and Filter Support

Search Configuration

Searchable Fields:
├── Scientific name (exact and partial matches)
├── Common names (all variations)
├── Content description
├── Physical characteristics
├── Growing condition notes
└── Propagation information

Filter Categories:
├── Plant type (taxonomy)
├── Growth habit (taxonomy)
├── Suitable regions (taxonomy)
├── Light requirements (custom field)
├── Soil preferences (custom field)
├── Frost tolerance (custom field)
├── Propagation difficulty (calculated from user experiences)
└── Information completeness (calculated field)

DECISION REQUIRED: Advanced Features

Success Rate Tracking

Should the system calculate and display success rates for propagation methods based on user reports?

If Yes:

  • Automated calculations from user experience data
  • Display confidence levels based on number of reports
  • Regional variation in success rates

If No:

  • Simple qualitative descriptions only
  • Focus on individual experience sharing

Regional Customization

Should growing advice be customized by user location?

If Yes:

  • User location detection/selection
  • Region-specific growing calendars
  • Local climate integration

If No:

  • General New Zealand-wide advice
  • Users interpret for their conditions

API Design for Future Mobile Apps

REST API Endpoints

GET /wp-json/grownative/v1/plants/
├── Returns: List of all plants with basic info
├── Parameters: type, region, light, difficulty
└── Response: Paginated plant list

GET /wp-json/grownative/v1/plants/{id}
├── Returns: Complete plant information
├── Includes: All custom fields, images, user experiences
└── Response: Full plant object

GET /wp-json/grownative/v1/plants/search?q={query}
├── Returns: Search results
├── Searches: Names, descriptions, characteristics
└── Response: Ranked results

GET /wp-json/grownative/v1/experiences/
├── Returns: User experiences
├── Parameters: plant_id, experience_type, location
└── Response: Experience list with ratings

POST /wp-json/grownative/v1/experiences/
├── Creates: New user experience
├── Requires: Authentication
└── Response: Created experience object

Mobile App Data Structure

{
  "plant": {
    "id": 123,
    "scientific_name": "Piper excelsum", 
    "common_names": [
      {"name": "Kawakawa", "language": "English"},
      {"name": "Kawakawa", "language": "Māori"}
    ],
    "basic_info": {...},
    "growing_conditions": {...},
    "propagation": {...},
    "images": [...],
    "user_experiences": [...],
    "success_rate": {
      "overall": 3.8,
      "by_method": {...},
      "by_region": {...}
    }
  }
}

Data Migration and Population

DECISION REQUIRED: Initial Content Strategy

Manual Entry Only:

  • Start with current placeholder content
  • Build through community contributions
  • Slow but high-quality start

Automated Research + Manual Review:

  • Claude researches basic plant information
  • Populate 50-100 species with foundation data
  • Community adds propagation experiences
  • Faster launch with good coverage

Hybrid Approach:

  • Automated basic info for common species
  • Manual entry for specialized propagation knowledge
  • Prioritized list of most important species

Content Sources for Automation

Authoritative Sources:
├── New Zealand Plant Conservation Network (NZPCN)
├── Department of Conservation (DOC) 
├── iNaturalist observations
├── Manaaki Whenua (Landcare Research)
├── Regional council plant guides
└── University botanical databases

Information Types:
├── Scientific classification ✓
├── Physical descriptions ✓
├── Natural habitat ✓
├── Conservation status ✓
├── General growing conditions ✓
├── Propagation methods ❌ (community needed)
├── Success rates ❌ (community needed)
└── Regional tips ❌ (community needed)

Next Steps:

  1. Make structural decisions marked above
  2. Finalize custom field requirements
  3. Create ACF field group configurations
  4. Plan content migration strategy
  5. Design user contribution workflows

Document Status: Draft for Review Database Design Review Required: Yes