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
// @generated by idiolect-codegen. do not edit.
// source: dev.idiolect.encounter
//! A signed record of a single lens invocation. Encounters are the emergent-channel primitive: they record that a translation occurred, with enough context for aggregators (observations) and correctors to reason about it.
#![allow(
missing_docs,
clippy::doc_markdown,
clippy::struct_excessive_bools,
clippy::derive_partial_eq_without_eq
)]
use serde::{Deserialize, Serialize};
/// One invocation of a lens on a source, producing an output. Kind declares the encounter's context so observers can weight correctly.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Encounter {
/// Narrative notes from the invoking party.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub annotations: Option<String>,
/// Outcome as assessed by the invoking party at record time. 'corrected' signals a follow-up correction record is expected or exists.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub downstream_result: Option<EncounterDownstreamResult>,
/// Fixed taxonomy at the Lexicon level. Observers declare how they weight each kind.
pub kind: EncounterKind,
/// The lens that was invoked.
pub lens: super::defs::LensRef,
/// When the lens invocation occurred. Distinct from the record's createdAt, which may be later.
pub occurred_at: String,
/// Optional content-addressed reference to the produced output.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub produced_output: Option<String>,
/// Free-text statement of why this translation was performed.
pub purpose: String,
/// Optional content-addressed reference to the source instance, when the publisher is willing to include it. Omit when visibility restricts publication of source data.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub source_instance: Option<String>,
/// The source schema the lens translated from.
pub source_schema: super::defs::SchemaRef,
/// The target schema produced by the lens. Often implied by the lens; may be elided when unambiguous.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub target_schema: Option<super::defs::SchemaRef>,
pub visibility: super::defs::Visibility,
}
impl crate::Record for Encounter {
const NSID: &'static str = "dev.idiolect.encounter";
}
/// EncounterDownstreamResult.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum EncounterDownstreamResult {
Success,
Corrected,
Rejected,
Unknown,
}
/// EncounterKind.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum EncounterKind {
InvocationLog,
Curated,
RoundtripVerified,
Production,
Adversarial,
}