v2-exece-docs
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
# IGNY8 Phase 1: Cluster Formation & Keyword Engine (Doc 01C)
|
||||
|
||||
**Document Version:** 1.0
|
||||
> **Version:** 1.1 (codebase-verified)
|
||||
> **Source of Truth:** Codebase at `/data/app/igny8/backend/`
|
||||
> **Last Verified:** 2025-07-14
|
||||
|
||||
**Document Version:** 1.1
|
||||
**Date:** 2026-03-23
|
||||
**Phase:** Phase 1 - Foundation & Intelligence
|
||||
**Status:** Build Ready
|
||||
@@ -48,7 +52,7 @@
|
||||
{"name": "Health Condition", "values": ["Allergies", "Arthritis", "Obesity"]}
|
||||
],
|
||||
"sector_context": {
|
||||
"sector_id": str,
|
||||
"sector_id": int, # FK to igny8_core_auth.Sector (BigAutoField PK)
|
||||
"site_type": "ecommerce|saas|blog|local_service",
|
||||
"sector_name": str
|
||||
},
|
||||
@@ -257,7 +261,7 @@ For each intersection, the AI must answer:
|
||||
}
|
||||
],
|
||||
"sector_context": {
|
||||
"sector_id": str,
|
||||
"sector_id": int, # FK to igny8_core_auth.Sector (BigAutoField PK)
|
||||
"site_type": "ecommerce|saas|blog|local_service",
|
||||
"site_intent": "sell|inform|book|download"
|
||||
},
|
||||
@@ -503,7 +507,8 @@ keyword_templates = {
|
||||
#### Input Contract
|
||||
```python
|
||||
assemble_blueprint(
|
||||
site: Website, # from 01A
|
||||
site: Site, # igny8_core_auth.Site (integer PK)
|
||||
sector: Sector, # igny8_core_auth.Sector (integer PK)
|
||||
attributes: List[Tuple[name, values]], # user-populated
|
||||
clusters: List[Dict], # from cluster_formation()
|
||||
keywords: Dict[cluster_id, List[Dict]] # from generate_keywords()
|
||||
@@ -518,7 +523,7 @@ assemble_blueprint(
|
||||
site=site,
|
||||
status='draft',
|
||||
phase='phase_1_foundation',
|
||||
sector_id=site.sector_id,
|
||||
sector=sector,
|
||||
created_by=current_user,
|
||||
metadata={
|
||||
'version': '1.0',
|
||||
@@ -844,7 +849,8 @@ END FUNCTION
|
||||
|
||||
#### SAGBlueprint (existing from 01A, extended)
|
||||
```python
|
||||
class SAGBlueprint(models.Model):
|
||||
# Inherits account, created_at, updated_at from AccountBaseModel
|
||||
class SAGBlueprint(AccountBaseModel):
|
||||
STATUS_CHOICES = (
|
||||
('draft', 'Draft'),
|
||||
('cluster_formation_complete', 'Cluster Formation Complete'),
|
||||
@@ -854,10 +860,10 @@ class SAGBlueprint(models.Model):
|
||||
('published', 'Published'),
|
||||
)
|
||||
|
||||
site = models.ForeignKey(Website, on_delete=models.CASCADE)
|
||||
site = models.ForeignKey('igny8_core_auth.Site', on_delete=models.CASCADE)
|
||||
status = models.CharField(max_length=50, choices=STATUS_CHOICES, default='draft')
|
||||
phase = models.CharField(max_length=50, default='phase_1_foundation')
|
||||
sector_id = models.CharField(max_length=100)
|
||||
sector = models.ForeignKey('igny8_core_auth.Sector', on_delete=models.CASCADE)
|
||||
|
||||
# Denormalized JSON for fast access
|
||||
attributes_json = models.JSONField(default=dict, blank=True)
|
||||
@@ -865,9 +871,8 @@ class SAGBlueprint(models.Model):
|
||||
taxonomy_plan = models.JSONField(default=dict, blank=True)
|
||||
execution_priority = models.JSONField(default=dict, blank=True)
|
||||
|
||||
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
created_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True)
|
||||
# created_at, updated_at inherited from AccountBaseModel
|
||||
|
||||
class Meta:
|
||||
db_table = 'sag_blueprint'
|
||||
@@ -876,13 +881,14 @@ class SAGBlueprint(models.Model):
|
||||
|
||||
#### SAGAttribute (existing from 01A, no changes required)
|
||||
```python
|
||||
class SAGAttribute(models.Model):
|
||||
# Inherits account, created_at, updated_at from AccountBaseModel
|
||||
class SAGAttribute(AccountBaseModel):
|
||||
blueprint = models.ForeignKey(SAGBlueprint, on_delete=models.CASCADE)
|
||||
name = models.CharField(max_length=255)
|
||||
values = models.JSONField() # array of strings
|
||||
is_primary = models.BooleanField(default=False)
|
||||
source = models.CharField(max_length=50) # 'user_input', 'template', 'api'
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
# created_at, updated_at inherited from AccountBaseModel
|
||||
|
||||
class Meta:
|
||||
db_table = 'sag_attribute'
|
||||
@@ -891,7 +897,8 @@ class SAGAttribute(models.Model):
|
||||
|
||||
#### SAGCluster (existing from 01A, extended)
|
||||
```python
|
||||
class SAGCluster(models.Model):
|
||||
# Inherits account, created_at, updated_at from AccountBaseModel
|
||||
class SAGCluster(AccountBaseModel):
|
||||
TYPE_CHOICES = (
|
||||
('product_category', 'Product/Service Category'),
|
||||
('condition_problem', 'Condition/Problem'),
|
||||
@@ -935,8 +942,7 @@ class SAGCluster(models.Model):
|
||||
|
||||
keyword_count = models.IntegerField(default=0)
|
||||
status = models.CharField(max_length=50, choices=STATUS_CHOICES, default='draft')
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
# created_at, updated_at inherited from AccountBaseModel
|
||||
|
||||
class Meta:
|
||||
db_table = 'sag_cluster'
|
||||
@@ -946,7 +952,8 @@ class SAGCluster(models.Model):
|
||||
|
||||
#### SAGKeyword (new)
|
||||
```python
|
||||
class SAGKeyword(models.Model):
|
||||
# Inherits account, created_at, updated_at from AccountBaseModel
|
||||
class SAGKeyword(AccountBaseModel):
|
||||
INTENT_CHOICES = (
|
||||
('informational', 'Informational'),
|
||||
('transactional', 'Transactional'),
|
||||
@@ -987,9 +994,7 @@ class SAGKeyword(models.Model):
|
||||
|
||||
cpc = models.FloatField(null=True, blank=True) # if available from API
|
||||
competition = models.CharField(max_length=50, blank=True) # 'low', 'medium', 'high'
|
||||
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
# created_at, updated_at inherited from AccountBaseModel
|
||||
|
||||
class Meta:
|
||||
db_table = 'sag_keyword'
|
||||
@@ -1542,7 +1547,7 @@ populated_attributes = [
|
||||
]
|
||||
|
||||
sector_context = {
|
||||
"sector_id": "pet_health",
|
||||
"sector_id": 1, # integer PK (BigAutoField)
|
||||
"site_type": "ecommerce",
|
||||
"sector_name": "Pet Health Products"
|
||||
}
|
||||
@@ -1563,7 +1568,7 @@ populated_attributes = [
|
||||
]
|
||||
|
||||
sector_context = {
|
||||
"sector_id": "vet_clinic",
|
||||
"sector_id": 2, # integer PK (BigAutoField)
|
||||
"site_type": "local_service",
|
||||
"sector_name": "Veterinary Clinic"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user