refactor: remove routine_role, recommended_frequency, evidence_level, cumulative_with

Drop fields identified as redundant or low-value from the Product model,
API schemas, frontend types, and forms. Raise effect_profile threshold in
to_llm_context() from >0 to >=2 to suppress noise values. Remove sku/barcode
from LLM context output (kept on model for catalog use).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Piotr Oleszczyk 2026-02-27 10:22:59 +01:00
parent 9bf94a979c
commit 9a069508af
9 changed files with 464 additions and 142 deletions

View file

@ -53,7 +53,6 @@ def product_data():
"name": "CeraVe Moisturising Cream",
"brand": "CeraVe",
"category": "moisturizer",
"routine_role": "seal",
"recommended_time": "both",
"leave_on": True,
}

View file

@ -9,7 +9,6 @@ from innercontext.models.enums import (
IngredientFunction,
InteractionScope,
ProductCategory,
RoutineRole,
)
from innercontext.models.product import (
ActiveIngredient,
@ -25,7 +24,6 @@ def _make(**kwargs):
name="Test",
brand="B",
category=ProductCategory.MOISTURIZER,
routine_role=RoutineRole.SEAL,
recommended_time=DayTime.BOTH,
leave_on=True,
)
@ -41,7 +39,7 @@ def _make(**kwargs):
def test_always_present_keys():
p = _make()
ctx = p.to_llm_context()
for key in ("id", "name", "brand", "category", "routine_role", "recommended_time", "leave_on"):
for key in ("id", "name", "brand", "category", "recommended_time", "leave_on"):
assert key in ctx, f"Expected '{key}' in to_llm_context() output"
@ -53,17 +51,17 @@ def test_always_present_keys():
def test_optional_string_fields_absent_when_none():
p = _make()
ctx = p.to_llm_context()
for key in ("line_name", "sku", "url", "barcode"):
for key in ("line_name", "url"):
assert key not in ctx, f"'{key}' should not appear when None"
def test_optional_string_fields_present_when_set():
p = _make(line_name="Hydrating", sku="CV-001", url="https://example.com", barcode="123456")
p = _make(line_name="Hydrating", url="https://example.com")
ctx = p.to_llm_context()
assert ctx["line_name"] == "Hydrating"
assert ctx["sku"] == "CV-001"
assert ctx["url"] == "https://example.com"
assert ctx["barcode"] == "123456"
assert "sku" not in ctx
assert "barcode" not in ctx
# ---------------------------------------------------------------------------

View file

@ -52,7 +52,6 @@ def test_list_filter_category(client, client_and_data=None):
# Create a moisturizer and a serum
base = {
"brand": "B",
"routine_role": "seal",
"recommended_time": "both",
"leave_on": True,
}
@ -72,7 +71,6 @@ def test_list_filter_category(client, client_and_data=None):
def test_list_filter_brand(client):
base = {
"routine_role": "seal",
"recommended_time": "both",
"leave_on": True,
"category": "serum",
@ -90,7 +88,6 @@ def test_list_filter_brand(client):
def test_list_filter_is_medication(client):
base = {
"brand": "B",
"routine_role": "seal",
"recommended_time": "both",
"leave_on": True,
"category": "serum",
@ -113,7 +110,6 @@ def test_list_filter_is_medication(client):
def test_list_filter_targets(client):
base = {
"brand": "B",
"routine_role": "seal",
"recommended_time": "both",
"leave_on": True,
"category": "serum",