From 52a8855bf6f7bf79969f90a78cc0c83c378b8007 Mon Sep 17 00:00:00 2001 From: ShivaniKhaire Date: Wed, 4 Nov 2026 12:34:52 +0530 Subject: [PATCH] feat(nutrition): add categories list and template to root catalog - Add Categories (m0031_ct0003) and Food Items (m0031_ct0002) to data/list.json - Add data/categories.json with 14 food categories and item counts - Update m0031_ct0001.json template with content_count and content_label - Update m0031_ct0003.json template for nutrition categories collection - Update module.json default_template_code to m0031_ct0001 --- m0031-nutrition/data/categories.json | 117 ++++++++++++++++++++ m0031-nutrition/data/list.json | 10 +- m0031-nutrition/module.json | 10 +- m0031-nutrition/templates/m0031_ct0001.json | 28 +++++ m0031-nutrition/templates/m0031_ct0003.json | 50 +++++++-- 5 files changed, 196 insertions(+), 19 deletions(-) create mode 100644 m0031-nutrition/data/categories.json diff --git a/m0031-nutrition/data/categories.json b/m0031-nutrition/data/categories.json new file mode 100644 index 0000000..a317b94 --- /dev/null +++ b/m0031-nutrition/data/categories.json @@ -0,0 +1,117 @@ +{ + "contents": [ + { + "source_id": "1", + "name": "Beverages", + "code": "beverages", + "content_count": 14, + "content_label": "items", + "sort_order": 1 + }, + { + "source_id": "2", + "name": "Common Supplements", + "code": "common_supplements", + "content_count": 3, + "content_label": "items", + "sort_order": 2 + }, + { + "source_id": "3", + "name": "Condiments", + "code": "condiments", + "content_count": 14, + "content_label": "items", + "sort_order": 3 + }, + { + "source_id": "4", + "name": "Culinary Herbs/Spices", + "code": "culinary_herbs_spices", + "content_count": 40, + "content_label": "items", + "sort_order": 4 + }, + { + "source_id": "5", + "name": "Dairy", + "code": "dairy", + "content_count": 20, + "content_label": "items", + "sort_order": 5 + }, + { + "source_id": "6", + "name": "Fish", + "code": "fish", + "content_count": 26, + "content_label": "items", + "sort_order": 6 + }, + { + "source_id": "7", + "name": "Fruit", + "code": "fruit", + "content_count": 48, + "content_label": "items", + "sort_order": 7 + }, + { + "source_id": "8", + "name": "Grains", + "code": "grains", + "content_count": 17, + "content_label": "items", + "sort_order": 8 + }, + { + "source_id": "9", + "name": "Legumes", + "code": "legumes", + "content_count": 21, + "content_label": "items", + "sort_order": 9 + }, + { + "source_id": "10", + "name": "Meat", + "code": "meat", + "content_count": 24, + "content_label": "items", + "sort_order": 10 + }, + { + "source_id": "11", + "name": "Medicinal Herbs/Spices", + "code": "medicinal_herbs_spices", + "content_count": 122, + "content_label": "items", + "sort_order": 11 + }, + { + "source_id": "12", + "name": "Nuts, Seeds", + "code": "nuts_seeds", + "content_count": 18, + "content_label": "items", + "sort_order": 12 + }, + { + "source_id": "13", + "name": "Oils, Fats", + "code": "oils_fats", + "content_count": 12, + "content_label": "items", + "sort_order": 13 + }, + { + "source_id": "14", + "name": "Vegetables", + "code": "vegetables", + "content_count": 62, + "content_label": "items", + "sort_order": 14 + } + ] +} + diff --git a/m0031-nutrition/data/list.json b/m0031-nutrition/data/list.json index 2f1625d..25a6c88 100644 --- a/m0031-nutrition/data/list.json +++ b/m0031-nutrition/data/list.json @@ -3,6 +3,8 @@ { "name": "Food Items", "sort_order": 0, + "content_count": 441, + "content_label": "items", "link": { "type": "template_ref", "label": "Food Items", @@ -14,17 +16,19 @@ "code": "food_items" }, { - "name": "Effects", + "name": "Categories", "sort_order": 1, + "content_count": 14, + "content_label": "categories", "link": { "type": "template_ref", - "label": "Effects", + "label": "Categories", "target": { "module_code": "m0031", "template_code": "m0031_ct0003" } }, - "code": "effects" + "code": "categories" } ] } diff --git a/m0031-nutrition/module.json b/m0031-nutrition/module.json index 44eae2a..0adbe74 100644 --- a/m0031-nutrition/module.json +++ b/m0031-nutrition/module.json @@ -3,12 +3,12 @@ "description": "Traditional Chinese dietary therapy, food thermal energetics (cold, cool, neutral, warm, hot), and therapeutic effects.", "short_description": "TCM dietary therapy and food thermal energetics.", "code": "m0031", - "default_template_code": "m0031_ct0002", + "default_template_code": "m0031_ct0001", "kind": "nutrition", "metadata": { "version": 1, - "status": "draft", - "entry_template_code": "m0031_ct0002" + "status": "active", + "entry_template_code": "m0031_ct0001" }, "content_mapping": [ { @@ -26,10 +26,10 @@ "template_path": "templates/m0031_ct0002.json" }, { - "name": "Effects List", + "name": "Categories", "code": "m0031_ct0003", "content_kind": "nutrition", - "data_path": "data/effects_master.json", + "data_path": "data/categories.json", "template_path": "templates/m0031_ct0003.json" } ] diff --git a/m0031-nutrition/templates/m0031_ct0001.json b/m0031-nutrition/templates/m0031_ct0001.json index 258147a..847af85 100644 --- a/m0031-nutrition/templates/m0031_ct0001.json +++ b/m0031-nutrition/templates/m0031_ct0001.json @@ -36,6 +36,22 @@ "definition_kind": "scalar", "is_multivalue": false }, + { + "name": "Content Count", + "code": "content_count", + "data_type": "number", + "default": 0, + "definition_kind": "scalar", + "is_multivalue": false + }, + { + "name": "Content Label", + "code": "content_label", + "data_type": "text", + "default": "", + "definition_kind": "scalar", + "is_multivalue": false + }, { "name": "Content Link", "code": "link", @@ -232,6 +248,18 @@ "empty_behavior": "hide", "visibility": "hide" }, + { + "attribute_key": "m0031_ct0001.content_count", + "empty_behavior": "hide", + "visibility": "show", + "display_order": 0 + }, + { + "attribute_key": "m0031_ct0001.content_label", + "empty_behavior": "hide", + "visibility": "show", + "display_order": 0 + }, { "attribute_key": "m0031_ct0001.code", "empty_behavior": "hide", diff --git a/m0031-nutrition/templates/m0031_ct0003.json b/m0031-nutrition/templates/m0031_ct0003.json index 3977bcb..e08572d 100644 --- a/m0031-nutrition/templates/m0031_ct0003.json +++ b/m0031-nutrition/templates/m0031_ct0003.json @@ -1,12 +1,12 @@ { - "name": "nutrition_effect_content", + "name": "nutrition_category_content", "code": "m0031_ct0003", - "description": "", + "description": "Nutrition categories classification", "content_kind": "nutrition", - "is_searchable": false, - "is_filterable": false, + "is_searchable": true, + "is_filterable": true, "attribute_prefix_code": "m0031_ct0003", - "attribute_prefix_name": "nutrition_effect", + "attribute_prefix_name": "nutrition_category", "attribute_defs": [ { "name": "Source ID", @@ -28,8 +28,8 @@ "is_searchable": true }, { - "name": "Effect Name", - "code": "effect_name", + "name": "Name", + "code": "name", "data_type": "text", "default": "", "definition_kind": "scalar", @@ -38,6 +38,22 @@ "is_filterable": true, "is_searchable": true }, + { + "name": "Content Count", + "code": "content_count", + "data_type": "number", + "default": 0, + "definition_kind": "scalar", + "is_multivalue": false + }, + { + "name": "Content Label", + "code": "content_label", + "data_type": "text", + "default": "items", + "definition_kind": "scalar", + "is_multivalue": false + }, { "name": "Sort Order", "code": "sort_order", @@ -54,9 +70,9 @@ "is_active": true, "mode": "collection", "renderers": { - "collection": "nutrition_effect_collection", - "collection_item": "nutrition_effect_card", - "detail": "nutrition_effect_detail" + "collection": "nutrition_category_collection", + "collection_item": "nutrition_category_card", + "detail": "nutrition_category_detail" }, "link": { "renderer": "content_link" @@ -73,7 +89,19 @@ "visibility": "hide" }, { - "attribute_key": "m0031_ct0003.effect_name", + "attribute_key": "m0031_ct0003.name", + "empty_behavior": "hide", + "visibility": "show", + "display_order": 10 + }, + { + "attribute_key": "m0031_ct0003.content_count", + "empty_behavior": "hide", + "visibility": "show", + "display_order": 0 + }, + { + "attribute_key": "m0031_ct0003.content_label", "empty_behavior": "hide", "visibility": "show", "display_order": 0