Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions backend/app/five_w1h_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from lineageweave.five_w1h import assemble_five_w1h_slots, slots_payload

from .entity_relationship_ingestion import fetch_post_counterparties
from .post_chat_ingestion import find_linked_post_ids
from .post_summary_ingestion import fetch_persisted_summary

Expand Down Expand Up @@ -42,11 +41,9 @@ async def load_five_w1h_slots(
)
linked_titles = [row["post_title"] for row in rows if can_see_post(row)]

counterparties = await fetch_post_counterparties(conn, post_id)
slots = assemble_five_w1h_slots(
roles=summary.get("roles_and_responsibilities", []),
key_events=summary.get("key_events", []),
counterparties=[row["counterparty_entity_name"] for row in counterparties],
lineage_node_labels=linked_titles,
evidence_claims=[dict(row) for row in evidence_claims],
)
Expand Down
14 changes: 0 additions & 14 deletions lineageweave/five_w1h.py
Comment thread
seonghobae marked this conversation as resolved.
Comment thread
seonghobae marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"who": ("prov_person", "prov_organization", "prov_team", "prov_software_agent"),
"what": ("node_post",),
"when": (),
"where": ("prov_organization",),
"why": (),
"how": (),
}
Expand Down Expand Up @@ -50,7 +49,6 @@ def assemble_five_w1h_slots(
*,
roles: list[dict[str, Any]],
key_events: list[str],
counterparties: list[str] | None = None,
lineage_node_labels: list[str] | None = None,
evidence_claims: list[dict[str, Any]] | None = None,
) -> dict[str, list[dict[str, Any]]]:
Expand All @@ -70,13 +68,6 @@ def assemble_five_w1h_slots(
item = _value(role.get("actor_name"), "post_summary_role", (actor_type,))
if item:
slots["who"].append(item)
affiliation = _value(
role.get("affiliated_organization_name"),
"post_summary_role.affiliated_organization_name",
("prov_organization",),
)
if affiliation:
slots["where"].append(affiliation)

for event in key_events:
item = _value(event, "post_summary_event", _SLOT_LOOKUP_CODES["what"])
Expand All @@ -100,11 +91,6 @@ def assemble_five_w1h_slots(
if item:
slots["what"].append(item)

for name in counterparties or []:
item = _value(name, "post_counterparty_entity", ("prov_organization",))
if item:
slots["where"].append(item)

return {slot: _unique(values) for slot, values in slots.items()}


Expand Down
14 changes: 12 additions & 2 deletions tests/test_five_w1h.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ def test_five_w1h_keeps_persisted_evidence_and_leaves_unsupported_slots_empty()
}
],
key_events=["검사 일정 확정"],
counterparties=["Northwind Labs"],
evidence_claims=[
{
"slot_code": "where",
"value_text": "Assembly Bay 4",
"evidence_text": "Inspection took place in Assembly Bay 4.",
}
],
)

assert [item["text"] for item in slots["who"]] == ["Ada West"]
Expand All @@ -21,7 +27,11 @@ def test_five_w1h_keeps_persisted_evidence_and_leaves_unsupported_slots_empty()
# PROV-O category (prov:generatedAtTime), and must not be shown here
# as if it answered "when did this happen" (see five_w1h.py).
assert slots["when"] == []
assert {item["text"] for item in slots["where"]} == {"Demo Corp", "Northwind Labs"}
assert [item["text"] for item in slots["where"]] == ["Assembly Bay 4"]
assert slots["where"][0]["source"] == "post_summary_five_w1h"
assert slots["where"][0]["evidence_text"] == (
"Inspection took place in Assembly Bay 4."
)
assert slots["why"] == []
assert slots["how"] == []

Expand Down