fhir-search
The FHIR R4 search value grammar (search.html §3.1.1.4): the escaped list of alternatives, the token forms, the string matches and the date with its prefix and the range its precision implies.
Part of FerroBRIDGE, a pure-Rust bridge between openEHR and two interoperability targets: HL7 FHIR through the FHIRconnect specification, and the OMOP Common Data Model through the OMOCL specification. The FerroHEALTH FHIR servers read their search values through this one crate.
Requiring the crate
The crate follows Cargo's SemVer rules: a compatible change moves the patch, and a breaking change moves the minor while the crate is 0.x. Require it with a caret range on its line, so one release serves every crate in your build that uses it:
[]
= "0.1"
Name a patch ("0.1.N") when you need the first release that carries what
you use; the range is the same caret range.
What it does
A server percent-decodes a parameter's value and reads it in two steps:
escape::splitcuts the value into its alternatives at every,no\escapes.escape::unescaperemoves the escapes of one part and refuses a\before any character other than\,,,$and|, as §3.1.1.4.19 requires ("The parameter valuexx\xxis illegal").escape::escapewrites a literal value a server reads back unchanged.token::Tokenreads[code],[system]|[code],|[code]and[system]|, andtoken::OfTypereads the:of-typeformsystem|code|value(§3.1.1.4.10).string::StringMatchis the default,:containsand:exactmatch, andstring::foldis the form the first two compare: case, combining marks, punctuation and repeated whitespace removed (§3.1.1.4.8).prefix::Prefixholds the nine prefixes of §3.1.1.4.5,apincluded.date::DateValuereads a prefix and a date to any precision from the year, with the time in minutes, seconds or any number of fraction digits and an optional offset (§3.1.1.4.7).SearchDate::rangegives the half-open range its precision implies, written at that precision, andSearchDate::instantsgives the instants of that range, with a date that has no offset read in the server's zone.SearchDate::approximatewidens the range by the recommended 10% of its gap to now, forap.
The default feature jiff carries the instants, approximate and
first_day. With default-features = false everything else compiles with
no time library, for a consumer that reads tokens and escapes alone.
No error and no Debug output carries a value: a code may be an identifier
and a date a birth date.
use DateValue;
use split;
use Prefix;
use ;
let tokens: = split
.iter
.map
.?;
assert_eq!;
assert_eq!;
let date = parse?;
assert_eq!;
let range = date.date.range;
assert_eq!;
assert_eq!;
Licence
Business Source License 1.1 (LICENSE): free for every non-production use and
for non-commercial production use; a commercial licence for other production
use; Apache License 2.0 four years after each version.