Skip to main content

Module normalize

Module normalize 

Source
Expand description

Chemical structure normalization — a peer to crate::enrichment, not nested inside it or inside crate::generation. Mirrors the boundary docs/sdsforge-architecture.md’s “chematic integration boundary” section describes:

enrichment  — resolves CAS -> candidate record(s) (PubChem)
normalize   — parses/canonicalizes/flags-inconsistency on a candidate
              enrichment already resolved (this module)
generation  — decides whether the result is usable, records provenance
              and uncertainty, maps verified data into the SDS draft

A normalizer never resolves CAS numbers, never predicts finished-product properties (flash point, vapor pressure, GHS classification, …), and never becomes evidence for anything crate::generation’s PRODUCT_LEVEL_POLICIES already governs — those stay exactly as commits 2ac2758/d4dd15d (“A”) left them, untouched by this module.

Structs§

CalculatedIdentityProperties
Deterministic calculations over the parsed structure — never an invented value. Every field is None when the underlying chematic operation wasn’t run (e.g. UnavailableNormalizer, or parsing failed).
ChemicalNormalizationResult
Result of normalizing one candidate. canonical_smiles is a deterministic transformation of the input for this chematic version, not a confirmation of chemical identity — a candidate a normalizer cannot process at all (missing/invalid structure, or the chematic-normalization feature disabled) still returns supplied CAS/name/concentration data untouched elsewhere in the generation pipeline; this result only ever adds information, it never causes already-resolved fields to be discarded.
UnavailableNormalizer
Explicit behavior when chematic support isn’t compiled in — distinct from “no SMILES was supplied” (NormalizationStatus::MissingStructure) so a caller can tell the two situations apart.

Enums§

NormalizationIssue
NormalizationStatus

Traits§

ChemicalNormalizer
A local, deterministic parse/canonicalize/consistency-check step over one already-resolved ChemicalIdentityCandidate. Implementations must not perform network I/O (normalization is local by design) and must not silently replace the candidate’s identity (e.g. by stripping a salt) — see ChemicalNormalizationResult’s doc comment.