refactor(products): remove usage notes and contraindications fields
This commit is contained in:
parent
9df241a6a9
commit
013492ec2b
16 changed files with 54 additions and 179 deletions
|
|
@ -95,14 +95,12 @@ def test_list_filter_is_medication(client):
|
|||
"category": "serum",
|
||||
}
|
||||
client.post("/products", json={**base, "name": "Normal", "is_medication": False})
|
||||
# is_medication=True requires usage_notes (model validator)
|
||||
client.post(
|
||||
"/products",
|
||||
json={
|
||||
**base,
|
||||
"name": "Med",
|
||||
"is_medication": True,
|
||||
"usage_notes": "Apply pea-sized amount",
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ from innercontext.api.products import (
|
|||
_build_inci_tool_handler,
|
||||
_build_safety_rules_tool_handler,
|
||||
_build_shopping_context,
|
||||
_build_usage_notes_tool_handler,
|
||||
_extract_requested_product_ids,
|
||||
)
|
||||
from innercontext.models import Product, ProductInventory, SkinConditionSnapshot
|
||||
|
|
@ -96,7 +95,6 @@ def test_suggest_shopping(client, session):
|
|||
assert "get_product_inci" in kwargs["function_handlers"]
|
||||
assert "get_product_safety_rules" in kwargs["function_handlers"]
|
||||
assert "get_product_actives" in kwargs["function_handlers"]
|
||||
assert "get_product_usage_notes" in kwargs["function_handlers"]
|
||||
|
||||
|
||||
def test_shopping_context_medication_skip(session: Session):
|
||||
|
|
@ -133,7 +131,6 @@ def test_shopping_tool_handlers_return_payloads(session: Session):
|
|||
category="serum",
|
||||
recommended_time="both",
|
||||
leave_on=True,
|
||||
usage_notes="Use AM and PM on clean skin.",
|
||||
inci=["Water", "Niacinamide"],
|
||||
actives=[{"name": "Niacinamide", "percent": 5, "functions": ["niacinamide"]}],
|
||||
context_rules={"safe_after_shaving": True},
|
||||
|
|
@ -148,8 +145,5 @@ def test_shopping_tool_handlers_return_payloads(session: Session):
|
|||
actives_data = _build_actives_tool_handler([product])(payload)
|
||||
assert actives_data["products"][0]["actives"][0]["name"] == "Niacinamide"
|
||||
|
||||
notes_data = _build_usage_notes_tool_handler([product])(payload)
|
||||
assert notes_data["products"][0]["usage_notes"] == "Use AM and PM on clean skin."
|
||||
|
||||
safety_data = _build_safety_rules_tool_handler([product])(payload)
|
||||
assert "context_rules" in safety_data["products"][0]
|
||||
|
|
|
|||
|
|
@ -252,7 +252,6 @@ def test_suggest_routine(client, session):
|
|||
assert "get_product_inci" in kwargs["function_handlers"]
|
||||
assert "get_product_safety_rules" in kwargs["function_handlers"]
|
||||
assert "get_product_actives" in kwargs["function_handlers"]
|
||||
assert "get_product_usage_notes" in kwargs["function_handlers"]
|
||||
|
||||
|
||||
def test_suggest_batch(client, session):
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ from innercontext.api.routines import (
|
|||
_build_recent_history,
|
||||
_build_safety_rules_tool_handler,
|
||||
_build_skin_context,
|
||||
_build_usage_notes_tool_handler,
|
||||
_contains_minoxidil_text,
|
||||
_ev,
|
||||
_extract_active_names,
|
||||
|
|
@ -56,10 +55,6 @@ def test_is_minoxidil_product():
|
|||
assert _is_minoxidil_product(p) is True
|
||||
|
||||
p.line_name = None
|
||||
p.usage_notes = "Use minoxidil daily"
|
||||
assert _is_minoxidil_product(p) is True
|
||||
|
||||
p.usage_notes = None
|
||||
p.inci = ["water", "minoxidil"]
|
||||
assert _is_minoxidil_product(p) is True
|
||||
|
||||
|
|
@ -386,7 +381,6 @@ def test_additional_tool_handlers_return_product_payloads(session: Session):
|
|||
brand="Test",
|
||||
recommended_time="both",
|
||||
leave_on=True,
|
||||
usage_notes="Apply morning and evening.",
|
||||
actives=[{"name": "Niacinamide", "percent": 5, "functions": ["niacinamide"]}],
|
||||
context_rules={"safe_after_shaving": True},
|
||||
product_effect_profile={},
|
||||
|
|
@ -397,8 +391,5 @@ def test_additional_tool_handlers_return_product_payloads(session: Session):
|
|||
actives_out = _build_actives_tool_handler([p])(ids_payload)
|
||||
assert actives_out["products"][0]["actives"][0]["name"] == "Niacinamide"
|
||||
|
||||
notes_out = _build_usage_notes_tool_handler([p])(ids_payload)
|
||||
assert notes_out["products"][0]["usage_notes"] == "Apply morning and evening."
|
||||
|
||||
safety_out = _build_safety_rules_tool_handler([p])(ids_payload)
|
||||
assert "context_rules" in safety_out["products"][0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue