pub struct FactorKnowledge {
pub key: String,
pub kind: FactorKind,
pub label: String,
pub targets: Vec<KnowledgeTarget>,
pub provenance: Provenance,
pub version: u32,
pub content_hash: String,
}Expand description
A reusable, provenance-tagged, versioned knowledge template for one named factor.
Fields§
§key: StringStable lookup key, e.g. "cond:hypertension", "herb:milk-thistle", "food:beer".
kind: FactorKind§label: String§targets: Vec<KnowledgeTarget>§provenance: Provenance§version: u32§content_hash: StringSHA-256 (hex) over the canonical fields above — set by FactorKnowledge::sealed.
Implementations§
Source§impl FactorKnowledge
impl FactorKnowledge
Sourcepub fn new(
key: impl Into<String>,
kind: FactorKind,
label: impl Into<String>,
provenance: Provenance,
) -> Self
pub fn new( key: impl Into<String>, kind: FactorKind, label: impl Into<String>, provenance: Provenance, ) -> Self
Creates a new instance.
Sourcepub fn targeting(
self,
system_id: impl Into<String>,
effect: Effect,
evidence: EvidenceTier,
weight_milli: u32,
kinetics: Kinetics,
) -> Self
pub fn targeting( self, system_id: impl Into<String>, effect: Effect, evidence: EvidenceTier, weight_milli: u32, kinetics: Kinetics, ) -> Self
Entries targeting a node.
Sourcepub fn compute_content_hash(&self) -> String
pub fn compute_content_hash(&self) -> String
Compute the content hash over the canonical fields (excludes content_hash itself).
Sourcepub fn sealed(self) -> Self
pub fn sealed(self) -> Self
Finalize the entry by stamping its content hash. Call after building the targets.
Sourcepub fn integrity_ok(&self) -> bool
pub fn integrity_ok(&self) -> bool
Whether the stamped content_hash matches the current fields (integrity check).
Sourcepub fn to_factor(&self, instance_id: impl Into<String>) -> Factor
pub fn to_factor(&self, instance_id: impl Into<String>) -> Factor
Instantiate a non-temporal Factor for a specific occurrence (instance_id).
Sourcepub fn to_event(
&self,
instance_id: impl Into<String>,
at_minute: i64,
dose_scale_pct: u32,
) -> FactorEvent
pub fn to_event( &self, instance_id: impl Into<String>, at_minute: i64, dose_scale_pct: u32, ) -> FactorEvent
Instantiate a temporal FactorEvent at at_minute with a dose scaler, wiring each target’s
knowledge kinetics onto the event so different systems clear on their own clocks.