CREATE VIEW ai_ctxe_uniform_resource_frontmatter_view_anythingllm AS
SELECT
uniform_resource_id,
uri,
-- Extracting only important keys from the frontmatter column
json_extract(frontmatter, '$.id') AS frontmatter_id,
json_extract(frontmatter, '$.title') AS title,
json_extract(frontmatter, '$.summary') AS frontmatter_summary,
json_extract(frontmatter, '$.merge-group') AS frontmatter_merge_group,
json_extract(frontmatter, '$.artifact-nature') AS frontmatter_artifact_nature,
json_extract(frontmatter, '$.lifecycle') AS frontmatter_lifecycle,
json_extract(frontmatter, '$.visibility') AS frontmatter_visibility,
json_extract(frontmatter, '$.audience') AS frontmatter_audience,
json_extract(frontmatter, '$.function') AS frontmatter_function,
json_extract(frontmatter, '$.product.name') AS frontmatter_product_name,
-- Extracting features dynamically (up to the first 5 features)
trim(
json_extract(frontmatter, '$.product.features[0]') || ',' ||
json_extract(frontmatter, '$.product.features[1]') || ',' ||
json_extract(frontmatter, '$.product.features[2]') || ',' ||
json_extract(frontmatter, '$.product.features[3]') || ',' ||
json_extract(frontmatter, '$.product.features[4]')
) AS frontmatter_product_features,
json_extract(frontmatter, '$.provenance.source-uri') AS frontmatter_provenance_source_uri,
json_extract(frontmatter, '$.provenance.dependencies') AS frontmatter_provenance_dependencies,
-- Extracting reviewers dynamically (up to the first 5 reviewers)
trim(
json_extract(frontmatter, '$.provenance.reviewers[0]') || ',' ||
json_extract(frontmatter, '$.provenance.reviewers[1]')
) AS frontmatter_reviewers
FROM uniform_resource_build_anythingllm