Smart onboarding: residence home profile + suggestion engine
14 new optional residence fields (heating, cooling, water heater, roof, pool, sprinkler, septic, fireplace, garage, basement, attic, exterior, flooring, landscaping) with JSONB conditions on templates. Suggestion engine scores templates against home profile: string match +0.25, bool +0.3, property type +0.15, universal base 0.3. Graceful degradation from minimal to full profile info. GET /api/tasks/suggestions/?residence_id=X returns ranked templates. 54 template conditions across 44 templates in seed data. 8 suggestion service tests.
This commit is contained in:
18
migrations/019_residence_home_profile.down.sql
Normal file
18
migrations/019_residence_home_profile.down.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- Migration: 019_residence_home_profile (rollback)
|
||||
-- Remove home profile fields from residence
|
||||
|
||||
ALTER TABLE residence_residence
|
||||
DROP COLUMN IF EXISTS heating_type,
|
||||
DROP COLUMN IF EXISTS cooling_type,
|
||||
DROP COLUMN IF EXISTS water_heater_type,
|
||||
DROP COLUMN IF EXISTS roof_type,
|
||||
DROP COLUMN IF EXISTS has_pool,
|
||||
DROP COLUMN IF EXISTS has_sprinkler_system,
|
||||
DROP COLUMN IF EXISTS has_septic,
|
||||
DROP COLUMN IF EXISTS has_fireplace,
|
||||
DROP COLUMN IF EXISTS has_garage,
|
||||
DROP COLUMN IF EXISTS has_basement,
|
||||
DROP COLUMN IF EXISTS has_attic,
|
||||
DROP COLUMN IF EXISTS exterior_type,
|
||||
DROP COLUMN IF EXISTS flooring_primary,
|
||||
DROP COLUMN IF EXISTS landscaping_type;
|
||||
18
migrations/019_residence_home_profile.up.sql
Normal file
18
migrations/019_residence_home_profile.up.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- Migration: 019_residence_home_profile
|
||||
-- Add home profile fields to residence for smart onboarding task suggestions
|
||||
|
||||
ALTER TABLE residence_residence
|
||||
ADD COLUMN IF NOT EXISTS heating_type VARCHAR(50),
|
||||
ADD COLUMN IF NOT EXISTS cooling_type VARCHAR(50),
|
||||
ADD COLUMN IF NOT EXISTS water_heater_type VARCHAR(50),
|
||||
ADD COLUMN IF NOT EXISTS roof_type VARCHAR(50),
|
||||
ADD COLUMN IF NOT EXISTS has_pool BOOLEAN DEFAULT FALSE,
|
||||
ADD COLUMN IF NOT EXISTS has_sprinkler_system BOOLEAN DEFAULT FALSE,
|
||||
ADD COLUMN IF NOT EXISTS has_septic BOOLEAN DEFAULT FALSE,
|
||||
ADD COLUMN IF NOT EXISTS has_fireplace BOOLEAN DEFAULT FALSE,
|
||||
ADD COLUMN IF NOT EXISTS has_garage BOOLEAN DEFAULT FALSE,
|
||||
ADD COLUMN IF NOT EXISTS has_basement BOOLEAN DEFAULT FALSE,
|
||||
ADD COLUMN IF NOT EXISTS has_attic BOOLEAN DEFAULT FALSE,
|
||||
ADD COLUMN IF NOT EXISTS exterior_type VARCHAR(50),
|
||||
ADD COLUMN IF NOT EXISTS flooring_primary VARCHAR(50),
|
||||
ADD COLUMN IF NOT EXISTS landscaping_type VARCHAR(50);
|
||||
4
migrations/020_template_conditions.down.sql
Normal file
4
migrations/020_template_conditions.down.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
-- Migration: 020_template_conditions (rollback)
|
||||
-- Remove conditions column from task templates
|
||||
|
||||
ALTER TABLE task_tasktemplate DROP COLUMN IF EXISTS conditions;
|
||||
4
migrations/020_template_conditions.up.sql
Normal file
4
migrations/020_template_conditions.up.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
-- Migration: 020_template_conditions
|
||||
-- Add conditions column to task templates for residence-aware suggestions
|
||||
|
||||
ALTER TABLE task_tasktemplate ADD COLUMN IF NOT EXISTS conditions JSONB DEFAULT '{}';
|
||||
Reference in New Issue
Block a user