feat(evidence): structure v3 domain rules for review
This commit is contained in:
@@ -165,6 +165,50 @@ def test_pipeline_embeds_validated_curated_evidence_as_semantic_fragments(tmp_pa
|
||||
assert vectors.records[0].record.metadata["provenance"]["source_file"] == "source/paziente.md"
|
||||
|
||||
|
||||
def test_pipeline_strips_domain_rule_presentation_before_embedding(tmp_path):
|
||||
rule = (
|
||||
"Il dominio Ablazione descrive la procedura; indicazioni principali: fibrillazione "
|
||||
"atriale; appartiene all'universo procedurale. Fact centrale: clinical.fact_ablazione."
|
||||
)
|
||||
evidence = CuratedEvidence.model_validate(
|
||||
{
|
||||
"schema_version": 3,
|
||||
"id": "evidence:dominio-ablazione",
|
||||
"title": "Dominio Ablazione",
|
||||
"kind": "domain",
|
||||
"purposes": ["disambiguation"],
|
||||
"language": "it",
|
||||
"provenance": {
|
||||
"source_file": "source/ablazione.md",
|
||||
"source_sha256": "sha256:" + "a" * 64,
|
||||
"supporting_excerpts": ["Il dominio Ablazione descrive la procedura."],
|
||||
},
|
||||
"payload": {"rule": rule},
|
||||
}
|
||||
)
|
||||
source_item = SourceObject(
|
||||
source_id="fs:curated-domain",
|
||||
uri="file:///safe/curated/domain/dominio-ablazione.md",
|
||||
fingerprint="sha256:" + "b" * 64,
|
||||
metadata={"relative_path": "curated/domain/dominio-ablazione.md"},
|
||||
)
|
||||
embedder = Embedder()
|
||||
|
||||
result = pipeline(
|
||||
tmp_path,
|
||||
Source([(source_item, dump_curated_markdown(evidence))]),
|
||||
embedder=embedder,
|
||||
vectors=Vectors(),
|
||||
policy=ChunkPolicy(version="chunk-v1", max_chars=4000),
|
||||
).run()
|
||||
|
||||
embedded = embedder.calls[0]
|
||||
assert result.status == "succeeded"
|
||||
assert f"Regola: {rule}" in embedded
|
||||
assert "tht:raw-rule" not in embedded
|
||||
assert "### Fact centrale:" not in embedded
|
||||
|
||||
|
||||
def test_pipeline_exposes_atomic_content_review_code_when_candidate_is_blocked(tmp_path):
|
||||
evidence = CuratedEvidence.model_validate(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user