Sign in

    moonbitSPC

    Statistical process control primitives for manufacturing quality data.

    spc
    quality
    manufacturing
    statistics
    Download zip
    Author
    Version
    0.2.0
    License
    MIT
    Last updated
    last month
    Downloads
    14

    #moonbitSPC

    The checked API examples live in the package tests; use README.md for installation, architecture, assumptions, and CLI usage.

    ///|
    let chart = @moonbitSPC.ControlChart::imr([1.0, 1.1, 0.9, 1.0])

    MaybeMeasurement

    type MaybeMeasurement = Double?

    A nullable series is useful when an upstream sensor reports missing values.

    AlertSeverity

    pub(all) enum AlertSeverity {
    Info
    Warning
    Critical
    } derive(Eq, ToJson,
    Debug
    )

    Severity used by an application-facing quality alert.

    AttributePoint

    pub(all) struct AttributePoint {
    index : Int
    rate : Double
    center : Double
    lower : Double
    upper : Double
    alarm : Bool
    } derive(ToJson,
    Debug
    )

    A binomial attribute-chart point.

    AuditEvent

    pub struct AuditEvent {
    event_id : String
    lot_id : String
    actor : String
    action : String
    timestamp : String
    passed : Bool
    evidence : String
    } derive(ToJson,
    Debug
    )

    BacktestPoint

    pub(all) struct BacktestPoint {
    index : Int
    actual : Double
    predicted : Double
    error : Double
    } derive(ToJson,
    Debug
    )

    One-step historical backtest result.

    Baseline

    pub(all) struct Baseline {
    center : Double
    deviation : Double
    lower : Double
    upper : Double
    count : Int
    } derive(ToJson,
    Debug
    )

    A baseline used to compare later production windows.

    CUSUMStream

    pub(all) struct CUSUMStream {
    target : Double
    allowance : Double
    decision : Double
    positive : Double
    negative : Double
    steps : Int
    } derive(ToJson,
    Debug
    )

    Online CUSUM state.

    CUSUMStream::acknowledge

    fn CUSUMStream::acknowledge(self : CUSUMStream) -> Unit

    Clear accumulated evidence after an operator acknowledgement.

    CUSUMStream::new

    fn CUSUMStream::new(target~ : Double, allowance~ : Double, decision~ : Double) -> CUSUMStream

    CUSUMStream::push

    fn CUSUMStream::push(self : CUSUMStream, value : Double) -> Bool

    Update two-sided CUSUM state.

    CUSUMStream::score

    fn CUSUMStream::score(self : CUSUMStream) -> Double

    Current signed CUSUM statistic.

    Capability

    pub(all) struct Capability {
    mean : Double
    standard_deviation : Double
    cp : Double
    cpk : Double
    pp : Double
    ppk : Double
    out_of_spec_rate : Double
    } derive(ToJson,
    Debug
    )

    Process capability indices for a bilateral specification.

    CapabilityExtended

    pub struct CapabilityExtended {
    cp : Double
    cpk : Double
    cpu : Double
    cpl : Double
    ppm_upper : Double
    ppm_lower : Double
    yield_rate : Double
    sigma_level : Double
    capable : Bool
    } derive(ToJson,
    Debug
    )

    CapabilityResult

    pub(all) enum CapabilityResult {
    CapabilityOk(Capability)
    CapabilityInvalidInput(message~ : String)
    } derive(
    Debug
    )

    CategoryCount

    pub(all) struct CategoryCount {
    category : String
    count : Int
    proportion : Double
    } derive(ToJson,
    Debug
    )

    A categorical defect count with a stable category label.

    ChartPoint

    pub(all) struct ChartPoint {
    value : Double
    center : Double
    upper : Double
    lower : Double
    out_of_control : Bool
    } derive(ToJson,
    Debug
    )

    One plotted observation and its three-sigma limits.

    ChartResult

    pub(all) enum ChartResult {
    ChartOk(ControlChart)
    ChartInvalidInput(message~ : String)
    } derive(
    Debug
    )

    CleanIssue

    pub(all) struct CleanIssue {
    index : Int
    code : String
    message : String
    original : Double?
    replacement : Double?
    } derive(ToJson,
    Debug
    )

    A reason why a measurement was changed or rejected during preprocessing.

    CleanResult

    pub(all) struct CleanResult {
    values : Array[Double]
    original_count : Int
    removed : Int
    replaced : Int
    issues : Array[CleanIssue]
    } derive(ToJson,
    Debug
    )

    Result of a deterministic measurement-cleaning pass.

    ContractResult

    pub struct ContractResult {
    valid : Bool
    row_count : Int
    missing_fields : Array[String]
    missing_rate : Double
    duplicate_keys : Int
    reasons : Array[String]
    } derive(ToJson,
    Debug
    )

    ControlChart

    pub(all) struct ControlChart {
    kind : String
    center : Double
    points : Array[ChartPoint]
    } derive(ToJson,
    Debug
    )

    A deterministic control-chart data series.

    ControlChart::c

    fn ControlChart::c(counts : Array[Int], opportunities : Int) -> ChartResult

    Count defects chart for a constant opportunity count.

    ControlChart::cusum

    fn ControlChart::cusum(values : Array[Double], target~ : Double, allowance~ : Double, decision~ : Double) -> ChartResult

    Create a CUSUM chart from the cumulative statistics.

    ControlChart::ewma

    fn ControlChart::ewma(values : Array[Double], lambda~ : Double, initial~ : Double, sigma~ : Double) -> ChartResult

    Create an EWMA chart with a fixed three-sigma limit.

    ControlChart::imr

    fn ControlChart::imr(values : Array[Double]) -> ChartResult

    Individuals/moving-range chart.

    ControlChart::np

    fn ControlChart::np(counts : Array[Int], sample_size : Int) -> ChartResult

    Number defective chart for a constant sample size.

    ControlChart::p

    fn ControlChart::p(counts : Array[Int], sizes : Array[Int]) -> ChartResult

    Fraction defective chart.

    ControlChart::u

    fn ControlChart::u(counts : Array[Int], opportunities : Array[Int]) -> ChartResult

    Defects-per-unit chart with varying exposure.

    ControlChart::xbar_r

    fn ControlChart::xbar_r(groups : Array[Array[Double]]) -> ChartResult

    X-bar/R chart. Subgroups are expected to have the same size.

    ControlChart::xbar_s

    fn ControlChart::xbar_s(groups : Array[Array[Double]]) -> ChartResult

    X-bar/S chart using the average within-subgroup sample deviation.

    CountPoint

    pub(all) struct CountPoint {
    index : Int
    count : Int
    center : Double
    lower : Double
    upper : Double
    alarm : Bool
    } derive(ToJson,
    Debug
    )

    A c-chart point for counts at a constant opportunity count.

    DashboardCard

    pub struct DashboardCard {
    key : String
    title : String
    value : Double
    target : Double
    unit : String
    trend : Int
    status : String
    } derive(ToJson,
    Debug
    )

    DashboardSnapshot

    pub struct DashboardSnapshot {
    name : String
    generated_at : String
    cards : Array[DashboardCard]
    alerts : Int
    score : Double
    } derive(ToJson,
    Debug
    )

    DashboardSnapshot::add_card

    fn DashboardSnapshot::add_card(self : DashboardSnapshot, card : DashboardCard) -> Unit

    DashboardSnapshot::set_alerts

    fn DashboardSnapshot::set_alerts(self : DashboardSnapshot, alerts : Int) -> Unit

    DashboardSnapshot::set_score

    fn DashboardSnapshot::set_score(self : DashboardSnapshot, score : Double) -> Unit

    DataContract

    pub struct DataContract {
    name : String
    required_fields : Array[String]
    minimum_rows : Int
    maximum_missing_rate : Double
    unique_key : String
    version : String
    } derive(ToJson,
    Debug
    )

    DiagnosticResult

    pub struct DiagnosticResult {
    sample_count : Int
    mean : Double
    deviation : Double
    runs : Int
    increasing_pairs : Int
    decreasing_pairs : Int
    change_index : Int
    shift : Double
    variance_ratio : Double
    autocorrelation : Double
    stable : Bool
    } derive(ToJson,
    Debug
    )

    DistributionSummary

    pub struct DistributionSummary {
    count : Int
    mean : Double
    deviation : Double
    median : Double
    mad : Double
    skewness : Double
    kurtosis : Double
    normality_score : Double
    approximately_normal : Bool
    } derive(ToJson,
    Debug
    )

    DriftPoint

    pub(all) struct DriftPoint {
    index : Int
    value : Double
    score : Double
    alarm : Bool
    } derive(ToJson,
    Debug
    )

    Per-point drift score relative to a baseline.

    EWMAStep

    pub(all) struct EWMAStep {
    value : Double
    center : Double
    alarm : Bool
    } derive(ToJson,
    Debug
    )

    Online EWMA state.

    EWMAStream

    pub(all) struct EWMAStream {
    lambda : Double
    state : Double
    center : Double
    limit : Double
    steps : Int
    } derive(ToJson,
    Debug
    )

    EWMAStream::new

    fn EWMAStream::new(lambda~ : Double, center~ : Double, limit~ : Double) -> EWMAStream

    EWMAStream::push

    fn EWMAStream::push(self : EWMAStream, value : Double) -> EWMAStep

    Update EWMA and return the point-level alarm decision.

    EWMAStream::reset

    fn EWMAStream::reset(self : EWMAStream) -> Unit

    Reset EWMA state without changing its policy.

    FailureMode

    pub struct FailureMode {
    id : String
    process : String
    cause : String
    effect : String
    severity : Int
    occurrence : Int
    detection : Int
    owner : String
    mitigation : String
    closed : Bool
    } derive(ToJson,
    Debug
    )

    FailureMode::risk_level

    fn FailureMode::risk_level(self : FailureMode) -> String

    FailureMode::rpn

    fn FailureMode::rpn(self : FailureMode) -> Int

    ForecastResult

    pub(all) struct ForecastResult {
    strategy_name : String
    horizon : Int
    values : Array[Double]
    baseline : Double
    deviation : Double?
    lower : Array[Double]
    upper : Array[Double]
    } derive(ToJson,
    Debug
    )

    A forecast plus uncertainty bands and evaluation metadata.

    ForecastStrategy

    pub(all) enum ForecastStrategy {
    LastValue
    MeanValue
    MovingAverage(Int)
    TrendLine
    ExponentialAverage(Double)
    } derive(Eq, ToJson,
    Debug
    )

    Deterministic forecasting strategy for production planning.

    Frequency

    pub(all) struct Frequency {
    value : Int
    count : Int
    proportion : Double
    } derive(ToJson,
    Debug
    )

    A compact count/frequency table for integer-coded quality states.

    GateDecision

    pub struct GateDecision {
    released : Bool
    score : Double
    blockers : Array[String]
    recommendation : String
    } derive(ToJson,
    Debug
    )

    GaugeStudy

    pub struct GaugeStudy {
    readings : Array[Double]
    reference : Double
    repeatability : Double
    bias : Double
    resolution : Double
    percent_tolerance : Double
    adequate : Bool
    } derive(ToJson,
    Debug
    )

    HistogramBin

    pub(all) struct HistogramBin {
    lower : Double
    upper : Double
    count : Int
    proportion : Double
    } derive(ToJson,
    Debug
    )

    Histogram bin with an inclusive lower and exclusive upper edge.

    LotFeature

    pub(all) struct LotFeature {
    identity : LotIdentity
    feature : String
    values : Array[Double]
    missing : Int
    stations : Array[String]
    } derive(ToJson,
    Debug
    )

    A grouped measurement stream for one lot and feature.

    LotFeatureSummary

    pub(all) struct LotFeatureSummary {
    lot : String
    feature : String
    count : Int
    missing : Int
    mean : Double?
    deviation : Double?
    minimum : Double?
    maximum : Double?
    defect_rate : Double?
    station_count : Int
    } derive(ToJson,
    Debug
    )

    Aggregate one lot feature into a quality summary.

    LotIdentity

    pub(all) struct LotIdentity {
    lot : String
    product : String
    revision : String
    line : String
    shift : String
    start_window : String
    end_window : String
    } derive(ToJson,
    Debug
    )

    Production lot identity used to join measurements from several stations.

    LotIdentity::new

    fn LotIdentity::new(lot~ : String, product~ : String, revision~ : String, line~ : String, shift~ : String, start_window~ : String, end_window~ : String) -> LotIdentity

    Create a stable lot identity.

    MaintenancePlan

    pub struct MaintenancePlan {
    asset_id : String
    interval_days : Int
    last_service_day : Int
    next_service_day : Int
    runtime_hours : Double
    runtime_limit : Double
    open_actions : Int
    status : String
    } derive(ToJson,
    Debug
    )

    MaintenanceRecord

    pub(all) struct MaintenanceRecord {
    asset : String
    event : String
    timestamp : String
    runtime_hours : Double
    severity : Int
    note : String
    } derive(ToJson,
    Debug
    )

    Maintenance record for a machine or cutting tool.

    MaintenanceRecord::new

    fn MaintenanceRecord::new(asset~ : String, event~ : String, timestamp~ : String, runtime_hours~ : Double, severity~ : Int, note~ : String) -> MaintenanceRecord

    Create a maintenance record.

    MaterialLot

    pub struct MaterialLot {
    material_id : String
    lot_id : String
    quantity : Double
    reserved : Double
    lower_limit : Double
    upper_limit : Double
    status : String
    } derive(ToJson,
    Debug
    )

    MatrixValidation

    pub(all) struct MatrixValidation {
    valid : Bool
    rows : Int
    columns : Int
    issues : Array[String]
    } derive(ToJson,
    Debug
    )

    A result of validating a matrix before multivariate analysis.

    MeasurementEvent

    pub(all) struct MeasurementEvent {
    identity : LotIdentity
    station : String
    feature : String
    value : Double?
    sequence : Int
    accepted : Bool
    } derive(ToJson,
    Debug
    )

    One observation event with source and routing metadata.

    MeasurementEvent::new

    fn MeasurementEvent::new(identity~ : LotIdentity, station~ : String, feature~ : String, value~ : Double?, sequence~ : Int) -> MeasurementEvent

    Construct an event from an optional measurement.

    MeasurementEvent::reject

    Mark an event as rejected without discarding its traceability.

    MeasurementMatrix

    pub(all) struct MeasurementMatrix {
    rows : Array[Array[Double]]
    feature_names : Array[String]
    } derive(ToJson,
    Debug
    )

    A row-major matrix of measurements, with rows as parts and columns as features.

    MeasurementMatrix::new

    fn MeasurementMatrix::new(rows~ : Array[Array[Double]], feature_names~ : Array[String]) -> MeasurementMatrix

    Construct a matrix and copy rows so callers retain ownership of inputs.

    MeasurementMatrix::validate

    Validate rectangular shape and feature labels.

    MeasurementRing

    pub(all) struct MeasurementRing {
    capacity : Int
    values : Array[Double]
    next : Int
    } derive(ToJson,
    Debug
    )

    A fixed-size ring buffer for recent measurements.

    MeasurementRing::deviation

    fn MeasurementRing::deviation(self : MeasurementRing) -> Double?

    Deviation of the retained ring window.

    MeasurementRing::last

    fn MeasurementRing::last(self : MeasurementRing) -> Double?

    Return the newest retained measurement.

    MeasurementRing::length

    fn MeasurementRing::length(self : MeasurementRing) -> Int

    Number of retained values.

    MeasurementRing::mean

    fn MeasurementRing::mean(self : MeasurementRing) -> Double?

    Mean of the retained ring window.

    MeasurementRing::new

    fn MeasurementRing::new(capacity : Int) -> MeasurementRing

    MeasurementRing::ordered

    fn MeasurementRing::ordered(self : MeasurementRing) -> Array[Double]

    Return values ordered oldest to newest.

    MeasurementRing::push

    fn MeasurementRing::push(self : MeasurementRing, value : Double) -> Unit

    Push into a ring, dropping the oldest value when full.

    MetricCatalog

    pub struct MetricCatalog {
    metrics : Array[QualityMetric]
    version : String
    } derive(ToJson,
    Debug
    )

    MetricCatalog::add

    fn MetricCatalog::add(self : MetricCatalog, metric : QualityMetric) -> Unit

    MultivariateAlarm

    pub(all) struct MultivariateAlarm {
    row : Int
    score : Double
    threshold : Double
    alarm : Bool
    } derive(ToJson,
    Debug
    )

    A multivariate alarm with row and score information.

    ParetoRow

    pub(all) struct ParetoRow {
    category : String
    count : Int
    proportion : Double
    cumulative : Double
    } derive(ToJson,
    Debug
    )

    Pareto row with cumulative contribution.

    PolicyDecision

    pub struct PolicyDecision {
    accepted : Bool
    warning : Bool
    critical : Bool
    reason : String
    score : Double
    } derive(ToJson,
    Debug
    )

    ProcessScenario

    pub(all) struct ProcessScenario {
    name : String
    center : Double
    deviation : Double
    lower : Double?
    upper : Double?
    drift : Double
    outlier_probability : Double
    seed : Int
    } derive(ToJson,
    Debug
    )

    A repeatable simulation scenario for demonstrations and regression tests.

    ProcessScenario::new

    fn ProcessScenario::new(name~ : String, center~ : Double, deviation~ : Double, lower~ : Double?, upper~ : Double?, drift~ : Double, outlier_probability~ : Double, seed~ : Int) -> ProcessScenario

    Construct a stable process scenario.

    ProductionStage

    pub struct ProductionStage {
    name : String
    duration_hours : Double
    required_station : String
    sequence : Int
    completed : Bool
    } derive(ToJson,
    Debug
    )

    QualityAlert

    pub(all) struct QualityAlert {
    severity : AlertSeverity
    code : String
    message : String
    index : Int
    value : Double?
    } derive(ToJson,
    Debug
    )

    A structured alert that can be handed to a dashboard or work-order system.

    QualityMetric

    pub struct QualityMetric {
    key : String
    value : Double
    unit : String
    target : Double
    lower_is_better : Bool
    } derive(ToJson,
    Debug
    )

    QualityPolicy

    pub struct QualityPolicy {
    name : String
    lower_limit : Double
    upper_limit : Double
    warning_margin : Double
    critical_margin : Double
    required_samples : Int
    enabled : Bool
    } derive(ToJson,
    Debug
    )

    QualityReport

    pub(all) struct QualityReport {
    summary : Summary
    capability : Capability?
    chart : ControlChart?
    violations : Array[RuleViolation]
    } derive(ToJson,
    Debug
    )

    A complete deterministic quality analysis result.

    QualityWindow

    pub(all) struct QualityWindow {
    id : String
    values : Array[Double]
    specification : Specification?
    } derive(ToJson,
    Debug
    )

    A bounded observation window for repeatable batch reviews.

    QualityWindow::new

    fn QualityWindow::new(id~ : String, values~ : Array[Double], specification~ : Specification?) -> QualityWindow

    QualityWorkOrder

    pub struct QualityWorkOrder {
    order_id : String
    lot_id : String
    title : String
    owner : String
    priority : Int
    due_day : Int
    status : String
    estimated_hours : Double
    actual_hours : Double
    evidence_count : Int
    } derive(ToJson,
    Debug
    )

    ReleaseDecision

    pub(all) struct ReleaseDecision {
    released : Bool
    reason_codes : Array[String]
    measured_features : Int
    rejected_events : Int
    missing_measurements : Int
    } derive(ToJson,
    Debug
    )

    A lot-level release decision with reasons for review.

    ReleaseGate

    pub struct ReleaseGate {
    name : String
    required_checks : Int
    passed_checks : Int
    open_alerts : Int
    critical_alerts : Int
    evidence_count : Int
    minimum_score : Double
    } derive(ToJson,
    Debug
    )

    ReliabilitySummary

    pub(all) struct ReliabilitySummary {
    asset : String
    events : Int
    runtime_hours : Double
    mean_between_events : Double?
    severe_events : Int
    risk_score : Double
    } derive(ToJson,
    Debug
    )

    A reliability summary for one asset.

    ReportDocument

    pub(all) struct ReportDocument {
    title : String
    generated_at : String
    sections : Array[ReportSection]
    warnings : Array[String]
    } derive(ToJson,
    Debug
    )

    A report document composed from deterministic sections.

    ReportDocument::add_section

    fn ReportDocument::add_section(self : ReportDocument, title~ : String, lines~ : Array[String]) -> Unit

    Append a section while preserving insertion order.

    ReportDocument::new

    fn ReportDocument::new(title~ : String, generated_at~ : String) -> ReportDocument

    Create an empty report document.

    ReportDocument::to_markdown

    fn ReportDocument::to_markdown(self : ReportDocument) -> String

    Render a document as Markdown.

    ReportDocument::warn

    fn ReportDocument::warn(self : ReportDocument, message : String) -> Unit

    Append an audit warning.

    ReportResult

    pub(all) enum ReportResult {
    ReportOk(QualityReport)
    ReportInvalidInput(message~ : String)
    } derive(
    Debug
    )

    ReportSection

    pub(all) struct ReportSection {
    title : String
    lines : Array[String]
    } derive(ToJson,
    Debug
    )

    Human-readable quality report sections.

    RuleViolation

    pub(all) struct RuleViolation {
    rule : Int
    start_index : Int
    indices : Array[Int]
    message : String
    } derive(ToJson,
    Debug
    )

    A detected Western Electric rule violation.

    SampleResult

    pub struct SampleResult {
    indices : Array[Int]
    expected_fraction : Double
    valid : Bool
    } derive(ToJson,
    Debug
    )

    SamplingMethod

    pub(all) enum SamplingMethod {
    SimpleRandom
    Systematic
    Stratified
    Cluster
    } derive(Eq,
    Debug
    )

    SamplingPlan

    pub struct SamplingPlan {
    sampling_method : SamplingMethod
    population : Int
    requested : Int
    seed : Int
    strata : Array[Int]
    } derive(
    Debug
    )

    SamplingPlan::with_strata

    fn SamplingPlan::with_strata(self : SamplingPlan, strata : Array[Int]) -> SamplingPlan

    Scorecard

    pub(all) struct Scorecard {
    observations : Int
    windows : Int
    alerts : Int
    critical : Int
    defect_rate : Double?
    center : Double?
    deviation : Double?
    } derive(ToJson,
    Debug
    )

    A compact scorecard useful for a status badge or release report.

    SimulatedPoint

    pub(all) struct SimulatedPoint {
    index : Int
    value : Double
    center : Double
    cause : String
    in_spec : Bool
    } derive(ToJson,
    Debug
    )

    One simulated record with its latent cause.

    SimulationSummary

    pub(all) struct SimulationSummary {
    scenario : String
    points : Int
    mean : Double?
    deviation : Double?
    defects : Int
    alarms : Int
    } derive(ToJson,
    Debug
    )

    Summary of a simulation run.

    Specification

    pub(all) struct Specification {
    lower : Double
    upper : Double
    } derive(ToJson,
    Debug
    )

    A specification window used by capability analysis.

    Specification::new

    fn Specification::new(lower~ : Double, upper~ : Double) -> Specification

    Construct a bilateral specification window.

    StationCapacity

    pub struct StationCapacity {
    station : String
    available_hours : Double
    planned_hours : Double
    operators : Int
    utilization : Double
    overloaded : Bool
    } derive(ToJson,
    Debug
    )

    StationComparison

    pub(all) struct StationComparison {
    station : String
    count : Int
    mean : Double?
    deviation : Double?
    delta_from_lot : Double?
    alarm : Bool
    } derive(ToJson,
    Debug
    )

    A station-to-station comparison result.

    StreamAccumulator

    pub(all) struct StreamAccumulator {
    count : Int
    sum : Double
    sum_squared : Double
    minimum : Double?
    maximum : Double?
    last : Double?
    missing : Int
    out_of_spec : Int
    lower : Double?
    upper : Double?
    } derive(ToJson,
    Debug
    )

    Mutable online state for a long-running measurement stream.

    StreamAccumulator::defect_rate

    fn StreamAccumulator::defect_rate(self : StreamAccumulator) -> Double?

    Observed defect rate when a specification was configured.

    StreamAccumulator::deviation

    fn StreamAccumulator::deviation(self : StreamAccumulator) -> Double?

    Online sample deviation.

    StreamAccumulator::mean

    fn StreamAccumulator::mean(self : StreamAccumulator) -> Double?

    Online arithmetic mean.

    StreamAccumulator::merge

    fn StreamAccumulator::merge(self : StreamAccumulator, other : StreamAccumulator) -> Unit

    Merge another stream accumulator into this one.

    StreamAccumulator::new

    fn StreamAccumulator::new(lower~ : Double?, upper~ : Double?) -> StreamAccumulator

    Create an empty online accumulator.

    StreamAccumulator::push

    fn StreamAccumulator::push(self : StreamAccumulator, value : Double?) -> Unit

    Add one optional measurement and update all online counters.

    StreamAccumulator::push_all

    fn StreamAccumulator::push_all(self : StreamAccumulator, values : Array[Double?]) -> Unit

    Add every item in an optional series.

    StreamAccumulator::snapshot

    StreamAccumulator::span

    fn StreamAccumulator::span(self : StreamAccumulator) -> Double?

    Current span if at least one value has arrived.

    StreamAccumulator::variance

    fn StreamAccumulator::variance(self : StreamAccumulator) -> Double?

    Online population variance with cancellation protection.

    StreamMonitor

    pub(all) struct StreamMonitor {
    policy : StreamPolicy
    accumulator : StreamAccumulator
    recent : MeasurementRing
    ewma : EWMAStream
    cusum : CUSUMStream
    } derive(ToJson,
    Debug
    )

    Full state for a running policy evaluation.

    StreamMonitor::acknowledge

    fn StreamMonitor::acknowledge(self : StreamMonitor) -> Unit

    Reset cumulative alarm state while keeping measurements.

    StreamMonitor::new

    fn StreamMonitor::new(policy~ : StreamPolicy, center~ : Double) -> StreamMonitor

    Create a monitor from a policy and process center.

    StreamMonitor::push

    fn StreamMonitor::push(self : StreamMonitor, value : Double?) -> Bool

    Push a value and return whether any monitor alarm fired.

    StreamMonitor::recent_chart

    fn StreamMonitor::recent_chart(self : StreamMonitor) -> ChartResult

    Current recent-window chart.

    StreamMonitor::snapshot

    Current stream snapshot.

    StreamPolicy

    pub(all) struct StreamPolicy {
    lower : Double?
    upper : Double?
    ring_capacity : Int
    ewma_lambda : Double
    ewma_limit : Double
    cusum_allowance : Double
    cusum_decision : Double
    } derive(ToJson,
    Debug
    )

    A stream policy combines recent-window and cumulative alarms.

    StreamPolicy::standard

    fn StreamPolicy::standard(lower~ : Double?, upper~ : Double?) -> StreamPolicy

    Create a conservative production policy.

    StreamPolicy::with_capacity

    fn StreamPolicy::with_capacity(self : StreamPolicy, capacity : Int) -> StreamPolicy

    Change the retained-window capacity.

    StreamPolicy::with_cusum

    fn StreamPolicy::with_cusum(self : StreamPolicy, allowance : Double, decision : Double) -> StreamPolicy

    Change CUSUM sensitivity.

    StreamPolicy::with_ewma

    fn StreamPolicy::with_ewma(self : StreamPolicy, lambda : Double, limit : Double) -> StreamPolicy

    Change EWMA smoothing and limit policy.

    StreamSnapshot

    pub(all) struct StreamSnapshot {
    count : Int
    missing : Int
    mean : Double?
    deviation : Double?
    minimum : Double?
    maximum : Double?
    defect_rate : Double?
    last : Double?
    } derive(ToJson,
    Debug
    )

    Snapshot useful for a dashboard card.

    Subgroup

    pub(all) struct Subgroup {
    values : Array[Double]
    batch : String
    equipment : String
    tool : String
    operator : String
    window : String
    } derive(ToJson,
    Debug
    )

    A measured subgroup together with the manufacturing dimensions that produced it.

    Subgroup::new

    fn Subgroup::new(values~ : Array[Double], batch~ : String, equipment~ : String, tool~ : String, operator~ : String, window~ : String) -> Subgroup

    Build a measured subgroup with stable traceability dimensions.

    Summary

    pub(all) struct Summary {
    count : Int
    mean : Double
    standard_deviation : Double
    minimum : Double
    maximum : Double
    out_of_spec_rate : Double
    batch : String
    equipment : String
    tool : String
    operator : String
    window : String
    } derive(ToJson,
    Debug
    )

    Descriptive statistics for a set of measurements.

    SummaryResult

    pub(all) enum SummaryResult {
    Ok(Summary)
    InvalidInput(message~ : String)
    } derive(
    Debug
    )

    The result of summarizing one or more subgroups.

    ToolLifePoint

    pub(all) struct ToolLifePoint {
    tool : String
    runtime_hours : Double
    wear : Double
    threshold : Double
    exceeded : Bool
    } derive(ToJson,
    Debug
    )

    Tool-life observation linked to a production run.

    ToolLifePoint::new

    fn ToolLifePoint::new(tool~ : String, runtime_hours~ : Double, wear~ : Double, threshold~ : Double) -> ToolLifePoint

    Create a tool-life observation.

    TraceabilityResult

    pub struct TraceabilityResult {
    event_count : Int
    unique_lots : Int
    missing_evidence : Int
    failed_events : Int
    chronological : Bool
    complete : Bool
    } derive(ToJson,
    Debug
    )

    Trend

    pub(all) struct Trend {
    slope : Double
    intercept : Double
    r_squared : Double
    } derive(ToJson,
    Debug
    )

    Ordinary-least-squares trend metadata for a sequence ordered in time.

    TrendAlert

    pub struct TrendAlert {
    metric : String
    direction : Int
    slope : Double
    confidence : Double
    start_index : Int
    end_index : Int
    message : String
    } derive(ToJson,
    Debug
    )

    ValidationIssue

    pub(all) struct ValidationIssue {
    index : Int
    field : String
    message : String
    } derive(ToJson,
    Debug
    )

    A deterministic validation message attached to a source index.

    absolute_error

    fn absolute_error(actual : Double, predicted : Double) -> Double

    accepted_event_count

    fn accepted_event_count(events : Array[MeasurementEvent]) -> Int

    Count accepted events.

    actionable_alert_count

    fn actionable_alert_count(alerts : Array[QualityAlert]) -> Int

    Return a deterministic count of warnings and critical alerts.

    add_alert_section

    fn add_alert_section(document : ReportDocument, alerts : Array[QualityAlert]) -> Unit

    Add pipeline alerts to an existing document.

    add_benchmark_section

    fn add_benchmark_section(document : ReportDocument, sample_count : Int, elapsed_ms : Double) -> Unit

    Add benchmark observations to a report.

    add_maintenance_action

    fn add_maintenance_action(plan : MaintenancePlan) -> MaintenancePlan

    add_planned_hours

    fn add_planned_hours(capacity : StationCapacity, hours : Double) -> StationCapacity

    add_provenance_section

    fn add_provenance_section(document : ReportDocument, source : String, version : String) -> Unit

    Add a provenance section.

    alert_codes

    fn alert_codes(alerts : Array[QualityAlert]) -> Array[String]

    Group alerts by their stable machine-readable code.

    alerts_text

    fn alerts_text(alerts : Array[QualityAlert]) -> String

    Render an alert list as JSON-compatible text without external dependencies.

    allocation_total

    fn allocation_total(allocation : Array[Int]) -> Int

    append_feature

    fn append_feature(matrix : MeasurementMatrix, values : Array[Double], name : String) -> MeasurementMatrix?

    Add a derived feature to every row.

    asset_records

    fn asset_records(records : Array[MaintenanceRecord], asset : String) -> Array[MaintenanceRecord]

    Return maintenance records for one asset.

    asset_runtime

    fn asset_runtime(records : Array[MaintenanceRecord], asset : String) -> Double

    Sum runtime recorded for an asset.

    attribute_alarm_count

    fn attribute_alarm_count(points : Array[AttributePoint]) -> Int

    Return the number of attribute alarms.

    attribute_rate

    fn attribute_rate(counts : Array[Int], exposure : Array[Int]) -> Array[Double]?

    Calculate defect rates from counts and exposure values.

    audit_action_count

    fn audit_action_count(events : Array[AuditEvent], action : String) -> Int

    audit_event

    fn audit_event(event_id~ : String, lot_id~ : String, actor~ : String, action~ : String, timestamp~ : String, passed~ : Bool, evidence~ : String) -> AuditEvent

    audit_events_for_lot

    fn audit_events_for_lot(events : Array[AuditEvent], lot_id : String) -> Array[AuditEvent]

    audit_failed_count

    fn audit_failed_count(events : Array[AuditEvent]) -> Int

    audit_is_chronological

    fn audit_is_chronological(events : Array[AuditEvent]) -> Bool

    audit_missing_evidence

    fn audit_missing_evidence(events : Array[AuditEvent]) -> Int

    audit_pass_rate

    fn audit_pass_rate(events : Array[AuditEvent]) -> Double

    audit_score

    fn audit_score(result : TraceabilityResult) -> Double

    audit_unique_lots

    fn audit_unique_lots(events : Array[AuditEvent]) -> Int

    autocorrelation

    fn autocorrelation(values : Array[Double], lag : Int) -> Double?

    available_quantity

    fn available_quantity(lot : MaterialLot) -> Double

    average_rpn

    fn average_rpn(modes : Array[FailureMode]) -> Double

    average_severity

    fn average_severity(records : Array[MaintenanceRecord], asset : String) -> Double?

    Average repair severity for an asset.

    average_tool_wear

    fn average_tool_wear(points : Array[ToolLifePoint], tool : String) -> Double?

    Average wear for one tool.

    backtest_forecast

    fn backtest_forecast(values : Array[Double], strategy : ForecastStrategy, minimum_history : Int) -> Array[BacktestPoint]

    Evaluate one-step forecasts using expanding history.

    backtest_metrics

    fn backtest_metrics(points : Array[BacktestPoint]) -> (Double, Double)?

    Aggregate backtest errors into MAE and deviation.

    balance_capacity

    fn balance_capacity(capacities : Array[StationCapacity]) -> Double

    baseline_from

    fn baseline_from(values : Array[Double]) -> Baseline

    block_work_order

    fn block_work_order(order : QualityWorkOrder) -> QualityWorkOrder

    bool_rate

    fn bool_rate(values : Array[Bool]) -> Double

    boolean_text

    fn boolean_text(value : Bool) -> String

    capability

    fn capability(values : Array[Double], specification : Specification) -> CapabilityResult

    Calculate short-term and overall capability indices.

    capability_band

    fn capability_band(cpk : Double) -> Int

    capability_confidence_margin

    fn capability_confidence_margin(deviation : Double, sample_count : Int) -> Double

    capability_extended

    fn capability_extended(mean~ : Double, deviation~ : Double, lower~ : Double, upper~ : Double, target~ : Double, threshold~ : Double) -> CapabilityExtended

    capability_margin

    fn capability_margin(cpk : Double, threshold : Double) -> Double

    capability_section

    fn capability_section(capability : Capability) -> ReportSection

    Build a capability section.

    capability_status

    fn capability_status(cpk : Double, threshold : Double) -> String

    capacity_headroom

    fn capacity_headroom(capacity : StationCapacity) -> Double

    capacity_remaining

    fn capacity_remaining(capacity : StationCapacity) -> Double

    capacity_status

    fn capacity_status(capacity : StationCapacity) -> String

    card_gap

    fn card_gap(card : DashboardCard) -> Double

    card_meets_target

    fn card_meets_target(card : DashboardCard) -> Bool

    card_status_from_gap

    fn card_status_from_gap(gap : Double, warning : Double, critical : Double) -> String

    card_trend_name

    fn card_trend_name(trend : Int) -> String

    catalog_average_normalized

    fn catalog_average_normalized(catalog : MetricCatalog) -> Double

    catalog_failed

    fn catalog_failed(catalog : MetricCatalog) -> Array[QualityMetric]

    catalog_keys

    fn catalog_keys(catalog : MetricCatalog) -> Array[String]

    catalog_metric

    fn catalog_metric(catalog : MetricCatalog, key : String) -> QualityMetric?

    catalog_score

    fn catalog_score(catalog : MetricCatalog) -> Double

    catalog_units

    fn catalog_units(catalog : MetricCatalog) -> Array[String]

    category_counts

    fn category_counts(categories : Array[String]) -> Array[CategoryCount]

    Aggregate a categorical defect stream in first-seen order.

    category_delta

    fn category_delta(first : Array[CategoryCount], second : Array[CategoryCount]) -> Array[CategoryCount]

    Compare two categorical defect distributions.

    category_presence

    fn category_presence(categories : Array[String], vocabulary : Array[String]) -> Array[Int]

    Convert defect categories to a binary presence vector.

    category_vocabulary

    fn category_vocabulary(categories : Array[String]) -> Array[String]

    Stable category vocabulary with first-seen order.

    center_matrix

    fn center_matrix(matrix : MeasurementMatrix) -> MeasurementMatrix?

    Center each feature by its sample mean.

    center_values

    fn center_values(values : Array[Double], center : Double) -> Array[Double]

    Center values around a supplied reference.

    centered_moving_average

    fn centered_moving_average(values : Array[Double], radius : Int) -> Array[Double]?

    Return a moving average with an explicit partial-window policy.

    central_moment

    fn central_moment(values : Array[Double], order : Int) -> Double

    chart_section

    fn chart_section(chart : ControlChart) -> ReportSection

    Build a chart section.

    choose_forecast_strategy

    fn choose_forecast_strategy(values : Array[Double], strategies : Array[ForecastStrategy], minimum_history : Int) -> ForecastStrategy?

    Pick the lowest-MAE strategy from a candidate list.

    clamp_probability

    fn clamp_probability(value : Double) -> Double

    clamp_values

    fn clamp_values(values : Array[Double], lower~ : Double, upper~ : Double) -> CleanResult

    Replace out-of-range values with a boundary instead of dropping them.

    clean_values

    fn clean_values(values : Array[Double], lower~ : Double, upper~ : Double) -> CleanResult

    Filter values outside an engineering interval and retain an audit trail.

    clipped

    fn clipped(values : Array[Double], lower : Double, upper : Double) -> Array[Double]?

    Clamp every measurement to a trusted engineering interval.

    close_failure_mode

    fn close_failure_mode(mode : FailureMode) -> FailureMode

    column

    fn column(matrix : MeasurementMatrix, index : Int) -> Array[Double]?

    Return one feature column.

    column_deviations

    fn column_deviations(matrix : MeasurementMatrix) -> Array[Double]?

    Return all feature sample deviations.

    column_means

    fn column_means(matrix : MeasurementMatrix) -> Array[Double]?

    Return all feature means.

    compare_stations

    fn compare_stations(events : Array[MeasurementEvent], feature : String, threshold~ : Double) -> Array[StationComparison]

    Compare each station's values with a lot center.

    compare_windows

    fn compare_windows(previous : QualityWindow, current : QualityWindow, threshold : Double) -> QualityAlert?

    Compare two windows and return a change alert when the center shifts.

    complete_stage

    fn complete_stage(value : ProductionStage) -> ProductionStage

    complete_work_order

    fn complete_work_order(order : QualityWorkOrder, actual_hours : Double, evidence_count : Int) -> QualityWorkOrder

    completed_stage_count

    fn completed_stage_count(stages : Array[ProductionStage]) -> Int

    completion_rate

    fn completion_rate(orders : Array[QualityWorkOrder]) -> Double

    concatenate_values

    fn concatenate_values(first : Array[Double], second : Array[Double]) -> Array[Double]

    Concatenate two measurement windows.

    confidence_interval_95

    fn confidence_interval_95(values : Array[Double]) -> (Double, Double)?

    Approximate 95 percent confidence interval for a mean.

    consume_material

    fn consume_material(lot : MaterialLot, amount : Double) -> MaterialLot

    contains_line

    fn contains_line(lines : Array[String], value : String) -> Bool

    contract_duplicate_count

    fn contract_duplicate_count(keys : Array[String]) -> Int

    contract_field_count

    fn contract_field_count(contract : DataContract) -> Int

    contract_has_reason

    fn contract_has_reason(result : ContractResult, reason : String) -> Bool

    contract_is_backward_compatible

    fn contract_is_backward_compatible(old_fields : Array[String], new_fields : Array[String]) -> Bool

    contract_merge_fields

    fn contract_merge_fields(left : Array[String], right : Array[String]) -> Array[String]

    contract_missing_fields

    fn contract_missing_fields(contract : DataContract, fields : Array[String]) -> Array[String]

    contract_quality_score

    fn contract_quality_score(result : ContractResult) -> Double

    contract_reason_count

    fn contract_reason_count(result : ContractResult) -> Int

    contract_schema_signature

    fn contract_schema_signature(fields : Array[String]) -> String

    contract_version_compatible

    fn contract_version_compatible(old_version : String, new_version : String) -> Bool

    contract_version_major

    fn contract_version_major(version : String) -> Int

    correlation

    fn correlation(first : Array[Double], second : Array[Double]) -> Double?

    correlation_matrix

    fn correlation_matrix(matrix : MeasurementMatrix) -> Array[Array[Double]]?

    Feature-by-feature correlation matrix.

    count_alarm_count

    fn count_alarm_count(points : Array[CountPoint]) -> Int

    Return the number of count-chart alarms.

    count_chart_points

    fn count_chart_points(counts : Array[Int]) -> Array[CountPoint]?

    Create a count chart with Poisson three-sigma limits.

    count_component_failures

    fn count_component_failures(matrix : MeasurementMatrix, lower : Array[Double], upper : Array[Double]) -> Int

    Count rows with any feature outside a component-wise specification.

    count_mask

    fn count_mask(mask : Array[Bool]) -> Int

    Count true entries in a mask.

    count_missing

    fn count_missing(values : Array[Double?]) -> Int

    Count missing entries in a nullable series.

    count_true

    fn count_true(values : Array[Bool]) -> Int

    covariance

    fn covariance(first : Array[Double], second : Array[Double]) -> Double?

    covariance_matrix

    fn covariance_matrix(matrix : MeasurementMatrix) -> Array[Array[Double]]?

    Feature-by-feature covariance matrix.

    critical_alert_count

    fn critical_alert_count(alerts : Array[QualityAlert]) -> Int

    Return a deterministic count of critical alerts.

    critical_failure_modes

    fn critical_failure_modes(modes : Array[FailureMode]) -> Array[FailureMode]

    critical_maintenance_count

    fn critical_maintenance_count(plans : Array[MaintenancePlan]) -> Int

    csv_document

    fn csv_document(headers : Array[String], rows : Array[Array[String]]) -> String

    csv_escape

    fn csv_escape(value : String) -> String

    csv_row

    fn csv_row(values : Array[String]) -> String

    cumulative_product

    fn cumulative_product(values : Array[Double]) -> Array[Double]

    Cumulative product for multiplicative reliability factors.

    cumulative_sum

    fn cumulative_sum(values : Array[Double]) -> Array[Double]

    Cumulative sum for material balance and defect accumulation charts.

    cusum

    fn cusum(values : Array[Double], target~ : Double, allowance~ : Double, decision~ : Double) -> Array[Double]

    Two-sided cumulative-sum chart statistic.

    dashboard_card

    fn dashboard_card(key~ : String, title~ : String, value~ : Double, target~ : Double, unit~ : String, trend~ : Int, status~ : String) -> DashboardCard

    dashboard_snapshot

    fn dashboard_snapshot(name~ : String, generated_at~ : String) -> DashboardSnapshot

    data_contract

    fn data_contract(name~ : String, required_fields~ : Array[String], minimum_rows~ : Int, maximum_missing_rate~ : Double, unique_key~ : String, version~ : String) -> DataContract

    data_quality_score

    fn data_quality_score(values : Array[Double?], lower : Double, upper : Double) -> Double

    A compact quality score combining coverage and specification compliance.

    decreasing_pair_count

    fn decreasing_pair_count(values : Array[Double]) -> Int

    deduplicate_adjacent

    fn deduplicate_adjacent(values : Array[Double]) -> Array[Double]

    Remove adjacent duplicate sensor readings.

    defect_count_error

    fn defect_count_error(expected : Int, observed : Int) -> Int

    Compare expected and observed defect counts.

    defect_rate

    fn defect_rate(values : Array[Double], specification : Specification) -> Double?

    Calculate the percentage of observations outside a bilateral specification.

    defects_per_opportunity

    fn defects_per_opportunity(defects : Array[Int], opportunities : Array[Int]) -> Double?

    Calculate average defects per opportunity with varying exposure.

    denormalize_range

    fn denormalize_range(value : Double, lower : Double, upper : Double) -> Double

    depleted_lot_count

    fn depleted_lot_count(lots : Array[MaterialLot]) -> Int

    detect_trend

    fn detect_trend(metric~ : String, values~ : Array[Double], tolerance~ : Double) -> TrendAlert?

    detect_western_electric

    fn detect_western_electric(values : Array[Double], mean~ : Double, sigma~ : Double) -> Array[RuleViolation]

    Detect the four commonly used Western Electric rules.

    detrend

    fn detrend(values : Array[Double]) -> Array[Double]?

    Return residuals after removing a fitted linear trend.

    diagnose_process

    fn diagnose_process(values : Array[Double], baseline : Double, shift_tolerance : Double, variance_limit : Double) -> DiagnosticResult

    diagnostic_alarm_count

    fn diagnostic_alarm_count(result : DiagnosticResult) -> Int

    diagnostic_label

    fn diagnostic_label(result : DiagnosticResult) -> String

    diagnostic_score

    fn diagnostic_score(result : DiagnosticResult) -> Double

    direction_changes

    fn direction_changes(values : Array[Double]) -> Int

    Count monotonic direction changes, useful for tool-wear review.

    disable_policy

    fn disable_policy(policy : QualityPolicy) -> QualityPolicy

    distance_alarms

    fn distance_alarms(matrix : MeasurementMatrix, center : Array[Double], threshold~ : Double) -> Array[MultivariateAlarm]?

    Score rows against a profile using a distance threshold.

    distance_from_interval

    fn distance_from_interval(value : Double, lower : Double, upper : Double) -> Double

    distribution_summary

    fn distribution_summary(values : Array[Double]) -> DistributionSummary

    document_quality_report

    fn document_quality_report(result : ReportResult, generated_at : String) -> ReportDocument

    Build a quality document from a report result.

    dominant_feature

    fn dominant_feature(matrix : MeasurementMatrix) -> Int?

    Return the feature index with the largest variance.

    drift_score

    fn drift_score(values : Array[Double], baseline : Baseline, threshold~ : Double) -> Array[DriftPoint]

    drop_missing

    fn drop_missing(values : Array[Double?]) -> Array[Double]

    Convert a nullable series to a compact series by dropping missing entries.

    due_maintenance_count

    fn due_maintenance_count(plans : Array[MaintenancePlan], current_day : Int) -> Int

    evaluate_policy

    fn evaluate_policy(policy : QualityPolicy, values : Array[Double]) -> PolicyDecision

    evaluate_release

    fn evaluate_release(gate : ReleaseGate) -> GateDecision

    evaluate_window

    fn evaluate_window(window : QualityWindow) -> Array[QualityAlert]

    Evaluate one window using limits, robust outliers, and specification defects.

    evaluate_windows

    fn evaluate_windows(windows : Array[QualityWindow]) -> Array[QualityAlert]

    Evaluate all windows and attach their local index to generated alerts.

    event_acceptance_rate

    fn event_acceptance_rate(events : Array[MeasurementEvent]) -> Double

    Acceptance rate for routed events.

    evidence_coverage

    fn evidence_coverage(orders : Array[QualityWorkOrder]) -> Double

    evidence_types

    fn evidence_types(events : Array[AuditEvent]) -> Array[String]

    ewma

    fn ewma(values : Array[Double], lambda~ : Double, initial~ : Double) -> Array[Double]

    Exponentially weighted moving average. Invalid smoothing factors return None.

    exceeded_tool_count

    fn exceeded_tool_count(points : Array[ToolLifePoint]) -> Int

    Count tools that have exceeded their wear threshold.

    exponential_smooth

    fn exponential_smooth(values : Array[Double], alpha~ : Double, initial~ : Double) -> Array[Double]

    Exponentially decay a prior value into each current measurement.

    export_status

    fn export_status(valid : Bool, score : Double) -> String

    failure_mode

    fn failure_mode(id~ : String, process~ : String, cause~ : String, effect~ : String, severity~ : Int, occurrence~ : Int, detection~ : Int, owner~ : String, mitigation~ : String) -> FailureMode

    failure_modes_by_process

    fn failure_modes_by_process(modes : Array[FailureMode], process : String) -> Array[FailureMode]

    feature_events

    fn feature_events(events : Array[MeasurementEvent], feature : String) -> Array[MeasurementEvent]

    Return events for one feature.

    fifo_lots

    fn fifo_lots(lots : Array[MaterialLot]) -> Array[MaterialLot]

    fill_missing

    fn fill_missing(values : Array[Double?], replacement : Double) -> CleanResult

    Replace every missing point with a caller-supplied process center.

    filter_shifted_windows

    fn filter_shifted_windows(windows : Array[QualityWindow], lower : Double, upper : Double) -> Array[QualityWindow]

    Return only windows whose mean is outside the supplied engineering band.

    finite_population_sample

    fn finite_population_sample(population~ : Int, confidence_z~ : Double, proportion~ : Double, margin~ : Double) -> Int

    first_actionable_window

    fn first_actionable_window(windows : Array[QualityWindow]) -> Int?

    Return the first window with an actionable alert.

    first_difference

    fn first_difference(values : Array[Double]) -> Array[Double]

    Return the first difference of a series, preserving time order.

    first_mean_shift

    fn first_mean_shift(values : Array[Double], baseline : Double, tolerance : Double) -> Int

    fitted_errors

    fn fitted_errors(values : Array[Double], strategy : ForecastStrategy) -> Array[Double]

    Fitted residuals for a strategy.

    forecast

    fn forecast(values : Array[Double], periods : Int) -> Array[Double]?

    Forecast future points from an ordinary-least-squares trend.

    forecast_bands

    fn forecast_bands(values : Array[Double], deviation : Double, levels : Array[Double]) -> Array[(Array[Double], Array[Double])]

    Generate multiple uncertainty levels around one forecast.

    forecast_with

    fn forecast_with(values : Array[Double], strategy : ForecastStrategy, horizon : Int) -> ForecastResult?

    Produce a deterministic forecast for a future horizon.

    frequencies

    fn frequencies(values : Array[Int]) -> Array[Frequency]

    gauge_bias_percent

    fn gauge_bias_percent(study : GaugeStudy, tolerance : Double) -> Double

    gauge_repeatability_ratio

    fn gauge_repeatability_ratio(study : GaugeStudy, tolerance : Double) -> Double

    gauge_resolution_ratio

    fn gauge_resolution_ratio(study : GaugeStudy, tolerance : Double) -> Double

    gauge_status

    fn gauge_status(study : GaugeStudy) -> String

    gauge_study

    fn gauge_study(readings~ : Array[Double], reference~ : Double, tolerance~ : Double, resolution~ : Double) -> GaugeStudy

    geometric_mean

    fn geometric_mean(values : Array[Double]) -> Double?

    group_events

    fn group_events(events : Array[MeasurementEvent]) -> Array[LotFeature]

    Group events by feature and preserve source station order.

    group_tool_life

    fn group_tool_life(points : Array[ToolLifePoint]) -> Array[String]

    Group wear observations by tool identifier.

    grr_percent

    fn grr_percent(gauge_sd : Double, tolerance : Double) -> Double

    harmonic_mean

    fn harmonic_mean(values : Array[Double]) -> Double?

    has_duplicate_indices

    fn has_duplicate_indices(indices : Array[Int]) -> Bool

    helper_root_mean_squared_error

    fn helper_root_mean_squared_error(errors : Array[Double]) -> Double

    fn high_severity_trends(alerts : Array[TrendAlert]) -> Int

    highest_wear

    fn highest_wear(points : Array[ToolLifePoint], limit : Int) -> Array[ToolLifePoint]

    Return tools with the highest current wear.

    histogram

    fn histogram(values : Array[Double], bins : Int) -> Array[HistogramBin]?

    increased_categories

    fn increased_categories(first : Array[CategoryCount], second : Array[CategoryCount]) -> Array[CategoryCount]

    Return categories whose counts increased.

    increasing_pair_count

    fn increasing_pair_count(values : Array[Double]) -> Int

    indent_lines

    fn indent_lines(lines : Array[String], prefix : String) -> Array[String]

    integer_range_sum

    fn integer_range_sum(start : Int, end : Int) -> Int

    interpolate_missing

    fn interpolate_missing(values : Array[Double?]) -> Array[Double?]

    Replace missing interior points by linear interpolation.

    interquartile_range

    fn interquartile_range(values : Array[Double]) -> Double

    invalid_stage_sequence

    fn invalid_stage_sequence(stages : Array[ProductionStage]) -> Int

    inventory_utilization

    fn inventory_utilization(lots : Array[MaterialLot]) -> Double

    iqr

    fn iqr(values : Array[Double]) -> Double?

    Interquartile range.

    iqr_outliers

    fn iqr_outliers(values : Array[Double], multiplier : Double) -> Array[Bool]?

    Boolean outlier markers using the interquartile range fence.

    is_non_decreasing

    fn is_non_decreasing(values : Array[Double]) -> Bool

    Check whether a series is non-decreasing.

    is_non_increasing

    fn is_non_increasing(values : Array[Double]) -> Bool

    Check whether a series is non-increasing.

    join_lines

    fn join_lines(lines : Array[String]) -> String

    key_value_line

    fn key_value_line(key : String, value : String) -> String

    kurtosis_value

    fn kurtosis_value(values : Array[Double]) -> Double

    lag_autocorrelation

    fn lag_autocorrelation(values : Array[Double], lag : Int) -> Double

    lag_values

    fn lag_values(values : Array[Double], lag : Int) -> Array[Double]

    Shift a series by a non-negative lag; the leading positions retain source values.

    largest_change_index

    fn largest_change_index(values : Array[Double]) -> Int?

    Return the index of the largest absolute change.

    lead_values

    fn lead_values(values : Array[Double], lead : Int) -> Array[Double]

    Shift a series forward and fill its tail with the final value.

    limit_repeated_runs

    fn limit_repeated_runs(values : Array[Double], maximum : Int) -> CleanResult

    Remove values that repeat more than a configured run length.

    line_count

    fn line_count(text : String) -> Int

    linear_interpolate

    fn linear_interpolate(x : Double, x0 : Double, y0 : Double, x1 : Double, y1 : Double) -> Double

    linear_trend

    fn linear_trend(values : Array[Double]) -> Trend?

    linearity_bias

    fn linearity_bias(references : Array[Double], readings : Array[Double]) -> Array[Double]

    linearity_slope

    fn linearity_slope(references : Array[Double], readings : Array[Double]) -> Double

    longest_run

    fn longest_run(values : Array[Double], center : Double) -> Int

    Longest consecutive run on either side of a center line.

    lot_age_bucket

    fn lot_age_bucket(days : Int) -> String

    lot_events

    fn lot_events(events : Array[MeasurementEvent], lot : String) -> Array[MeasurementEvent]

    Filter events belonging to one lot.

    lot_feature_reports

    fn lot_feature_reports(events : Array[MeasurementEvent], specification : Specification?) -> Array[LotFeatureSummary]

    Run a quality report for every lot feature.

    lots_for_material

    fn lots_for_material(lots : Array[MaterialLot], material_id : String) -> Array[MaterialLot]

    mad

    fn mad(values : Array[Double]) -> Double?

    Median absolute deviation, a robust estimate of process spread.

    maintenance_action_count

    fn maintenance_action_count(plans : Array[MaintenancePlan]) -> Int

    maintenance_compliance

    fn maintenance_compliance(plans : Array[MaintenancePlan], current_day : Int) -> Double

    maintenance_due

    fn maintenance_due(plan : MaintenancePlan, current_day : Int) -> Bool

    maintenance_event_counts

    fn maintenance_event_counts(records : Array[MaintenanceRecord]) -> Array[CategoryCount]

    Count records by event name.

    maintenance_overdue_days

    fn maintenance_overdue_days(plan : MaintenancePlan, current_day : Int) -> Int

    maintenance_plan

    fn maintenance_plan(asset_id~ : String, interval_days~ : Int, last_service_day~ : Int, runtime_hours~ : Double, runtime_limit~ : Double, open_actions~ : Int) -> MaintenancePlan

    maintenance_priority

    fn maintenance_priority(plan : MaintenancePlan, current_day : Int) -> Double

    maintenance_risk

    fn maintenance_risk(plan : MaintenancePlan) -> String

    maintenance_runtime_margin

    fn maintenance_runtime_margin(plan : MaintenancePlan) -> Double

    maintenance_runtime_utilization

    fn maintenance_runtime_utilization(plan : MaintenancePlan) -> Double

    maintenance_status_counts

    fn maintenance_status_counts(plans : Array[MaintenancePlan]) -> Array[Int]

    markdown_row

    fn markdown_row(values : Array[String]) -> String

    markdown_table

    fn markdown_table(headers : Array[String], rows : Array[Array[String]]) -> String

    material_is_in_range

    fn material_is_in_range(lot : MaterialLot, value : Double) -> Bool

    material_lot

    fn material_lot(material_id~ : String, lot_id~ : String, quantity~ : Double, lower_limit~ : Double, upper_limit~ : Double) -> MaterialLot

    max_abs

    fn max_abs(left : Double, right : Double) -> Double

    maximum_tool_runtime

    fn maximum_tool_runtime(points : Array[ToolLifePoint], tool : String) -> Double?

    Maximum runtime observed for one tool.

    mean_absolute_error

    fn mean_absolute_error(actual : Array[Double], predicted : Array[Double]) -> Double?

    Mean absolute forecast error.

    mean_squared_error

    fn mean_squared_error(actual : Array[Double], predicted : Array[Double]) -> Double?

    Mean squared forecast error.

    mean_time_between_events

    fn mean_time_between_events(records : Array[MaintenanceRecord], asset : String) -> Double?

    Mean time between recorded maintenance events.

    measured_event_count

    fn measured_event_count(events : Array[MeasurementEvent]) -> Int

    Count non-missing events.

    measurement_coverage

    fn measurement_coverage(events : Array[MeasurementEvent]) -> Double

    Coverage rate for accepted numeric observations.

    measurement_system_rating

    fn measurement_system_rating(ndc_value : Double, grr : Double) -> String

    median

    fn median(values : Array[Double]) -> Double?

    median_absolute_deviation

    fn median_absolute_deviation(values : Array[Double]) -> Double

    median_value

    fn median_value(values : Array[Double]) -> Double

    meets_defect_target

    fn meets_defect_target(points : Array[SimulatedPoint], target : Double) -> Bool

    Check whether a simulation met a defect-rate target.

    merge_event_streams

    fn merge_event_streams(first : Array[MeasurementEvent], second : Array[MeasurementEvent]) -> Array[MeasurementEvent]

    Merge events from multiple lots into a single chronological stream.

    merge_release_gates

    fn merge_release_gates(left : ReleaseGate, right : ReleaseGate) -> ReleaseGate

    metric_catalog

    fn metric_catalog(version~ : String) -> MetricCatalog

    metric_gap

    fn metric_gap(metric : QualityMetric) -> Double

    metric_meets_target

    fn metric_meets_target(metric : QualityMetric) -> Bool

    midpoint

    fn midpoint(left : Double, right : Double) -> Double

    min_max_scale

    fn min_max_scale(values : Array[Double]) -> Array[Double]?

    Normalize values to a unit interval; constant inputs are rejected.

    min_positive

    fn min_positive(value : Double, fallback : Double) -> Double

    missing_event_count

    fn missing_event_count(events : Array[MeasurementEvent]) -> Int

    Count events missing a value.

    missing_rate

    fn missing_rate(values : Array[Double?]) -> Double

    Calculate the fraction of missing sensor readings.

    mitigation_coverage

    fn mitigation_coverage(modes : Array[FailureMode]) -> Double

    most_restrictive_policy

    fn most_restrictive_policy(policies : Array[QualityPolicy]) -> QualityPolicy?

    moving_mean

    fn moving_mean(values : Array[Double], width : Int) -> Array[Double]?

    Arithmetic means for all contiguous windows of a fixed width.

    moving_std

    fn moving_std(values : Array[Double], width : Int) -> Array[Double]?

    Moving sample deviations for a fixed-width window.

    ndc

    fn ndc(process_sd : Double, gauge_sd : Double) -> Double

    nonconformance_ppm

    fn nonconformance_ppm(values : Array[Double], lower : Double, upper : Double) -> Double

    nonempty_lines

    fn nonempty_lines(lines : Array[String]) -> Array[String]

    normality_distance

    fn normality_distance(summary : DistributionSummary) -> Double

    normality_label

    fn normality_label(summary : DistributionSummary) -> String

    normalize_range

    fn normalize_range(value : Double, lower : Double, upper : Double) -> Double

    normalize_wear_points

    fn normalize_wear_points(points : Array[ToolLifePoint]) -> Array[Double]

    Normalize runtime/wear points to a common interval.

    normalize_weights

    fn normalize_weights(weights : Array[Double]) -> Array[Double]?

    Normalize a weight vector to unit absolute sum.

    normalized_metric

    fn normalized_metric(metric : QualityMetric) -> Double

    numbered_lines

    fn numbered_lines(lines : Array[String]) -> Array[String]

    observed_simulation_drift

    fn observed_simulation_drift(points : Array[SimulatedPoint]) -> Double?

    Estimate observed drift from latent centers.

    observed_yield

    fn observed_yield(values : Array[Double], lower : Double, upper : Double) -> Double

    occupied_range

    fn occupied_range(values : Array[Double?]) -> (Int, Int)?

    Return a nullable series' occupied index range.

    one_sided_capability

    fn one_sided_capability(mean~ : Double, deviation~ : Double, limit~ : Double, upper~ : Bool) -> Double

    online_snapshot

    fn online_snapshot(values : Array[Double], lower~ : Double?, upper~ : Double?) -> StreamSnapshot

    Compute a batch snapshot through the online path.

    open_failure_modes

    fn open_failure_modes(modes : Array[FailureMode]) -> Int

    open_work_order_count

    fn open_work_order_count(orders : Array[QualityWorkOrder]) -> Int

    operator_average

    fn operator_average(readings : Array[Double], operators : Int) -> Array[Double]

    outlier_indices

    fn outlier_indices(values : Array[Double], center : Double, limit : Double) -> Array[Int]

    outside_mask

    fn outside_mask(values : Array[Double], lower : Double, upper : Double) -> Array[Bool]

    Return a boolean mask for values outside a closed interval.

    overdue_work_order_count

    fn overdue_work_order_count(orders : Array[QualityWorkOrder], current_day : Int) -> Int

    p_chart_points

    fn p_chart_points(counts : Array[Int], exposure : Array[Int]) -> Array[AttributePoint]?

    Create a p-chart series from variable exposures.

    pareto_categories

    fn pareto_categories(categories : Array[String]) -> Array[ParetoRow]

    Build a Pareto ranking from categorical observations.

    percent_text

    fn percent_text(value : Double) -> String

    percentage_change

    fn percentage_change(old : Double, new : Double) -> Double

    percentile_rank

    fn percentile_rank(values : Array[Double], value : Double) -> Double?

    Percentile rank of a measurement, with ties counted as half.

    plan_utilization

    fn plan_utilization(capacities : Array[StationCapacity]) -> Double

    planned_service_days

    fn planned_service_days(plans : Array[MaintenancePlan]) -> Array[Int]

    plans_for_asset

    fn plans_for_asset(plans : Array[MaintenancePlan], asset_id : String) -> Array[MaintenancePlan]

    plateau_count

    fn plateau_count(values : Array[Double], tolerance : Double) -> Int

    policies_enabled

    fn policies_enabled(policies : Array[QualityPolicy]) -> Int

    policy_defect_count

    fn policy_defect_count(policy : QualityPolicy, values : Array[Double]) -> Int

    policy_defect_rate

    fn policy_defect_rate(policy : QualityPolicy, values : Array[Double]) -> Double

    policy_distance

    fn policy_distance(policy : QualityPolicy, value : Double) -> Double

    policy_margin_ok

    fn policy_margin_ok(policy : QualityPolicy, value : Double) -> Bool

    policy_summary

    fn policy_summary(policies : Array[QualityPolicy]) -> Array[String]

    policy_yield

    fn policy_yield(policy : QualityPolicy, values : Array[Double]) -> Double

    pooled_standard_deviation

    fn pooled_standard_deviation(groups : Array[Array[Double]]) -> Double?

    Pooled sample deviation for independent subgroups.

    ppm_from_rate

    fn ppm_from_rate(rate : Double) -> Double

    predicted_tool_limit

    fn predicted_tool_limit(points : Array[ToolLifePoint]) -> Double?

    Predict runtime at which a wear threshold will be exceeded.

    product_of

    fn product_of(values : Array[Double]) -> Double

    profile_delta

    fn profile_delta(first : Array[Double], second : Array[Double]) -> Array[Double]?

    Difference between two profiles, useful for revision-to-revision comparison.

    profile_max_delta

    fn profile_max_delta(first : Array[Double], second : Array[Double]) -> Double?

    Maximum absolute coordinate difference between profiles.

    project_matrix

    fn project_matrix(matrix : MeasurementMatrix, direction : Array[Double]) -> Array[Double]?

    Project every row onto a principal direction.

    project_row

    fn project_row(row : Array[Double], direction : Array[Double]) -> Double?

    Project a row onto a principal direction.

    proportional_allocation

    fn proportional_allocation(total~ : Int, strata : Array[Int]) -> Array[Int]

    quality_metric

    fn quality_metric(key~ : String, value~ : Double, unit~ : String, target~ : Double, lower_is_better~ : Bool) -> QualityMetric

    quality_policy

    fn quality_policy(name~ : String, lower_limit~ : Double, upper_limit~ : Double, warning_margin~ : Double, critical_margin~ : Double, required_samples~ : Int) -> QualityPolicy

    quality_report

    fn quality_report(groups : Array[Subgroup], specification? : Specification) -> ReportResult

    Assemble descriptive statistics, optional capability, chart, and rules.

    quality_work_order

    fn quality_work_order(order_id~ : String, lot_id~ : String, title~ : String, owner~ : String, priority~ : Int, due_day~ : Int, estimated_hours~ : Double) -> QualityWorkOrder

    quantile

    fn quantile(values : Array[Double], probability : Double) -> Double?

    Linearly interpolated quantile in the closed probability interval.

    quantile_value

    fn quantile_value(values : Array[Double], probability : Double) -> Double

    reconstruct_row

    fn reconstruct_row(score : Double, direction : Array[Double]) -> Array[Double]

    Reconstruct a row from a scalar score and direction.

    reconstruction_error

    fn reconstruction_error(matrix : MeasurementMatrix, direction : Array[Double]) -> Double?

    Sum squared reconstruction errors for a one-component model.

    record_service

    fn record_service(plan : MaintenancePlan, service_day : Int, runtime_hours : Double) -> MaintenancePlan

    rejected_event_count

    fn rejected_event_count(events : Array[MeasurementEvent]) -> Int

    Count rejected events.

    relative_error

    fn relative_error(actual : Double, predicted : Double) -> Double

    relative_to_first

    fn relative_to_first(values : Array[Double]) -> Array[Double]?

    Normalize a series by its first observation.

    relative_to_last

    fn relative_to_last(values : Array[Double]) -> Array[Double]?

    Normalize a series by its last observation.

    release_alert_burden

    fn release_alert_burden(gate : ReleaseGate) -> Double

    release_audit_lines

    fn release_audit_lines(gate : ReleaseGate) -> Array[String]

    release_blockers

    fn release_blockers(gate : ReleaseGate) -> Array[String]

    release_check_rate

    fn release_check_rate(gate : ReleaseGate) -> Double

    release_decision

    fn release_decision(events : Array[MeasurementEvent], minimum_features~ : Int, minimum_measurements~ : Int) -> ReleaseDecision

    Decide whether a lot can be released under minimum coverage rules.

    release_evidence_required

    fn release_evidence_required(gate : ReleaseGate) -> Int

    release_gap

    fn release_gap(gate : ReleaseGate) -> Double

    release_gate

    fn release_gate(name~ : String, required_checks~ : Int, passed_checks~ : Int, open_alerts~ : Int, critical_alerts~ : Int, evidence_count~ : Int, minimum_score~ : Double) -> ReleaseGate

    release_ready

    fn release_ready(gate : ReleaseGate) -> Bool

    release_score

    fn release_score(gate : ReleaseGate) -> Double

    reliability_summary

    fn reliability_summary(records : Array[MaintenanceRecord], asset : String, severe_threshold~ : Int) -> ReliabilitySummary

    Build a reliability summary using event frequency and severity.

    remaining_wear

    fn remaining_wear(point : ToolLifePoint) -> Double

    Estimate remaining wear margin.

    remove_iqr_outliers

    fn remove_iqr_outliers(values : Array[Double], multiplier~ : Double) -> CleanResult

    Remove values with a robust IQR fence and return an audit trail.

    removed_categories

    fn removed_categories(first : Array[CategoryCount], second : Array[CategoryCount]) -> Array[String]

    Return categories whose counts disappeared from the second sample.

    reorder_needed

    fn reorder_needed(lots : Array[MaterialLot], reorder_point : Double) -> Bool

    repeatability_by_group

    fn repeatability_by_group(groups : Array[Array[Double]]) -> Double

    replay_stream

    fn replay_stream(values : Array[Double?], policy~ : StreamPolicy, center~ : Double) -> Int

    Count alarms in a deterministic stream replay.

    report_is_clean

    fn report_is_clean(document : ReportDocument) -> Bool

    Return whether a document has no warnings.

    report_section_count

    fn report_section_count(document : ReportDocument) -> Int

    Count report sections.

    report_section_titles

    fn report_section_titles(document : ReportDocument) -> Array[String]

    Return titles for all sections.

    report_warning_count

    fn report_warning_count(document : ReportDocument) -> Int

    Count report warnings.

    reproducibility

    fn reproducibility(values : Array[Double]) -> Double

    required_sample_size

    fn required_sample_size(confidence_z~ : Double, proportion~ : Double, margin~ : Double) -> Int

    reserve_material

    fn reserve_material(lot : MaterialLot, amount : Double) -> MaterialLot

    reverse_values

    fn reverse_values(values : Array[Double]) -> Array[Double]

    Reverse a series without mutating the caller's array.

    risk_reduction

    fn risk_reduction(before : FailureMode, after : FailureMode) -> Double

    robust_outlier_indices

    fn robust_outlier_indices(values : Array[Double], threshold : Double) -> Array[Int]

    robust_z_score

    fn robust_z_score(value : Double, median : Double, mad : Double) -> Double

    rolling_max

    fn rolling_max(values : Array[Double], width : Int) -> Array[Double]?

    Maximum of each rolling window.

    rolling_min

    fn rolling_min(values : Array[Double], width : Int) -> Array[Double]?

    Minimum of each rolling window.

    rolling_range

    fn rolling_range(values : Array[Double], width : Int) -> Array[Double]?

    Range of each rolling window.

    rolling_sum

    fn rolling_sum(values : Array[Double], width : Int) -> Array[Double]?

    Compute a stable rolling sum without allocating one array per window.

    root_mean_squared_error

    fn root_mean_squared_error(actual : Array[Double], predicted : Array[Double]) -> Double?

    Root mean squared forecast error.

    rotate_values

    fn rotate_values(values : Array[Double], offset : Int) -> Array[Double]

    Rotate a series left by a normalized offset.

    row_distances

    fn row_distances(matrix : MeasurementMatrix, center : Array[Double]) -> Array[Double]?

    Euclidean distances from each row to a reference profile.

    runs_count

    fn runs_count(values : Array[Double], center : Double) -> Int

    safe_divide

    fn safe_divide(numerator : Double, denominator : Double, fallback : Double) -> Double

    safe_range

    fn safe_range(value : Double, lower : Double, upper : Double) -> Double

    sample

    fn sample(plan : SamplingPlan) -> SampleResult

    sample_uniform

    fn sample_uniform(count : Int, seed~ : Int, lower~ : Double, upper~ : Double) -> Array[Double]

    Deterministic pseudo-random samples for repeatable examples and benchmarks.

    sampling_coverage

    fn sampling_coverage(indices : Array[Int], population : Int) -> Double

    sampling_interval

    fn sampling_interval(population~ : Int, requested~ : Int) -> Double

    sampling_plan

    fn sampling_plan(sampling_method~ : SamplingMethod, population~ : Int, requested~ : Int, seed~ : Int) -> SamplingPlan

    scale_values

    fn scale_values(values : Array[Double], scale : Double) -> Array[Double]?

    Scale values by a positive engineering scale.

    score_band

    fn score_band(score : Double) -> String

    scorecard

    fn scorecard(windows : Array[QualityWindow]) -> Scorecard

    scorecard_markdown

    fn scorecard_markdown(card : Scorecard) -> String

    Render a scorecard as a compact Markdown table.

    second_difference

    fn second_difference(values : Array[Double]) -> Array[Double]

    Return the second difference for acceleration and tool-wear diagnostics.

    select_mask

    fn select_mask(values : Array[Double], mask : Array[Bool]) -> Array[Double]

    Apply a boolean mask to a measurement series.

    select_rows

    fn select_rows(matrix : MeasurementMatrix, alarms : Array[MultivariateAlarm], keep_alarms : Bool) -> MeasurementMatrix

    Select rows that remain in a multivariate acceptance region.

    severe_records

    fn severe_records(records : Array[MaintenanceRecord], threshold : Int) -> Array[MaintenanceRecord]

    Return records above a severity threshold.

    sigma_from_yield

    fn sigma_from_yield(yield_rate : Double) -> Double

    sign_changes

    fn sign_changes(values : Array[Double], center : Double) -> Int

    Count sign changes around a center line.

    sign_code

    fn sign_code(value : Double, tolerance : Double) -> Int

    simple_random_indices

    fn simple_random_indices(population~ : Int, requested~ : Int, seed~ : Int) -> Array[Int]

    simulate_comparison

    fn simulate_comparison(scenario : ProcessScenario, count : Int) -> (Array[SimulatedPoint], Array[SimulatedPoint])

    Generate a paired baseline and drifted process for comparison.

    simulate_monitor

    fn simulate_monitor(scenario : ProcessScenario, count : Int) -> Int

    Run a simulation through the streaming monitor.

    simulate_process

    fn simulate_process(scenario : ProcessScenario, count : Int) -> Array[SimulatedPoint]

    Generate a deterministic process sequence with optional drift and faults.

    simulated_categories

    fn simulated_categories(count : Int, burst_start : Int, burst_length : Int) -> Array[String]

    Generate a deterministic category stream with a controlled defect burst.

    simulated_centers

    fn simulated_centers(points : Array[SimulatedPoint]) -> Array[Double]

    Extract latent centers from simulated points.

    simulated_noise

    fn simulated_noise(seed : Int) -> Double

    Generate deterministic pseudo-normal noise by summing uniform draws.

    simulated_subgroups

    fn simulated_subgroups(scenario : ProcessScenario, count : Int, width : Int) -> Array[Array[Double]]?

    Build a synthetic subgroup array for chart examples.

    simulated_values

    fn simulated_values(points : Array[SimulatedPoint]) -> Array[Double]

    Extract values from simulated points.

    simulation_alarms

    fn simulation_alarms(points : Array[SimulatedPoint], deviation : Double) -> Int

    Count points beyond three standard deviations from their latent center.

    simulation_causes

    fn simulation_causes(points : Array[SimulatedPoint]) -> Array[CategoryCount]

    Count points by latent cause.

    simulation_defects

    fn simulation_defects(points : Array[SimulatedPoint]) -> Int

    Count simulated specification defects.

    simulation_delta

    fn simulation_delta(first : Array[SimulatedPoint], second : Array[SimulatedPoint]) -> Array[Double]?

    Difference between two simulated sequences.

    simulation_special_causes

    fn simulation_special_causes(points : Array[SimulatedPoint]) -> Int

    Count simulated special causes.

    skewness_value

    fn skewness_value(values : Array[Double]) -> Double

    snapshot_alert_density

    fn snapshot_alert_density(snapshot : DashboardSnapshot) -> Double

    snapshot_average_gap

    fn snapshot_average_gap(snapshot : DashboardSnapshot) -> Double

    snapshot_card

    fn snapshot_card(snapshot : DashboardSnapshot, key : String) -> DashboardCard?

    snapshot_card_count

    fn snapshot_card_count(snapshot : DashboardSnapshot) -> Int

    snapshot_card_statuses

    fn snapshot_card_statuses(snapshot : DashboardSnapshot) -> Array[String]

    snapshot_card_targets

    fn snapshot_card_targets(snapshot : DashboardSnapshot) -> Array[Double]

    snapshot_card_values

    fn snapshot_card_values(snapshot : DashboardSnapshot) -> Array[Double]

    snapshot_completion

    fn snapshot_completion(snapshot : DashboardSnapshot) -> Double

    snapshot_critical_count

    fn snapshot_critical_count(snapshot : DashboardSnapshot) -> Int

    snapshot_failed_cards

    fn snapshot_failed_cards(snapshot : DashboardSnapshot) -> Int

    snapshot_filter_status

    fn snapshot_filter_status(snapshot : DashboardSnapshot, status : String) -> Array[DashboardCard]

    snapshot_filter_unit

    fn snapshot_filter_unit(snapshot : DashboardSnapshot, unit : String) -> Array[DashboardCard]

    snapshot_good_cards

    fn snapshot_good_cards(snapshot : DashboardSnapshot) -> Int

    snapshot_has_key

    fn snapshot_has_key(snapshot : DashboardSnapshot, key : String) -> Bool

    snapshot_health

    fn snapshot_health(snapshot : DashboardSnapshot) -> String

    snapshot_is_empty

    fn snapshot_is_empty(snapshot : DashboardSnapshot) -> Bool

    snapshot_keys

    fn snapshot_keys(snapshot : DashboardSnapshot) -> Array[String]

    snapshot_max_gap

    fn snapshot_max_gap(snapshot : DashboardSnapshot) -> Double

    snapshot_merge

    fn snapshot_merge(left : DashboardSnapshot, right : DashboardSnapshot) -> DashboardSnapshot

    snapshot_quality_score

    fn snapshot_quality_score(snapshot : DashboardSnapshot) -> Double

    snapshot_summary_line

    fn snapshot_summary_line(snapshot : DashboardSnapshot) -> String

    snapshot_target_rate

    fn snapshot_target_rate(snapshot : DashboardSnapshot) -> Double

    fn snapshot_trending_down(snapshot : DashboardSnapshot) -> Int

    fn snapshot_trending_up(snapshot : DashboardSnapshot) -> Int

    snapshot_units

    fn snapshot_units(snapshot : DashboardSnapshot) -> Array[String]

    snapshot_warning_count

    fn snapshot_warning_count(snapshot : DashboardSnapshot) -> Int

    sort_cards_by_gap

    fn sort_cards_by_gap(snapshot : DashboardSnapshot) -> Array[DashboardCard]

    sort_category_counts

    fn sort_category_counts(rows : Array[CategoryCount]) -> Array[CategoryCount]

    Sort category rows by descending contribution.

    sort_events

    fn sort_events(events : Array[MeasurementEvent]) -> Array[MeasurementEvent]

    Sort events by sequence number for deterministic replay.

    sort_failure_modes

    fn sort_failure_modes(modes : Array[FailureMode]) -> Array[FailureMode]

    sort_lines

    fn sort_lines(lines : Array[String]) -> Array[String]

    sort_maintenance_plans

    fn sort_maintenance_plans(plans : Array[MaintenancePlan], current_day : Int) -> Array[MaintenancePlan]

    sort_rows_by_feature

    fn sort_rows_by_feature(matrix : MeasurementMatrix, feature : Int) -> MeasurementMatrix?

    Return a copy of a matrix with rows sorted by a selected feature.

    sort_stages

    fn sort_stages(stages : Array[ProductionStage]) -> Array[ProductionStage]

    sort_work_orders

    fn sort_work_orders(orders : Array[QualityWorkOrder], current_day : Int) -> Array[QualityWorkOrder]

    sorted_copy

    fn sorted_copy(values : Array[Double]) -> Array[Double]

    Robust location and spread estimators used by offline quality reviews.

    split_at

    fn split_at(values : Array[Double], index : Int) -> (Array[Double], Array[Double])

    Split a series at a change-point index.

    squared_distance

    fn squared_distance(row : Array[Double], center : Array[Double]) -> Double?

    Squared Euclidean distance from a row to a center vector.

    squared_error

    fn squared_error(actual : Double, predicted : Double) -> Double

    stability_range

    fn stability_range(values : Array[Double]) -> Double

    stable_round

    fn stable_round(value : Double, digits : Int) -> Double

    stage

    fn stage(name~ : String, duration_hours~ : Double, required_station~ : String, sequence~ : Int) -> ProductionStage

    stage_completion_rate

    fn stage_completion_rate(stages : Array[ProductionStage]) -> Double

    stage_duration

    fn stage_duration(stages : Array[ProductionStage]) -> Double

    stages_for_station

    fn stages_for_station(stages : Array[ProductionStage], station : String) -> Array[ProductionStage]

    standard_error

    fn standard_error(values : Array[Double]) -> Double?

    Standard error of the sample mean.

    standardize_matrix

    fn standardize_matrix(matrix : MeasurementMatrix) -> MeasurementMatrix?

    Standardize each feature independently.

    standardize_values

    fn standardize_values(values : Array[Double], center : Double, scale : Double) -> Array[Double]?

    Apply a center and scale transformation.

    start_work_order

    fn start_work_order(order : QualityWorkOrder) -> QualityWorkOrder

    station_capacity

    fn station_capacity(station~ : String, available_hours~ : Double, planned_hours~ : Double, operators~ : Int) -> StationCapacity

    station_events

    fn station_events(events : Array[MeasurementEvent], station : String) -> Array[MeasurementEvent]

    Return events from one station.

    stock_available

    fn stock_available(lots : Array[MaterialLot]) -> Double

    stock_reserved

    fn stock_reserved(lots : Array[MaterialLot]) -> Double

    stock_total

    fn stock_total(lots : Array[MaterialLot]) -> Double

    stratified_indices

    fn stratified_indices(strata~ : Array[Int], requested~ : Int, seed~ : Int) -> Array[Int]

    subgroup

    fn subgroup(values : Array[Double], width : Int) -> Array[Array[Double]]?

    Split measurements into fixed-size groups without silently dropping a tail.

    sum_of

    fn sum_of(values : Array[Double]) -> Double

    Additional descriptive statistics for quality engineers.

    summarize

    fn summarize(groups : Array[Subgroup], specification? : Specification) -> SummaryResult

    Summarize manufacturing observations across one or more subgroups.

    summarize_lot_feature

    fn summarize_lot_feature(feature : LotFeature, specification : Specification?) -> LotFeatureSummary

    Summarize a grouped lot feature against an optional specification.

    summarize_lot_features

    fn summarize_lot_features(features : Array[LotFeature], specification : Specification?) -> Array[LotFeatureSummary]

    Summarize every lot feature in a deterministic order.

    summarize_simulation

    fn summarize_simulation(scenario : ProcessScenario, points : Array[SimulatedPoint]) -> SimulationSummary

    Summarize a simulation result.

    summary_section

    fn summary_section(summary : Summary) -> ReportSection

    Build a summary section from one statistical summary.

    supported_sampling_methods

    fn supported_sampling_methods() -> Array[SamplingMethod]

    Return the supported strategies for configuration UIs.

    symmetric_percentage_error

    fn symmetric_percentage_error(actual : Array[Double], predicted : Array[Double]) -> Double?

    Symmetric mean absolute percentage error.

    systematic_indices

    fn systematic_indices(population~ : Int, requested~ : Int, offset~ : Int) -> Array[Int]

    total_available_hours

    fn total_available_hours(capacities : Array[StationCapacity]) -> Double

    total_planned_hours

    fn total_planned_hours(capacities : Array[StationCapacity]) -> Double

    traceability_check

    fn traceability_check(events : Array[AuditEvent]) -> TraceabilityResult

    trend_alert_count

    fn trend_alert_count(alerts : Array[TrendAlert]) -> Int

    trend_confidence

    fn trend_confidence(values : Array[Double], slope : Double) -> Double

    trend_direction

    fn trend_direction(values : Array[Double]) -> Int

    trend_direction_code

    fn trend_direction_code(slope : Double, tolerance : Double) -> Int

    trend_direction_name

    fn trend_direction_name(direction : Int) -> String

    trend_relative_change

    fn trend_relative_change(values : Array[Double]) -> Double

    trend_severity

    fn trend_severity(alert : TrendAlert) -> String

    trend_slope

    fn trend_slope(values : Array[Double]) -> Double

    trend_total_change

    fn trend_total_change(values : Array[Double]) -> Double

    trend_turning_points

    fn trend_turning_points(values : Array[Double]) -> Int

    trimmed

    fn trimmed(values : Array[Double], fraction : Double) -> Array[Double]?

    Remove a symmetric fraction of the smallest and largest observations.

    truncate_text

    fn truncate_text(text : String, limit : Int) -> String

    ts_autocorrelation

    fn ts_autocorrelation(values : Array[Double], lag : Int) -> Double

    ts_autocovariance

    fn ts_autocovariance(values : Array[Double], lag : Int) -> Double

    ts_centered

    fn ts_centered(values : Array[Double], window : Int) -> Array[Double]

    ts_count_crossings

    fn ts_count_crossings(values : Array[Double], level : Double) -> Int

    ts_detrend

    fn ts_detrend(values : Array[Double]) -> Array[Double]

    ts_difference

    fn ts_difference(values : Array[Double], lag : Int) -> Array[Double]

    ts_downsample

    fn ts_downsample(values : Array[Double], step : Int) -> Array[Double]

    ts_first

    fn ts_first(values : Array[Double], fallback : Double) -> Double

    ts_last

    fn ts_last(values : Array[Double], fallback : Double) -> Double

    ts_mean

    fn ts_mean(values : Array[Double]) -> Double

    ts_moving_max

    fn ts_moving_max(values : Array[Double], window : Int) -> Array[Double]

    ts_moving_min

    fn ts_moving_min(values : Array[Double], window : Int) -> Array[Double]

    ts_moving_range

    fn ts_moving_range(values : Array[Double], window : Int) -> Array[Double]

    ts_pad

    fn ts_pad(values : Array[Double], length : Int, fill : Double) -> Array[Double]

    ts_peak_index

    fn ts_peak_index(values : Array[Double]) -> Int

    ts_range

    fn ts_range(values : Array[Double]) -> Double

    ts_seasonal_difference

    fn ts_seasonal_difference(values : Array[Double], period : Int) -> Array[Double]

    ts_trough_index

    fn ts_trough_index(values : Array[Double]) -> Int

    unique_features

    fn unique_features(events : Array[MeasurementEvent]) -> Array[String]

    Return unique feature identifiers.

    unique_lines

    fn unique_lines(lines : Array[String]) -> Array[String]

    unique_stations

    fn unique_stations(events : Array[MeasurementEvent]) -> Array[String]

    Return unique station identifiers.

    valid_indices

    fn valid_indices(indices : Array[Int], population : Int) -> Bool

    validate_contract

    fn validate_contract(contract : DataContract, fields : Array[String], row_count : Int, missing_cells : Int, total_cells : Int, keys : Array[String]) -> ContractResult

    validate_counts

    fn validate_counts(counts : Array[Int], exposures : Array[Int]) -> Array[ValidationIssue]

    Validate non-negative counts and positive exposure values.

    validate_event_sequences

    fn validate_event_sequences(events : Array[MeasurementEvent]) -> Array[ValidationIssue]

    Validate event sequences for duplicate or negative sequence numbers.

    validate_specification

    fn validate_specification(specification : Specification) -> Array[ValidationIssue]

    Validate a specification before capability analysis.

    validate_subgroups

    fn validate_subgroups(groups : Array[Subgroup]) -> Array[ValidationIssue]

    Validate traceability fields and measurement cardinality.

    values_from_events

    fn values_from_events(events : Array[MeasurementEvent]) -> Array[Double]

    Build a feature's values from event records.

    variance_ratio

    fn variance_ratio(values : Array[Double], split : Int) -> Double

    violation_section

    fn violation_section(violations : Array[RuleViolation]) -> ReportSection

    Build a violation section.

    wear_percentage

    fn wear_percentage(point : ToolLifePoint) -> Double

    Estimate a normalized wear percentage.

    wear_trend

    fn wear_trend(points : Array[ToolLifePoint]) -> Trend?

    Fit a linear wear trend against runtime.

    wear_warning

    fn wear_warning(point : ToolLifePoint, fraction : Double) -> Bool

    Return a warning when wear reaches a configurable fraction.

    weighted_average

    fn weighted_average(values : Array[Double], weights : Array[Double]) -> Double

    weighted_defect_score

    fn weighted_defect_score(categories : Array[String], weights : Array[(String, Double)]) -> Double

    Weighted severity score for defect categories.

    weighted_mean

    fn weighted_mean(values : Array[Double], weights : Array[Double]) -> Double?

    weighted_row_score

    fn weighted_row_score(row : Array[Double], weights : Array[Double]) -> Double?

    Weighted linear combination of features for a scorecard.

    weighted_scores

    fn weighted_scores(matrix : MeasurementMatrix, weights : Array[Double]) -> Array[Double]?

    Scores for every row under a weighted feature model.

    window_deviations

    fn window_deviations(windows : Array[QualityWindow]) -> Array[Double]

    Summarize multiple windows into their sample deviations.

    window_from_groups

    fn window_from_groups(groups : Array[Subgroup], specification? : Specification) -> QualityWindow?

    Create a window from a subgroup collection while preserving the first batch id.

    window_means

    fn window_means(windows : Array[QualityWindow]) -> Array[Double]

    Summarize multiple windows into their means.

    windows_from_values

    fn windows_from_values(values : Array[Double], width : Int, specification? : Specification) -> Array[QualityWindow]?

    Build independent windows from a flat sequence.

    winsorize_values

    fn winsorize_values(values : Array[Double], multiplier~ : Double) -> CleanResult

    Replace robust outliers with the nearest fence boundary.

    winsorized

    fn winsorized(values : Array[Double], fraction : Double) -> Array[Double]?

    Replace tail observations with the nearest retained quantile.

    within_mask

    fn within_mask(values : Array[Double], lower : Double, upper : Double) -> Array[Bool]

    Return a boolean mask for values within a closed interval.

    word_count

    fn word_count(text : String) -> Int

    work_order_efficiency

    fn work_order_efficiency(order : QualityWorkOrder) -> Double

    work_order_is_overdue

    fn work_order_is_overdue(order : QualityWorkOrder, current_day : Int) -> Bool

    work_order_score

    fn work_order_score(order : QualityWorkOrder, current_day : Int) -> Double

    work_orders_for_lot

    fn work_orders_for_lot(orders : Array[QualityWorkOrder], lot_id : String) -> Array[QualityWorkOrder]

    yield_from_ppm

    fn yield_from_ppm(ppm : Double) -> Double

    z_scores

    fn z_scores(values : Array[Double], center : Double, deviation : Double) -> Array[Double]?

    Population z-scores using the supplied baseline center and deviation.