Implement Stage 3: Enhance content metadata and validation features
- Added entity metadata fields to the Tasks model, including entity_type, taxonomy, and cluster_role. - Updated CandidateEngine to prioritize content relevance based on cluster mappings. - Introduced metadata completeness scoring in ContentAnalyzer. - Enhanced validation services to check for entity type and mapping completeness. - Updated frontend components to display and validate new metadata fields. - Implemented API endpoints for content validation and metadata persistence. - Migrated existing data to populate new metadata fields for Tasks and Content.
This commit is contained in:
@@ -225,6 +225,38 @@ class PageGenerationService:
|
||||
|
||||
keywords = self._build_keywords_hint(page_blueprint)
|
||||
|
||||
# Stage 3: Map page type to entity_type
|
||||
entity_type_map = {
|
||||
'home': 'page',
|
||||
'about': 'page',
|
||||
'services': 'service',
|
||||
'products': 'product',
|
||||
'blog': 'blog_post',
|
||||
'contact': 'page',
|
||||
'custom': 'page',
|
||||
}
|
||||
entity_type = entity_type_map.get(page_blueprint.type, 'page')
|
||||
|
||||
# Stage 3: Try to find related cluster and taxonomy from blueprint
|
||||
cluster_role = 'hub' # Default
|
||||
taxonomy = None
|
||||
|
||||
# Find cluster link for this blueprint to infer role
|
||||
from igny8_core.business.site_building.models import SiteBlueprintCluster
|
||||
cluster_link = SiteBlueprintCluster.objects.filter(
|
||||
site_blueprint=page_blueprint.site_blueprint
|
||||
).first()
|
||||
if cluster_link:
|
||||
cluster_role = cluster_link.role
|
||||
|
||||
# Find taxonomy if page type suggests it (products/services)
|
||||
if page_blueprint.type in ['products', 'services']:
|
||||
from igny8_core.business.site_building.models import SiteBlueprintTaxonomy
|
||||
taxonomy = SiteBlueprintTaxonomy.objects.filter(
|
||||
site_blueprint=page_blueprint.site_blueprint,
|
||||
taxonomy_type__in=['product_category', 'service_category']
|
||||
).first()
|
||||
|
||||
task = Tasks.objects.create(
|
||||
account=page_blueprint.account,
|
||||
site=page_blueprint.site,
|
||||
@@ -235,6 +267,10 @@ class PageGenerationService:
|
||||
content_structure=self._map_content_structure(page_blueprint.type),
|
||||
content_type='article',
|
||||
status='queued',
|
||||
# Stage 3: Set entity metadata
|
||||
entity_type=entity_type,
|
||||
taxonomy=taxonomy,
|
||||
cluster_role=cluster_role,
|
||||
)
|
||||
|
||||
logger.info(
|
||||
|
||||
Reference in New Issue
Block a user