Skip to main content

FieldProvenance

Struct FieldProvenance 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> FieldProvenance

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FieldProvenance

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FieldProvenance

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for FieldProvenance

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more