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
69
70
71
72
73
74
// SPDX-FileCopyrightText: Cadasto B.V.
// SPDX-License-Identifier: BUSL-1.1
//! The interpreter: one traversal of a compiled program, both directions.
//!
//! [`crate::resolve`] compiles a context into an immutable program with every
//! path already resolved; this module runs it. There is one traversal, and
//! the direction enters it in three places only (our own design, over the
//! rules the specification gives):
//!
//! - conditions are evaluated on the input side, so `fhirCondition` runs when
//! FHIR is the input and `openehrCondition` when openEHR is
//! (`docs/specs/fhirconnect/modules/ROOT/pages/basics/Conditions.adoc`,
//! "conditions are always applied on the input data");
//! - a mapping whose `unidirectional` names the other direction is skipped,
//! and the skip is a recorded outcome rather than a log line;
//! - the composition defaults apply going into openEHR only
//! (`docs/specs/fhirconnect/modules/ROOT/pages/engine/defaults-for-fields.adoc`).
//!
//! Everything else is written once. The data-type conversions are the lenses
//! of [`lens`], each run both ways and tested against the well-behaved-lens
//! laws, so a cell cannot disagree with itself.
//!
//! The direction is [`crate::model::ast::keyword::Direction`], the type the
//! `unidirectional` key already parses into: it names the same two
//! directions, and a second enum beside it would only need converting.
//!
//! The engine makes no call of its own. What a run asks of its caller, the
//! `mappingCode` functions, the resource a reference points at, the id of a
//! resource the run creates, the translation a `conceptmap` names and the
//! demographics endpoint a party reference resolves through, is the [`seam`]
//! it is handed.
pub