OpenIslet

scripts/wetlab_contract.py

One measurement contract for Python ingestion and generated MCP metadata.

script Release v0.8.0 gen-eb955f8266035aba 913 KB · 68 sections

Use this file in any AI chat (paste-only or attachment-capable):

Download as text (.txt) Download section (.txt)

Pinned raw file: https://openislet.org/files/gen-eb955f8266035aba/scripts/wetlab_contract.py · SHA-256: 6bb3955530f8f05d…

            if nv is not None and nv != 'UNAVAILABLE':
                view_nested[ck] = nv
        f_out, h_out = _eval_s11_quantitative_view(view_outer)
        f_nes, h_nes = _eval_s11_quantitative_view(view_nested)
        fails = list(dict.fromkeys(f_out + f_nes))
        holds = ['HOLD_S11_CONFLICTING_NESTED_EVIDENCE'] + [
            h for h in dict.fromkeys(h_out + h_nes) if h != 'HOLD_S11_CONFLICTING_NESTED_EVIDENCE'
        ]
    else:
        fails, holds = _eval_s11_quantitative_view(merged)

    if fails:
        if 'HOLD_S11_MISSING_LOT_OR_SAMPLE_BINDING' in holds:
            return _out(
                'HOLD_S11_UNLINKED_ADVERSE_SIGNAL_MISSING_LOT_OR_SAMPLE_BINDING',
                False,
                ['HOLD_S11_UNLINKED_ADVERSE_SIGNAL_MISSING_LOT_OR_SAMPLE_BINDING', *fails, *holds],
                unlinked_adverse_signals=list(fails),
                provenance_attributed=False,
            )
        return _out(fails[0], False, fails + holds, provenance_attributed=True)
    return _out(holds[0], False, holds, provenance_attributed=('HOLD_S11_MISSING_LOT_OR_SAMPLE_BINDING' not in holds))


def evaluate_stage0_product_contract(
    payload: dict[str, Any],
    *,
    root: Path | str | None = None,
) -> dict[str, Any]:
    """
    Direct Stage-0 product contract evaluator (Entry Point 1; unified with
    evaluate_stage0_research_and_molecular_guardrails, Atomic Stage-0 Ledger,
    Serialized JSON Ingestion, and Chronological Replay; IIP-0031; DEC-110).
    """
    return evaluate_stage0_research_and_molecular_guardrails(payload, root=root)