pub struct FieldProvenance {
pub path: String,
pub source_type: EvidenceLevel,
pub source_reference: Option<String>,
pub source_value: Option<String>,
pub method: String,
pub sample_id: Option<String>,
pub batch_id: Option<String>,
pub test_method: Option<String>,
pub conditions: Option<MeasurementConditions>,
pub retrieved_at: Option<String>,
pub confidence: ConfidenceLevel,
pub warnings: Vec<String>,
}Expand description
A single field’s origin: where its value came from, how, and how
confident the generator is in it. One FieldProvenance per populated
field.
path uses dot-separated MHLW JSON key names (the same names
#[serde(rename = "...")] puts on the wire in official_sds.json), with
[i] for array indices — e.g.
"Composition.CompositionAndConcentration[0].SubstanceIdentifiers.SubstanceNames.GenericName".
This is the one canonical path convention for this feature; see
path_helpers below and tests::path_convention_is_stable.
Fields§
§path: String§source_type: EvidenceLevel§source_reference: Option<String>§source_value: Option<String>§method: String§sample_id: Option<String>§batch_id: Option<String>§test_method: Option<String>§conditions: Option<MeasurementConditions>§retrieved_at: Option<String>Deliberately left None by every code path in this commit — no
live timestamp is generated, so repeated generation from the same
input produces byte-identical report JSON.
confidence: ConfidenceLevel§warnings: Vec<String>Implementations§
Source§impl FieldProvenance
impl FieldProvenance
Sourcepub fn supplied(path: impl Into<String>, method: impl Into<String>) -> Self
pub fn supplied(path: impl Into<String>, method: impl Into<String>) -> Self
A value the caller typed into ProductInput directly — trade name,
supplier contact fields, component name/CAS/concentration. Always
UnverifiedUserInput / Unverified confidence: structural
validation (commit #8) confirms the shape is well-formed, not that
the content is factually correct.
Sourcepub fn from_cas_resolver(
path: impl Into<String>,
pubchem_cid: Option<u64>,
) -> Self
pub fn from_cas_resolver( path: impl Into<String>, pubchem_cid: Option<u64>, ) -> Self
A value returned by the existing CAS enrichment resolver
(crate::enrichment::lookup_cas). ReferenceDatabase, not
Confirmed/DeterministicCalculation — a CAS lookup result is
evidence about a chemical identity candidate, not proof that the
supplied product or batch actually contains that substance at the
declared concentration, and this commit records the resolver’s
returned value rather than recalculating it from structure.
Sourcepub fn from_measured_evidence(
path: impl Into<String>,
source: &EvidenceSource,
method: Option<&str>,
sample_id: Option<&str>,
batch_id: Option<&str>,
conditions: &MeasurementConditions,
) -> Self
pub fn from_measured_evidence( path: impl Into<String>, source: &EvidenceSource, method: Option<&str>, sample_id: Option<&str>, batch_id: Option<&str>, conditions: &MeasurementConditions, ) -> Self
A property resolved from caller-supplied measured-value evidence
(flash point, boiling point, vapor pressure, explosive limits) that
fully satisfied its FieldPolicy — see
super::resolve::resolve_measured_properties. confidence: High
and source_type taken directly from the super::EvidenceSource
that resolved it (ProductTestReport/EquivalentBatchTestReport/
SupplierSpecification, whichever this property’s policy accepted)
— never upgraded to a status the evidence itself doesn’t support.
Sourcepub fn from_test_result_evidence(
path: impl Into<String>,
source: &EvidenceSource,
result: &TestResultEvidence,
) -> Self
pub fn from_test_result_evidence( path: impl Into<String>, source: &EvidenceSource, result: &TestResultEvidence, ) -> Self
Same as Self::from_measured_evidence for the three free-text-only
properties (self-reactivity, oxidizing properties, metal
corrosivity), whose evidence is a super::TestResultEvidence
rather than a numeric value.
Sourcepub fn source_smiles(
pubchem_cid: Option<u64>,
used_connectivity_fallback: bool,
) -> Self
pub fn source_smiles( pubchem_cid: Option<u64>, used_connectivity_fallback: bool, ) -> Self
The candidate’s own structure as PubChem returned it, before any
normalization — ReferenceDatabase, same evidence level as
Self::from_cas_resolver, never Confirmed. Applies equally to
either PubChem representation actually used as the normalization
input: the full SMILES property (stereochemistry/isotopes where
represented) or, only as a fallback, ConnectivitySMILES
(connectivity only) — neither is chematic’s separately-provenanced,
DeterministicCalculation-level canonical form (see
Self::canonical_smiles). used_connectivity_fallback records
which one so the report can disclose when stereochemistry/isotope
information may not be represented.
Sourcepub fn canonical_smiles(pubchem_cid: Option<u64>, warnings: Vec<String>) -> Self
pub fn canonical_smiles(pubchem_cid: Option<u64>, warnings: Vec<String>) -> Self
The chematic-canonicalized SMILES actually written into
official_sds.json’s SMILES field. DeterministicCalculation —
a canonical form is a deterministic transformation for this
chematic version and input, not proof the underlying chemical
identity is confirmed. Never Confirmed/ProductTestReport/
EquivalentBatchTestReport — the evidence level is hardcoded here,
not something a caller can override.
Trait Implementations§
Source§impl Clone for FieldProvenance
impl Clone for FieldProvenance
Source§fn clone(&self) -> FieldProvenance
fn clone(&self) -> FieldProvenance
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FieldProvenance
impl Debug for FieldProvenance
Source§impl<'de> Deserialize<'de> for FieldProvenance
impl<'de> Deserialize<'de> for FieldProvenance
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for FieldProvenance
impl RefUnwindSafe for FieldProvenance
impl Send for FieldProvenance
impl Sync for FieldProvenance
impl Unpin for FieldProvenance
impl UnsafeUnpin for FieldProvenance
impl UnwindSafe for FieldProvenance
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more