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-1.4.1.tar.gz (40.6 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-1.4.1-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sme_core-1.4.1.tar.gz
Algorithm Hash digest
SHA256 2c8e4963177e24f29d44a6b431bce580767739e347a83115c759016caa0034c4
MD5 ece9546384403e91e9a07785a3b6bbfb
BLAKE2b-256 20ef86e974365ac351b988af97f733b422de2908081ee61636e597dcd6f73b0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sme_core-1.4.1.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-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: sme_core-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 45.4 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-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2da7afba682f08a060a9b56ba8b7e38e81f7110f7303d7d6a1ea239ffbf2395d
MD5 d709b752dd3d5b5a95c025b9a4788d77
BLAKE2b-256 6f8e4bbea932ded0bfc688a94dcf347a633e607899fd7ed4cdc31b43abe59238

See more details on using hashes here.

Provenance

The following attestation bundles were made for sme_core-1.4.1-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