Skip to main content

Collect, contextualize, and structure raw system signals into governance-relevant evidence units

Project description

Evidence Collector SDK

CI DOI License: Apache-2.0 Python 3.11+ pre-commit enabled

Collect, contextualize, and structure raw system signals into governance-relevant evidence units. Transforms operational telemetry into Decision Event Schema events enriched with provenance, attribution, and temporal metadata.

Install

From a Package Index

Use this when the package is published to your package index:

pip install evidence-collector-sdk

From GitHub

Use this before package-index publication, or when installing directly from source control:

pip install git+https://github.com/governance-evidence/evidence-collector-sdk.git

Validation support is included in the base installation.

For Contributors

Clone the repository, create a local virtual environment, and install development dependencies:

python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Quick start

from datetime import UTC, datetime

from collector import EvidenceCollector, RawSignal, SignalType, fraud_detection_config

collector = EvidenceCollector(config=fraud_detection_config())

collector.add(RawSignal(
    signal_id="txn-001",
    signal_type=SignalType.EVENT,
    payload={"score": 0.87, "amount": 1500.0, "merchant_category": "electronics"},
    source="fraud-scoring-model-v3",
    timestamp=datetime.now(tz=UTC),
))

events = collector.flush()  # list of Decision Event Schema dicts

Validation state for the last collector operation is available via collector.validation_errors.

Single signal

event = collector.collect_one(signal)  # transform + serialize + validation state update

Validation strategy

from collector import EvidenceCollector, ValidationMode

collector = EvidenceCollector(
    config=fraud_detection_config(),
    validation_mode=ValidationMode.PROVENANCE,
)

Streaming (Governance Drift Toolkit compatible)

from collector import EvidenceCollectorStream, OverflowStrategy

stream = EvidenceCollectorStream(
    fraud_detection_config(),
    max_buffer_size=10_000,
    overflow_strategy=OverflowStrategy.DROP_OLDEST,
)
stream.push(signal)
batch = stream.read_batch(batch_size=100)  # Decision Event Schema dicts for Governance Drift Toolkit

For a stable observability snapshot, use stream.stats.

stats = stream.stats
# StreamStats(queued_count=..., in_flight_count=..., buffer_size=..., ...)

Scalar properties remain available via queued_count, in_flight_count, buffer_size, processed_count, failed_batch_count, and dropped_count.

Stream writer lifecycle

from collector import JsonlStreamWriter

with JsonlStreamWriter(output_path) as writer:
    writer.write_batch(events)

Validation

from collector import validate_complete

errors = validate_complete(event, config=fraud_detection_config())

Capabilities (Governance Drift Toolkit negotiation)

caps = collector.capabilities
# StreamCapabilities(supported_signal_types=..., schema_version='0.3.0', ...)

Development

make install    # install with dev deps
make check      # lint + typecheck + test
make format     # auto-fix formatting

Related Projects

This SDK is part of the governance-evidence toolkit:

Repository Role DOI
evidence-collector-sdk Collects and structures governance-relevant evidence from raw signals 10.5281/zenodo.19245405
decision-event-schema Schema that this SDK outputs events in 10.5281/zenodo.18923178
evidence-sufficiency-calc Scores the evidence events this SDK collects Pending
governance-drift-toolkit Monitors drift using events from this SDK Pending

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evidence_collector_sdk-0.1.0.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evidence_collector_sdk-0.1.0-py3-none-any.whl (37.8 kB view details)

Uploaded Python 3

File details

Details for the file evidence_collector_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: evidence_collector_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for evidence_collector_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0f5f89cabf843e2774792e87149ee05d5b3c909b63e88f843fb31a51c3828c94
MD5 3ad6cfdf04d6d73525c94a46787db9d1
BLAKE2b-256 9a41d9593045b8df2151da9ddb42642b247e1faf7a3bfad856092c7ba4e8df1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for evidence_collector_sdk-0.1.0.tar.gz:

Publisher: release.yml on governance-evidence/evidence-collector-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file evidence_collector_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for evidence_collector_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14b22125ea6967880a618888b1e79e9dc042de5995a2e61bba12cbb8bc48c5bf
MD5 9f36a48040c54412a1837886e52f2dd8
BLAKE2b-256 e3f3ef1b27d0c90d8430767f2d56f8c09cfcf984d71e39db78ab2a3075c21be7

See more details on using hashes here.

Provenance

The following attestation bundles were made for evidence_collector_sdk-0.1.0-py3-none-any.whl:

Publisher: release.yml on governance-evidence/evidence-collector-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page