openehr_adl/lib.rs
1// SPDX-FileCopyrightText: Cadasto B.V.
2// SPDX-License-Identifier: BUSL-1.1
3
4//! openEHR ADL 2.4.0 — the hand-written ADL2 engine: ADL2/cADL/ODIN source
5//! parser, the AOM2 validation catalogue, specialisation flattening, OPT2
6//! generation, and ADL 1.4→2 conversion, built over the generated
7//! `openehr_am::v2_4` object model.
8//!
9//! Spec oracle: `docs/specs/openehr/AM/docs/{ADL2,AOM2,OPT2}/` (+ the ODIN
10//! spec at `docs/specs/openehr/LANG/docs/odin/`). The normative ANTLR4
11//! grammars are vendored under `vendor/grammar/` (version-scoped by AM
12//! generation: `v1_4/`, `v2_4/`) as reference input for the
13//! hand-written `logos`/`chumsky` implementation — no ANTLR runtime.
14//!
15//! Components: the outer artefact parser ([`source`]), the shared typed
16//! [`error`] catalogue, and the cADL definition-section parser ([`parse`]) that
17//! builds the `openehr_am::v2_4::aom2` constraint model. The substrate under
18//! them is [`aom`] (field accessors, constructors, interval arithmetic),
19//! [`artefact`] (artefact views + the parent/supplier repository), [`hrid`] (the
20//! archetype-id grammar) and [`odin`] (the ODIN reading bridge). Above them:
21//! [`codes`]/[`paths`], [`validate`], [`flatten`] + [`opt`], the ADL2 serializer
22//! [`mod@print`], and [`adl14`] (1.4→2 conversion — our own design/extension, no
23//! openEHR spec).
24//!
25//! The crate has NO lexer of its own: the cADL token stream is the shared
26//! workspace lexical layer under its ADL reading
27//! ([`openehr_lang::v1_1::lexer::lex`]), and ODIN sections go through the
28//! `openehr_lang::v1_1::odin` reader. The `rules` body and the slot
29//! include/exclude assertions are BEL expression trees ([`rules`]) whose string
30//! form is rendered back from the tree ([`print::assertion_text`]), never parsed
31//! out of it.
32
33// Doctests are copy-paste templates: they must use `?`, never unwrap
34// (C-QUESTION-MARK, https://rust-lang.github.io/api-guidelines/documentation.html#c-question-mark).
35#![doc(test(attr(deny(warnings))))]
36pub mod adl14;
37pub mod aom;
38pub mod artefact;
39pub mod assemble;
40pub mod codes;
41pub mod error;
42pub mod flatten;
43pub mod hrid;
44pub mod meta;
45pub mod odin;
46pub mod opt;
47pub mod parse;
48pub mod paths;
49pub mod print;
50pub mod rules;
51pub mod source;
52pub mod validate;
53
54/// The openEHR specification version this crate implements.
55///
56/// The pin is deliberately independent of the crates.io package version,
57/// which is the crate's own `SemVer` line and moves only with this
58/// implementation's code.
59pub const SPEC_VERSION: &str = "2.4.0";