#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
clippy::all,
clippy::pedantic,
clippy::nursery,
reason = "mechanically generated model text: the XSD is emitted in full under its own spec-owned element/attribute spellings, so naming, style and dead-code lints do not apply — the hand-written runtime carries the lint bar"
)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct UnknownFacetValue {
pub simple_type: &'static str,
pub value: String,
}
impl std::fmt::Display for UnknownFacetValue {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{:?} is not a declared xs:enumeration value of {}",
self.value, self.simple_type
)
}
}
impl std::error::Error for UnknownFacetValue {}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum OperatorKind {
Equal,
NotEqual,
LessThanOrEqual,
LessThan,
GreaterThanOrEqual,
GreaterThan,
Matches,
Not,
And,
Or,
Xor,
Implies,
ForAll,
Exists,
Plus,
Minus,
Multiply,
Divide,
Exponent,
}
impl OperatorKind {
pub const fn as_wire(&self) -> &'static str {
match self {
Self::Equal => "2001",
Self::NotEqual => "2002",
Self::LessThanOrEqual => "2003",
Self::LessThan => "2004",
Self::GreaterThanOrEqual => "2005",
Self::GreaterThan => "2006",
Self::Matches => "2007",
Self::Not => "2010",
Self::And => "2011",
Self::Or => "2012",
Self::Xor => "2013",
Self::Implies => "2014",
Self::ForAll => "2015",
Self::Exists => "2016",
Self::Plus => "2020",
Self::Minus => "2021",
Self::Multiply => "2022",
Self::Divide => "2023",
Self::Exponent => "2024",
}
}
pub fn from_wire(text: &str) -> Result<Self, UnknownFacetValue> {
match text {
"2001" => Ok(Self::Equal),
"2002" => Ok(Self::NotEqual),
"2003" => Ok(Self::LessThanOrEqual),
"2004" => Ok(Self::LessThan),
"2005" => Ok(Self::GreaterThanOrEqual),
"2006" => Ok(Self::GreaterThan),
"2007" => Ok(Self::Matches),
"2010" => Ok(Self::Not),
"2011" => Ok(Self::And),
"2012" => Ok(Self::Or),
"2013" => Ok(Self::Xor),
"2014" => Ok(Self::Implies),
"2015" => Ok(Self::ForAll),
"2016" => Ok(Self::Exists),
"2020" => Ok(Self::Plus),
"2021" => Ok(Self::Minus),
"2022" => Ok(Self::Multiply),
"2023" => Ok(Self::Divide),
"2024" => Ok(Self::Exponent),
_ => Err(UnknownFacetValue {
simple_type: "OPERATOR_KIND",
value: text.to_owned(),
}),
}
}
}
impl std::fmt::Display for OperatorKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_wire())
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ProportionKind {
PkRatio,
PkUnitary,
PkPercent,
PkFraction,
PkIntegerFraction,
}
impl ProportionKind {
pub const fn as_wire(&self) -> &'static str {
match self {
Self::PkRatio => "0",
Self::PkUnitary => "1",
Self::PkPercent => "2",
Self::PkFraction => "3",
Self::PkIntegerFraction => "4",
}
}
pub fn from_wire(text: &str) -> Result<Self, UnknownFacetValue> {
match text {
"0" => Ok(Self::PkRatio),
"1" => Ok(Self::PkUnitary),
"2" => Ok(Self::PkPercent),
"3" => Ok(Self::PkFraction),
"4" => Ok(Self::PkIntegerFraction),
_ => Err(UnknownFacetValue {
simple_type: "PROPORTION_KIND",
value: text.to_owned(),
}),
}
}
}
impl std::fmt::Display for ProportionKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_wire())
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ValidityKind {
Mandatory,
Optional,
Disallowed,
}
impl ValidityKind {
pub const fn as_wire(&self) -> &'static str {
match self {
Self::Mandatory => "1001",
Self::Optional => "1002",
Self::Disallowed => "1003",
}
}
pub fn from_wire(text: &str) -> Result<Self, UnknownFacetValue> {
match text {
"1001" => Ok(Self::Mandatory),
"1002" => Ok(Self::Optional),
"1003" => Ok(Self::Disallowed),
_ => Err(UnknownFacetValue {
simple_type: "VALIDITY_KIND",
value: text.to_owned(),
}),
}
}
}
impl std::fmt::Display for ValidityKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_wire())
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Annotation {
pub path: String,
pub items: indexmap::IndexMap<String, String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Archetype {
pub original_language: openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase,
pub is_controlled: Option<bool>,
pub description: Option<ResourceDescription>,
pub translations: Vec<TranslationDetails>,
pub revision_history:
Option<openehr_rm::v1_2::common::generic::revision_history::RevisionHistory>,
pub uid: Option<openehr_base::v1_3::base_types::identification::hier_object_id::HierObjectId>,
pub archetype_id: openehr_base::v1_3::base_types::identification::archetype_id::ArchetypeId,
pub adl_version: Option<String>,
pub concept: String,
pub parent_archetype_id:
Option<openehr_base::v1_3::base_types::identification::archetype_id::ArchetypeId>,
pub definition: CComplexObject,
pub invariants: Vec<Assertion>,
pub ontology: ArchetypeOntology,
}
#[derive(Debug, Clone, PartialEq)]
pub enum ArchetypeConstraint {
ArchetypeInternalRef(ArchetypeInternalRef),
ArchetypeSlot(ArchetypeSlot),
ConstraintRef(ConstraintRef),
CArchetypeRoot(CArchetypeRoot),
CCodePhrase(CCodePhrase),
CCodeReference(CCodeReference),
CComplexObject(CComplexObject),
CDefinedObject(CDefinedObject),
CDvOrdinal(CDvOrdinal),
CDvQuantity(CDvQuantity),
CDvState(CDvState),
CMultipleAttribute(CMultipleAttribute),
CPrimitiveObject(CPrimitiveObject),
CSingleAttribute(CSingleAttribute),
TComplexObject(TComplexObject),
}
#[derive(Debug, Clone, PartialEq)]
pub struct ArchetypeInternalRef {
pub rm_type_name: String,
pub occurrences: Intervalofinteger,
pub node_id: String,
pub target_path: String,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ArchetypeOntology {
pub term_definitions: Vec<Codedefinitionset>,
pub constraint_definitions: Vec<Codedefinitionset>,
pub term_bindings: Vec<Termbindingset>,
pub constraint_bindings: Vec<Constraintbindingset>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ArchetypeSlot {
pub rm_type_name: String,
pub occurrences: Intervalofinteger,
pub node_id: String,
pub includes: Vec<Assertion>,
pub excludes: Vec<Assertion>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ArchetypeTerm {
pub code: String,
pub items: indexmap::IndexMap<String, String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Assertion {
pub tag: Option<String>,
pub string_expression: Option<String>,
pub expression: Box<ExprItem>,
pub variables: Vec<AssertionVariable>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct AssertionVariable {
pub name: String,
pub definition: String,
}
#[derive(Debug, Clone, PartialEq)]
pub enum AuthoredResource {
Archetype(Archetype),
}
#[derive(Debug, Clone, PartialEq)]
pub struct Cardinality {
pub is_ordered: bool,
pub is_unique: bool,
pub interval: Intervalofinteger,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ConstraintBindingItem {
pub code: String,
pub value: String,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ConstraintRef {
pub rm_type_name: String,
pub occurrences: Intervalofinteger,
pub node_id: String,
pub reference: String,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CArchetypeRoot {
pub rm_type_name: String,
pub occurrences: Intervalofinteger,
pub node_id: String,
pub attributes: Vec<CAttribute>,
pub archetype_id: openehr_base::v1_3::base_types::identification::archetype_id::ArchetypeId,
pub template_id:
Option<openehr_base::v1_3::base_types::identification::template_id::TemplateId>,
pub term_definitions: Vec<ArchetypeTerm>,
pub term_bindings: Vec<Termbindingset>,
}
#[derive(Debug, Clone, PartialEq)]
pub enum CAttribute {
CMultipleAttribute(CMultipleAttribute),
CSingleAttribute(CSingleAttribute),
}
#[derive(Debug, Clone, PartialEq)]
pub struct CBoolean {
pub true_valid: bool,
pub false_valid: bool,
pub assumed_value: Option<bool>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CCodePhrase {
pub rm_type_name: String,
pub occurrences: Intervalofinteger,
pub node_id: String,
pub assumed_value: Option<openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase>,
pub terminology_id:
Option<openehr_base::v1_3::base_types::identification::terminology_id::TerminologyId>,
pub code_list: Vec<String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CCodeReference {
pub rm_type_name: String,
pub occurrences: Intervalofinteger,
pub node_id: String,
pub assumed_value: Option<openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase>,
pub terminology_id:
Option<openehr_base::v1_3::base_types::identification::terminology_id::TerminologyId>,
pub code_list: Vec<String>,
pub referenceSetUri: String,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CComplexObject {
pub rm_type_name: String,
pub occurrences: Intervalofinteger,
pub node_id: String,
pub attributes: Vec<CAttribute>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CDate {
pub pattern: Option<String>,
pub timezone_validity: Option<ValidityKind>,
pub range: Option<Intervalofdate>,
pub assumed_value: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CDateTime {
pub pattern: Option<String>,
pub timezone_validity: Option<ValidityKind>,
pub range: Option<Intervalofdatetime>,
pub assumed_value: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CDefinedObject {
pub rm_type_name: String,
pub occurrences: Intervalofinteger,
pub node_id: String,
}
#[derive(Debug, Clone, PartialEq)]
pub enum CDomainType {
CCodePhrase(CCodePhrase),
CCodeReference(CCodeReference),
CDvOrdinal(CDvOrdinal),
CDvQuantity(CDvQuantity),
CDvState(CDvState),
}
#[derive(Debug, Clone, PartialEq)]
pub struct CDuration {
pub pattern: Option<String>,
pub range: Option<Intervalofduration>,
pub assumed_value: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CDvOrdinal {
pub rm_type_name: String,
pub occurrences: Intervalofinteger,
pub node_id: String,
pub assumed_value: Option<openehr_rm::v1_2::data_types::quantity::dv_ordinal::DvOrdinal>,
pub list: Vec<openehr_rm::v1_2::data_types::quantity::dv_ordinal::DvOrdinal>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CDvQuantity {
pub rm_type_name: String,
pub occurrences: Intervalofinteger,
pub node_id: String,
pub assumed_value: Option<openehr_rm::v1_2::data_types::quantity::dv_quantity::DvQuantity>,
pub property: Option<openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase>,
pub list: Vec<CQuantityItem>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CDvState {
pub rm_type_name: String,
pub occurrences: Intervalofinteger,
pub node_id: String,
pub assumed_value: Option<openehr_rm::v1_2::data_types::basic::dv_state::DvState>,
pub value: StateMachine,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CInteger {
pub list: Vec<i32>,
pub range: Option<Intervalofinteger>,
pub assumed_value: Option<i32>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CMultipleAttribute {
pub rm_attribute_name: String,
pub existence: Intervalofinteger,
pub children: Vec<CObject>,
pub cardinality: Cardinality,
}
#[derive(Debug, Clone, PartialEq)]
pub enum CObject {
ArchetypeInternalRef(ArchetypeInternalRef),
ArchetypeSlot(ArchetypeSlot),
ConstraintRef(ConstraintRef),
CArchetypeRoot(CArchetypeRoot),
CCodePhrase(CCodePhrase),
CCodeReference(CCodeReference),
CComplexObject(CComplexObject),
CDefinedObject(CDefinedObject),
CDvOrdinal(CDvOrdinal),
CDvQuantity(CDvQuantity),
CDvState(CDvState),
CPrimitiveObject(CPrimitiveObject),
TComplexObject(TComplexObject),
}
#[derive(Debug, Clone, PartialEq)]
pub enum CPrimitive {
CBoolean(CBoolean),
CDate(CDate),
CDateTime(CDateTime),
CDuration(CDuration),
CInteger(CInteger),
CReal(CReal),
CString(CString),
CTime(CTime),
}
#[derive(Debug, Clone, PartialEq)]
pub struct CPrimitiveObject {
pub rm_type_name: String,
pub occurrences: Intervalofinteger,
pub node_id: String,
pub item: Option<Box<CPrimitive>>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CQuantityItem {
pub magnitude: Option<Intervalofreal>,
pub precision: Option<Intervalofinteger>,
pub units: String,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CReal {
pub list: Vec<f64>,
pub range: Option<Intervalofreal>,
pub assumed_value: Option<f64>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CSingleAttribute {
pub rm_attribute_name: String,
pub existence: Intervalofinteger,
pub children: Vec<CObject>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CString {
pub pattern: Option<String>,
pub list: Vec<String>,
pub list_open: Option<bool>,
pub assumed_value: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CTime {
pub pattern: Option<String>,
pub timezone_validity: Option<ValidityKind>,
pub range: Option<Intervaloftime>,
pub assumed_value: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Codedefinitionset {
pub language: String,
pub items: Vec<ArchetypeTerm>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Constraintbindingset {
pub terminology: String,
pub items: Vec<ConstraintBindingItem>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ExprBinaryOperator {
pub r#type: String,
pub operator: OperatorKind,
pub precedence_overridden: bool,
pub left_operand: Box<ExprItem>,
pub right_operand: Box<ExprItem>,
}
#[derive(Debug, Clone, PartialEq)]
pub enum ExprItem {
ExprBinaryOperator(ExprBinaryOperator),
ExprLeaf(ExprLeaf),
ExprUnaryOperator(ExprUnaryOperator),
}
#[derive(Debug, Clone, PartialEq)]
pub struct ExprLeaf {
pub r#type: String,
pub item: crate::xml::runtime::XmlAny,
pub reference_type: String,
}
#[derive(Debug, Clone, PartialEq)]
pub enum ExprOperator {
ExprBinaryOperator(ExprBinaryOperator),
ExprUnaryOperator(ExprUnaryOperator),
}
#[derive(Debug, Clone, PartialEq)]
pub struct ExprUnaryOperator {
pub r#type: String,
pub operator: OperatorKind,
pub precedence_overridden: bool,
pub operand: Box<ExprItem>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct FlatArchetypeOntology {
pub archetype_id: String,
pub term_definitions: Vec<Codedefinitionset>,
pub constraint_definitions: Vec<Codedefinitionset>,
pub term_bindings: Vec<Termbindingset>,
pub constraint_bindings: Vec<Constraintbindingset>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Intervalofdate {
pub lower_included: Option<bool>,
pub upper_included: Option<bool>,
pub lower_unbounded: bool,
pub upper_unbounded: bool,
pub lower: Option<String>,
pub upper: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Intervalofdatetime {
pub lower_included: Option<bool>,
pub upper_included: Option<bool>,
pub lower_unbounded: bool,
pub upper_unbounded: bool,
pub lower: Option<String>,
pub upper: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Intervalofduration {
pub lower_included: Option<bool>,
pub upper_included: Option<bool>,
pub lower_unbounded: bool,
pub upper_unbounded: bool,
pub lower: Option<String>,
pub upper: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Intervalofinteger {
pub lower_included: Option<bool>,
pub upper_included: Option<bool>,
pub lower_unbounded: bool,
pub upper_unbounded: bool,
pub lower: Option<i32>,
pub upper: Option<i32>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Intervalofreal {
pub lower_included: Option<bool>,
pub upper_included: Option<bool>,
pub lower_unbounded: bool,
pub upper_unbounded: bool,
pub lower: Option<f64>,
pub upper: Option<f64>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Intervaloftime {
pub lower_included: Option<bool>,
pub upper_included: Option<bool>,
pub lower_unbounded: bool,
pub upper_unbounded: bool,
pub lower: Option<String>,
pub upper: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct NonTerminalState {
pub name: String,
pub transitions: Vec<Transition>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct OperationalTemplate {
pub language: openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase,
pub is_controlled: Option<bool>,
pub description: Option<ResourceDescription>,
pub revision_history:
Option<openehr_rm::v1_2::common::generic::revision_history::RevisionHistory>,
pub uid: Option<openehr_base::v1_3::base_types::identification::hier_object_id::HierObjectId>,
pub template_id: openehr_base::v1_3::base_types::identification::template_id::TemplateId,
pub concept: String,
pub definition: CArchetypeRoot,
pub ontology: Option<FlatArchetypeOntology>,
pub component_ontologies: Vec<FlatArchetypeOntology>,
pub annotations: Vec<Annotation>,
pub constraints: Option<TConstraint>,
pub view: Option<crate::xml::runtime::XmlAny>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ResourceDescription {
pub original_author: indexmap::IndexMap<String, String>,
pub other_contributors: Vec<String>,
pub lifecycle_state: String,
pub resource_package_uri: Option<String>,
pub other_details: Option<indexmap::IndexMap<String, String>>,
pub details: Vec<ResourceDescriptionItem>,
pub parent_resource: Option<Box<AuthoredResource>>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ResourceDescriptionItem {
pub language: openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase,
pub purpose: String,
pub keywords: Vec<String>,
pub use_: Option<String>,
pub misuse: Option<String>,
pub copyright: Option<String>,
pub original_resource_uri: Option<indexmap::IndexMap<String, String>>,
pub other_details: Option<indexmap::IndexMap<String, String>>,
}
#[derive(Debug, Clone, PartialEq)]
pub enum State {
NonTerminalState(NonTerminalState),
TerminalState(TerminalState),
}
#[derive(Debug, Clone, PartialEq)]
pub struct StateMachine {
pub states: Vec<State>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TerminalState {
pub name: String,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TermBindingItem {
pub code: String,
pub value: openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Transition {
pub event: String,
pub action: Option<String>,
pub guard: Option<String>,
pub next_state: Option<Box<State>>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TranslationDetails {
pub language: openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase,
pub author: indexmap::IndexMap<String, String>,
pub accreditation: Option<String>,
pub other_details: Option<indexmap::IndexMap<String, String>>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TAttribute {
pub rm_attribute_name: String,
pub children: Vec<TComplexObject>,
pub differential_path: String,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TComplexObject {
pub rm_type_name: String,
pub occurrences: Intervalofinteger,
pub node_id: String,
pub attributes: Vec<CAttribute>,
pub default_value: Option<openehr_rm::v1_2::data_types::basic::data_value::DataValue>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TConstraint {
pub attributes: Vec<TAttribute>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Termbindingset {
pub terminology: String,
pub items: Vec<TermBindingItem>,
}