src.dackar.RCA.doc_extraction.epistemics¶
Attributes¶
Classes¶
Result of one EpistemicClassifier.classify() call. |
|
Versioned configuration artifact for the epistemic routing table. |
|
Applies the four-way epistemic classification to a document record. |
Functions¶
|
Get a field value from a dict or an object with attribute access. |
Build the epistemics section of run_manifest.artifacts (Phase A). |
Module Contents¶
- src.dackar.RCA.doc_extraction.epistemics._FINDING_STATUS_TO_CLASS: Dict[Tuple[str, str], str][source]¶
- class src.dackar.RCA.doc_extraction.epistemics.EpistemicAnnotation[source]¶
Result of one EpistemicClassifier.classify() call.
- class src.dackar.RCA.doc_extraction.epistemics.EpistemicsRoutingConfig[source]¶
Versioned configuration artifact for the epistemic routing table.
policy_version is stamped on run_manifest.pipeline_config and on every EpistemicAnnotation so that routing decisions are reproducible.
The routing tables are embedded in epistemics.py and versioned via policy_version; changing any table entry requires a version bump.
- class src.dackar.RCA.doc_extraction.epistemics.EpistemicClassifier(config=None)[source]¶
Applies the four-way epistemic classification to a document record.
Usage¶
config = EpistemicsRoutingConfig(policy_version=”epistemics-v1.0”) classifier = EpistemicClassifier(config) annotation = classifier.classify(meta)
metamay be a dict (Chroma metadata), a DocExtractionRecord, or a SemanticMatch — any object that exposes the relevant fields via attribute or dict access.Priority chain (§3.3)¶
finding_status — semantic; not degraded
authority_level — semantic; not degraded
doc_type — syntactic proxy; degraded_classification = True
default — no metadata; degraded_classification = True
- classify(record)[source]¶
Classify one record and return an EpistemicAnnotation.
recordmay be: - a dict (Chroma metadata dict) - a DocExtractionRecord - a SemanticMatch - any object with attribute access for the relevant fields- Parameters:
record (Any)
- Return type:
- annotate_record(record)[source]¶
Classify
recordin-place, writing annotation fields back to it.Supports DocExtractionRecord and SemanticMatch (both have the three annotation fields as attributes). No-ops silently on other types.
- Parameters:
record (Any)
- Return type:
None
- _resolve_finding_status(finding_status, doc_type)[source]¶
Look up (finding_status, doc_type) in the routing table.
Tries exact (finding_status, doc_type) first, then (finding_status, “”) as the doc_type-agnostic fallback. Returns None if not found.
- Parameters:
finding_status (str)
doc_type (str)
- Return type:
Optional[str]
- Parameters:
config (Optional[EpistemicsRoutingConfig])
- src.dackar.RCA.doc_extraction.epistemics._get(obj, key)[source]¶
Get a field value from a dict or an object with attribute access.
- Parameters:
obj (Any)
key (str)
- Return type:
Optional[str]
- src.dackar.RCA.doc_extraction.epistemics.build_epistemics_manifest_summary(cross_pattern_evidence, policy_version)[source]¶
Build the epistemics section of run_manifest.artifacts (Phase A).
Counts epistemic_class distribution, degraded_classification counts by doc_type, and classification_resolution_level distribution across all doc extractions visible to the pipeline. Sourced from cross_pattern_evidence all_links provenance when available; otherwise returns a minimal stub.
This function is called by the orchestrator’s _stage_g_finalize_manifest(). It is defined here (not in the orchestrator) so that it can be unit-tested independently without the orchestrator’s heavy kg dependencies.
- Parameters:
cross_pattern_evidence (Optional[Dict[str, Any]])
policy_version (Optional[str])
- Return type:
Dict[str, Any]