1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! # OpenECS — the Open EEG Codec Standard
//!
//! OpenECS is a vendor-neutral, codec-agnostic benchmark for evaluating EEG
//! compression quality. Any codec — lossless, lossy, neural, classical, hybrid,
//! in any language — can declare compliance with an OpenECS quality tier by
//! passing the standard test suite against a hash-pinned holdout corpus. No
//! self-reported numbers, no cherry-picked patients: standardized corpus,
//! standardized metrics, deterministic pass/fail.
//!
//! The crate is `open-eeg-codec-standard`; the library is `open_eeg_codec_standard`; the
//! reference CLI is `openecs`.
//!
//! ## Tiers (strictness order L < N < C < M < A)
//!
//! | Tier | Name | Intent |
//! |------|---------------|-------------------------------------------------|
//! | L | Lossless | bit-exact reconstruction (PRD == 0 exactly) |
//! | N | Near-Lossless | small error, shape preserved (R≥0.99, PRD≤5 %) |
//! | C | Clinical | a neurologist cannot distinguish the recon |
//! | M | Monitoring | automated analysis preserved |
//! | A | Alerting | event detection preserved |
//!
//! A codec declares e.g. "I am ECS-C compliant at CR=42:1" and the harness
//! verifies or rejects the claim. Grades render as `ECS-<tier>`.
//!
//! ## Layout
//!
//! - [`levels`] — the spec: tier table + the `grade` gate logic.
//! - [`metrics`] — canonical metric formulas (PRD, Pearson R, SNR, CR…).
//! - [`bands`] — per-EEG-band fidelity helpers.
//! - [`adapter`] — the `Codec` trait + reference adapters (store, gzip, zstd).
//! - [`adapters_external`] — the file-based contract for ANY external codec.
//! - [`harness`] — the compliance grader + corpus runner.
//! - [`corpus`] / [`manifest`] — hash-pinned corpus + codec manifests.
//! - [`report`] / [`report_html`] — submission JSON + the HTML report.
//! - [`term`] / [`charts`] / [`stats`] — terminal read-out, charts, CIs.
/// The OpenECS specification version this crate implements (see `SPEC/`).
/// Stamped onto every emitted report and submission. The tier ladder
/// L < N < C < M < A is part of OpenECS v1.0.
pub const SPEC_VERSION: &str = "1.0";
/// The major component of [`SPEC_VERSION`]. A grader accepts a manifest whose
/// major is this or older, and refuses a newer major it does not implement
/// (see the spec's version policy).
pub const SPEC_MAJOR: u64 = 1;
/// Parse the major component of a `"MAJOR.MINOR"` spec-version string.