openehr-am 0.0.129

openEHR AM Archetype Model, generated from BMM: generations v1_4 (AM 1.4.0, ADL 1.4) and v2_4 (AM 2.4.0, ADL 2; current)
Documentation
// @generated by openehr-codegen from BMM (`ADL_CODE_DEFINITIONS`) — DO NOT EDIT.
// SPDX-FileCopyrightText: Cadasto B.V.
// SPDX-FileCopyrightText: openEHR Foundation
// SPDX-License-Identifier: Apache-2.0
// Hand-written spec functions/invariants live in the sibling `*_impl.rs`.

//! The openEHR `ADL_CODE_DEFINITIONS` spec class, generated from the vendored BMM
//! meta-model.

use crate::v2_4::aom2::constraint_model::archetype_slot::ArchetypeSlot;
use crate::v2_4::aom2::constraint_model::c_attribute::CAttribute;
use crate::v2_4::aom2::constraint_model::c_complex_object::CComplexObject;
use crate::v2_4::aom2::constraint_model::c_complex_object_proxy::CComplexObjectProxy;
use crate::v2_4::aom2::constraint_model::primitive::c_boolean::CBoolean;
use crate::v2_4::aom2::constraint_model::primitive::c_date::CDate;
use crate::v2_4::aom2::constraint_model::primitive::c_date_time::CDateTime;
use crate::v2_4::aom2::constraint_model::primitive::c_duration::CDuration;
use crate::v2_4::aom2::constraint_model::primitive::c_integer::CInteger;
use crate::v2_4::aom2::constraint_model::primitive::c_real::CReal;
use crate::v2_4::aom2::constraint_model::primitive::c_string::CString;
use crate::v2_4::aom2::constraint_model::primitive::c_terminology_code::CTerminologyCode;
use crate::v2_4::aom2::constraint_model::primitive::c_time::CTime;

/// Definitions relating to the internal code system of archetypes.
///
/// NOTE: ADL2 was initially released with code system using id-codes (for nodes), at-codes (for values only) and ac-codes (for value sets). As this proved to hinder its widespread use in the openEHR community (due to its impact on existing openEHR RM data), a code system matching the one used in ADL1.4 was introduced as the openEHR primary code system.
///
/// openEHR systems must support at least the at-coded ADL2 archetypes.
#[doc(alias = "ADL_CODE_DEFINITIONS")]
#[derive(Debug, Clone, PartialEq)]
pub struct AdlCodeDefinitionsData {}

impl AdlCodeDefinitionsData {
    /// String leader of ‘identifier’ codes, i.e. codes used to identify at-coded archetype nodes.
    /// BMM constant `At_code_leader`.
    pub const AT_CODE_LEADER: &str = "at";

    /// String leader of ‘identifier’ codes, i.e. codes used to identify id-coded archetype nodes.
    /// BMM constant `Id_code_leader`.
    pub const ID_CODE_LEADER: &str = "id";

    /// String leader of ‘value’ codes, i.e. codes used to identify codes values, including value set members.
    /// BMM constant `Value_code_leader`.
    pub const VALUE_CODE_LEADER: &str = "at";

    /// String leader of ‘value set’ codes, i.e. codes used to identify value sets.
    /// BMM constant `Value_set_code_leader`.
    pub const VALUE_SET_CODE_LEADER: &str = "ac";

    /// Character used to separate numeric parts of codes belonging to different specialisation levels.
    /// BMM constant `Specialisation_separator`.
    pub const SPECIALISATION_SEPARATOR: char = '.';

    /// Regex used to define the legal numeric part of any archetype code. Corresponds to the simple pattern of dotted numbers, as used in typical multi-level numbering schemes.
    /// BMM constant `Code_regex_pattern`.
    pub const CODE_REGEX_PATTERN: &str = "(0|[1-9][0-9]*)(\\.(0|[1-9][0-9]*))*";

    /// Regex pattern of the root code of any archetype.
    ///
    /// Corresponds to at-codes of the form `at0000`, `at0000.1`, `at0000.1.1` etc, and id-codes of the form `id1`, `id1.1`, `id1.1.1` etc. For at-coded ADL2 numbering starts with zero (i.e. `at0000`) while the id-coded ADL2 numbering starts with one (i.e. `id1`).
    /// BMM constant `Root_code_regex_pattern`.
    pub const ROOT_CODE_REGEX_PATTERN: &str = "^(id1|at0000)(\\.1)*$";

    /// Code id used for `C_PRIMITIVE_OBJECT` nodes on creation.
    ///
    /// NOTE: For id-coded archetypes this is `"id9999"`.
    /// BMM constant `Primitive_node_id`.
    pub const PRIMITIVE_NODE_ID: &str = "at9999";
}

/// Polymorphic slot of `ADL_CODE_DEFINITIONS`, dispatched on each payload's `_type`.
///
/// Definitions relating to the internal code system of archetypes.
///
/// NOTE: ADL2 was initially released with code system using id-codes (for nodes), at-codes (for values only) and ac-codes (for value sets). As this proved to hinder its widespread use in the openEHR community (due to its impact on existing openEHR RM data), a code system matching the one used in ADL1.4 was introduced as the openEHR primary code system.
///
/// openEHR systems must support at least the at-coded ADL2 archetypes.
#[doc(alias = "ADL_CODE_DEFINITIONS")]
#[derive(Debug, Clone, PartialEq)]
pub enum AdlCodeDefinitions {
    /// The `ARCHETYPE_SLOT` subtype of `ADL_CODE_DEFINITIONS`.
    ArchetypeSlot(ArchetypeSlot),
    /// The `C_ATTRIBUTE` subtype of `ADL_CODE_DEFINITIONS`.
    CAttribute(CAttribute),
    /// The `C_BOOLEAN` subtype of `ADL_CODE_DEFINITIONS`.
    CBoolean(CBoolean),
    /// The `C_COMPLEX_OBJECT` subtype of `ADL_CODE_DEFINITIONS`.
    CComplexObject(CComplexObject),
    /// The `C_COMPLEX_OBJECT_PROXY` subtype of `ADL_CODE_DEFINITIONS`.
    CComplexObjectProxy(CComplexObjectProxy),
    /// The `C_DATE` subtype of `ADL_CODE_DEFINITIONS`.
    CDate(CDate),
    /// The `C_DATE_TIME` subtype of `ADL_CODE_DEFINITIONS`.
    CDateTime(CDateTime),
    /// The `C_DURATION` subtype of `ADL_CODE_DEFINITIONS`.
    CDuration(CDuration),
    /// The `C_INTEGER` subtype of `ADL_CODE_DEFINITIONS`.
    CInteger(CInteger),
    /// The `C_REAL` subtype of `ADL_CODE_DEFINITIONS`.
    CReal(CReal),
    /// The `C_STRING` subtype of `ADL_CODE_DEFINITIONS`.
    CString(CString),
    /// The `C_TERMINOLOGY_CODE` subtype of `ADL_CODE_DEFINITIONS`.
    CTerminologyCode(CTerminologyCode),
    /// The `C_TIME` subtype of `ADL_CODE_DEFINITIONS`.
    CTime(CTime),
    /// An instance of `ADL_CODE_DEFINITIONS` itself (its own, least-rich form).
    AdlCodeDefinitions(AdlCodeDefinitionsData),
}