src.dackar.RCA.doc_extraction.epistemics

Attributes

logger

_DOC_TYPE_TO_CLASS

_FINDING_STATUS_TO_CLASS

_AUTHORITY_LEVEL_TO_CLASS

_DEFAULT_CLASS

Classes

EpistemicAnnotation

Result of one EpistemicClassifier.classify() call.

EpistemicsRoutingConfig

Versioned configuration artifact for the epistemic routing table.

EpistemicClassifier

Applies the four-way epistemic classification to a document record.

Functions

_get(obj, key)

Get a field value from a dict or an object with attribute access.

build_epistemics_manifest_summary(...)

Build the epistemics section of run_manifest.artifacts (Phase A).

Module Contents

src.dackar.RCA.doc_extraction.epistemics.logger[source]
src.dackar.RCA.doc_extraction.epistemics._DOC_TYPE_TO_CLASS: Dict[str, str][source]
src.dackar.RCA.doc_extraction.epistemics._FINDING_STATUS_TO_CLASS: Dict[Tuple[str, str], str][source]
src.dackar.RCA.doc_extraction.epistemics._AUTHORITY_LEVEL_TO_CLASS: Dict[str, str][source]
src.dackar.RCA.doc_extraction.epistemics._DEFAULT_CLASS[source]
class src.dackar.RCA.doc_extraction.epistemics.EpistemicAnnotation[source]

Result of one EpistemicClassifier.classify() call.

epistemic_class: str[source]
classification_resolution_level: str[source]
degraded_classification: bool[source]
policy_version: str[source]
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.

policy_version: str = 'epistemics-v1.0'[source]
doc_type_overrides: Dict[str, str][source]
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)

meta may 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)

  1. finding_status — semantic; not degraded

  2. authority_level — semantic; not degraded

  3. doc_type — syntactic proxy; degraded_classification = True

  4. default — no metadata; degraded_classification = True

config[source]
_doc_type_table[source]
classify(record)[source]

Classify one record and return an EpistemicAnnotation.

record may be: - a dict (Chroma metadata dict) - a DocExtractionRecord - a SemanticMatch - any object with attribute access for the relevant fields

Parameters:

record (Any)

Return type:

EpistemicAnnotation

annotate_record(record)[source]

Classify record in-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]