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;
36mod wire;
37
38/// The HL7 FHIR release this crate targets.
39///
40/// The release is published at <https://hl7.org/fhir/R4/>. STU3 and R4B are
41/// accepted on the wire as well ([`WireVersion`](config::WireVersion)).
42pub const FHIR_VERSION: &str = "R4";
43
44/// `CodeSystem/$lookup`, as the operation is invoked
45/// (<https://hl7.org/fhir/R4/codesystem-operation-lookup.html>).
46pub const LOOKUP: &str = "CodeSystem/$lookup";
47
48/// `ConceptMap/$translate`
49/// (<https://hl7.org/fhir/R4/conceptmap-operation-translate.html>).
50pub const TRANSLATE: &str = "ConceptMap/$translate";
51
52/// `ValueSet/$validate-code`
53/// (<https://hl7.org/fhir/R4/valueset-operation-validate-code.html>).
54pub const VALIDATE_CODE: &str = "ValueSet/$validate-code";
55
56/// The batch interaction, a `POST` of a `Bundle` to the service base
57/// (<https://hl7.org/fhir/R4/http.html#transaction>).
58pub const BATCH: &str = "batch";
59
60/// `ValueSet/$expand`
61/// (<https://hl7.org/fhir/R4/valueset-operation-expand.html>).
62pub const EXPAND: &str = "ValueSet/$expand";
63
64/// `CodeSystem/$subsumes`
65/// (<https://hl7.org/fhir/R4/codesystem-operation-subsumes.html>).
66pub const SUBSUMES: &str = "CodeSystem/$subsumes";
67
68/// The `CodeSystem` search by canonical URL that asks only for the count of
69/// matches (<https://hl7.org/fhir/R4/search.html#summary>).
70pub const CODE_SYSTEM_SEARCH: &str = "CodeSystem?_summary=count";