ferrobridge_term/lib.rs
1// SPDX-FileCopyrightText: Cadasto B.V.
2// SPDX-License-Identifier: BUSL-1.1
3
4//! The FerroBRIDGE FHIR terminology client for `$lookup`, `$translate`,
5//! `$validate-code`, `$expand` and `$subsumes`.
6//!
7//! Five operations on one configured server: [`client::Client::lookup`] resolves a
8//! code's display, [`client::Client::translate`] maps a code into another system,
9//! [`client::Client::validate_code`] tests membership of a value set,
10//! [`client::Client::expand`] lists the codes of a value set, and
11//! [`client::Client::subsumes`] tests how two codes relate in their code system.
12//! [`client::Client::code_system_count`] asks whether the server serves a code
13//! system at all.
14//! [`client::Client::batch`] sends several of them as one `batch` `Bundle` and answers
15//! them by position.
16//!
17//! A negative answer an operation states in its own `out` parameters is an
18//! outcome ([`outcome`]); an answer the server refused is a typed error
19//! carrying the upstream status, the body, and any `tx-issue-type` coding the
20//! `OperationOutcome` holds. A missing display is
21//! [`LookupOutcome::NotFound`](outcome::LookupOutcome::NotFound), never an
22//! empty string.
23//!
24//! The request and response contracts come from the generated `fhir-types`
25//! operation modules; this crate models no FHIR of its own. The release is
26//! configured ([`WireVersion`](config::WireVersion)) because a server that
27//! serves several releases side by side puts the release in the base path.
28#![doc(test(attr(deny(warnings))))]
29
30pub mod client;
31pub mod concept;
32pub mod config;
33mod decode;
34pub mod error;
35pub mod outcome;
36#[cfg(feature = "smart")]
37pub mod smart;
38mod wire;
39
40/// The HL7 FHIR release this crate targets.
41///
42/// The release is published at <https://hl7.org/fhir/R4/>. STU3 and R4B are
43/// accepted on the wire as well ([`WireVersion`](config::WireVersion)).
44pub const FHIR_VERSION: &str = "R4";
45
46/// `CodeSystem/$lookup`, as the operation is invoked
47/// (<https://hl7.org/fhir/R4/codesystem-operation-lookup.html>).
48pub const LOOKUP: &str = "CodeSystem/$lookup";
49
50/// `ConceptMap/$translate`
51/// (<https://hl7.org/fhir/R4/conceptmap-operation-translate.html>).
52pub const TRANSLATE: &str = "ConceptMap/$translate";
53
54/// `ValueSet/$validate-code`
55/// (<https://hl7.org/fhir/R4/valueset-operation-validate-code.html>).
56pub const VALIDATE_CODE: &str = "ValueSet/$validate-code";
57
58/// The batch interaction, a `POST` of a `Bundle` to the service base
59/// (<https://hl7.org/fhir/R4/http.html#transaction>).
60pub const BATCH: &str = "batch";
61
62/// `ValueSet/$expand`
63/// (<https://hl7.org/fhir/R4/valueset-operation-expand.html>).
64pub const EXPAND: &str = "ValueSet/$expand";
65
66/// `CodeSystem/$subsumes`
67/// (<https://hl7.org/fhir/R4/codesystem-operation-subsumes.html>).
68pub const SUBSUMES: &str = "CodeSystem/$subsumes";
69
70/// The `CodeSystem` search by canonical URL that asks only for the count of
71/// matches (<https://hl7.org/fhir/R4/search.html#summary>).
72pub const CODE_SYSTEM_SEARCH: &str = "CodeSystem?_summary=count";