pub struct CategoryMap { /* private fields */ }Expand description
The deployment’s category map.
Implementations§
Source§impl CategoryMap
impl CategoryMap
Sourcepub fn classify(&self, evidence: &Evidence) -> Classification
pub fn classify(&self, evidence: &Evidence) -> Classification
The categories of an access that showed evidence.
The categories of every root object and every queried id are joined,
and none never removes one. The access is of no category only when
its resource kind holds none, or when the map declares none by an
exact key for everything it reached and nothing is uncertain; it is
unclassified otherwise.
Source§impl CategoryMap
impl CategoryMap
Sourcepub fn declare(
national: &[String],
templates: &BTreeMap<String, Declared>,
archetypes: &BTreeMap<String, Declared>,
) -> Result<Self, MapError>
pub fn declare( national: &[String], templates: &BTreeMap<String, Declared>, archetypes: &BTreeMap<String, Declared>, ) -> Result<Self, MapError>
The map templates and archetypes declare, their categories read
against the six priority categories and the national ones, each
declared <system>|<code>, its keys compared exactly.
§Errors
The first MapError CategoryMap::declare_with finds.
Sourcepub fn declare_with(
matching: Matching,
national: &[String],
templates: &BTreeMap<String, Declared>,
archetypes: &BTreeMap<String, Declared>,
) -> Result<Self, MapErrors>
pub fn declare_with( matching: Matching, national: &[String], templates: &BTreeMap<String, Declared>, archetypes: &BTreeMap<String, Declared>, ) -> Result<Self, MapErrors>
The map templates and archetypes declare, compared by matching,
their categories read against the six priority categories and the
national ones, each declared <system>|<code>.
§Errors
MapErrors with every defect: a refused national code, an empty or
malformed key, an archetype key that is no ARCHETYPE_ID, two keys that
name the same id, a word other than none, an empty list, and a code
that names no category.
Sourcepub fn with_evidence_limit(self, limit: usize) -> Self
pub fn with_evidence_limit(self, limit: usize) -> Self
This map, keeping at most limit ids in each evidence set of a
classification, with each set’s true count beside it.
Sourcepub fn evidence_limit(&self) -> Option<usize>
pub fn evidence_limit(&self) -> Option<usize>
The most ids a classification keeps in each evidence set, when the map bounds them.
Sourcepub fn templates(&self) -> impl Iterator<Item = (&str, &Mapping)>
pub fn templates(&self) -> impl Iterator<Item = (&str, &Mapping)>
Every template key, as declared, with what it maps to, in key order.
Sourcepub fn archetypes(&self) -> impl Iterator<Item = (&str, &Mapping)>
pub fn archetypes(&self) -> impl Iterator<Item = (&str, &Mapping)>
Every archetype key, as declared, with what it maps to, in key order.
Sourcepub fn national(&self) -> impl Iterator<Item = &NationalCategory>
pub fn national(&self) -> impl Iterator<Item = &NationalCategory>
Every national category the map declares, in order.
Sourcepub fn with_digest(self, digest: String) -> Self
pub fn with_digest(self, digest: String) -> Self
This map, named by digest, such as a hash of
CategoryMap::canonical.
Sourcepub fn template(&self, template_id: &str) -> Option<&Mapping>
pub fn template(&self, template_id: &str) -> Option<&Mapping>
What template_id maps to, when the map holds it under its
matching.
Sourcepub fn archetype(&self, archetype_id: &str) -> Option<&Mapping>
pub fn archetype(&self, archetype_id: &str) -> Option<&Mapping>
What archetype_id maps to, when the map holds it under its
matching.
Sourcepub fn category(&self, reference: &str) -> Option<Category>
pub fn category(&self, reference: &str) -> Option<Category>
The category reference names: a priority category by its bare code
or as <system>|<code>, or a national one the map declares, as
<system>|<code>. Codes are compared exactly.
Sourcepub fn categories(&self) -> impl Iterator<Item = Category> + '_
pub fn categories(&self) -> impl Iterator<Item = Category> + '_
Every category the map can name: the six priority categories of Art 14(1) in their order, then each national category it declares.
Sourcepub fn canonical(&self) -> String
pub fn canonical(&self) -> String
The map as text that is the same for the same declarations: a line
matching\topenehr for a map compared as openEHR BASE asks, one line
per national category, then per template and per archetype key, each
field separated by a tab, the categories by ,, each category as
<system>|<code>. A key is written as the map compares it: as
declared in an exact map, and in its comparison form in an openEHR one,
so two declarations that differ only in the case of a key have one
text.