Skip to main content

Sequence Method Engine — core validators, regression diff_report, and ingestion-pipeline base classes. Consumed by Scriptura SaaS and any other SME wrapper.

Project description

sme-core

Sequence Method Engine — core validators, regression diff_report, and ingestion-pipeline base classes.

sme-core is the Python runtime library for the Sequence Method Engine (SME). It packages canonical JSON schemas, schema validation, the §7.2.6 regression diff_report, and the abstract ingestion pipeline base used by P1 (PubMed), P2 (FDA), P3 (DEA), P4 (503A bulks), and future wrapper-defined pipelines.

Companion package: @scripturahealth/sme-schemas ships the same schemas as TypeScript types for the Scriptura SaaS frontend.

Install

pip install sme-core

Requires Python ≥ 3.10.

Usage

Validate a document

from sme_core import SchemaValidator

v = SchemaValidator()
errors = v.validate(my_compound_dict, schema_name="compound")
if errors:
    for e in errors:
        print(".".join(str(p) for p in e.absolute_path), "→", e.message)

Regression diff_report

from sme_core import generate_diff_report

report = generate_diff_report(
    baseline_protocol_json=old,
    new_protocol_json=new,
    baseline_id="2025-12-14-sabrina-v2.3",
    baseline_generated_at="2025-12-14T18:32:00Z",
)
print(report.drift_verdict)              # no_clinical_drift | clinical_drift_detected
print(report.requires_eric_approval_before_ship)

Build an ingestion pipeline

from sme_core import IngestionPipeline, RegulatoryRecord, ReviewQueueItem

class PubMedPipeline(IngestionPipeline):
    name = "p1_pubmed"

    def fetch(self, since):
        # call PubMed E-utilities, return raw items
        ...

    def transform(self, raw_items):
        records = [...]       # list[RegulatoryRecord]
        review_items = [...]  # list[ReviewQueueItem]
        return records, review_items

p = PubMedPipeline(
    cursor_loader=lambda: db.get_cursor("p1_pubmed"),
    cursor_saver=lambda v: db.set_cursor("p1_pubmed", v),
    record_sink=db.append_regulatory_records,
    review_queue_sink=webhook_to_wrapper,
)
result = p.run()

CLI tools

sme-validate path/to/doc.json --schema compound
sme-diff-report baseline.json new.json

sme-diff-report exits 1 when clinical drift is detected — designed for CI gating.

Versioning

The package version tracks the SME schema_version. Tagging the repo v1.1.0 publishes both sme-core==1.1.0 and @scripturahealth/sme-schemas@1.1.0.

License

UNLICENSED — internal Scriptura Health distribution.

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

sme_core-2.0.0.tar.gz (267.5 kB view details)

Uploaded Source

Built Distribution

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

sme_core-2.0.0-py3-none-any.whl (241.1 kB view details)

Uploaded Python 3

File details

Details for the file sme_core-2.0.0.tar.gz.

File metadata

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

File hashes

Hashes for sme_core-2.0.0.tar.gz
Algorithm Hash digest
SHA256 f61ecd92dcd11b7ab55c1827a9a41469c681c6f64431f1f8af680ebb875a4509
MD5 b7b29064965efcaa88b8edae1e2a5ba3
BLAKE2b-256 fd167d992eb5867d2981249a2947681ffd529022c9a9daa2bd06c594e2b0f33e

See more details on using hashes here.

Provenance

The following attestation bundles were made for sme_core-2.0.0.tar.gz:

Publisher: ci.yml on Scripturahealth/sequence-method-engine

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

File details

Details for the file sme_core-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: sme_core-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 241.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sme_core-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46f3dd09ecb5ff9c48f106816ea1ef038ebb81d31fe7e0790ad43614fbd2ddde
MD5 358499038960753bfbd26dbf1b29489f
BLAKE2b-256 16a911c9ac39d2400aa7a09acf05e348831dd1841a2af619732d3b5947336535

See more details on using hashes here.

Provenance

The following attestation bundles were made for sme_core-2.0.0-py3-none-any.whl:

Publisher: ci.yml on Scripturahealth/sequence-method-engine

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