Builds the URL of a compound's PubChem summary page from its CID.
Builds a PubChem search URL for a CAS number. Use this when the exact CID is unknown — PubChem's search lands the user on the matching compound (or a short result list) for the CAS number.
Builds the URL of a compound's 2D structure image (PNG) from its CID.
Get the compound name from a synonym.
Determines whether a chemical name is "simple" enough to suggest to a user — an ordinary common name made only of letters and spaces, not a long IUPAC- or registry-style technical identifier.
Suggests a simpler alternative search term when a query yields no results. Pulls PubChem's popularity-ranked synonyms for the query, keeps only simple common names (see isSimpleName), and skips any term the user has already tried. Falls back to the compound's CAS number when no suitable simple name remains. Either field may be undefined.
Gets the PubChem ID from the links in the document.
A subset of PubChem compound properties, normalized to friendly camelCase field names. Every field is optional because PUG-REST omits properties it cannot compute for a compound.
A compound's textual description from PUG-REST's /description operation.
Retrieves the PubChem CIDs registered for a CAS number via PUG-REST's xref/registry-number lookup. A single CAS number can map to multiple CIDs (e.g. different salt or hydrate forms). Results are cached for three days; unknown CAS numbers resolve to undefined.
Resolves a chemical name to its best-matching PubChem CID via PUG-REST. Returns the first (highest-ranked) CID PubChem reports. Results are cached for three days.
Resolves a molecular formula to its best-matching PubChem CID via the PUG-REST fastformula
search (the plain name endpoint 404s on most formulas). Returns the first CID PubChem reports.
Cached for three days.
Fetches core physical/chemical properties for a compound (formula, molecular weight, IUPAC name, SMILES, InChI, InChIKey, title) via PUG-REST. These map directly onto ChemPal's product fields, so this is the primary way to enrich a product once its CID is known. Cached for three days.
Fetches PubChem's popularity-ranked synonyms for a compound by CID via PUG-REST. Prefer this over getRankedNamesByName when the CID is already known, as it avoids an ambiguous name lookup. Cached for three days.
Fetches a short human-readable description of a compound (with its source) by CID via PUG-REST. Useful for surfacing a plain-language blurb in the product detail view. Cached for three days.
Query the SDQ agent for a compound name from a synonym. Results are cached for three days.
Fetches PubChem's popularity-ranked synonyms for a chemical name via PUG-REST, caching results for three days. The leading entries are the most commonly used names, and CAS numbers appear inline among them. Returns undefined when PubChem has no match.
Resolves a chemical identifier (CAS number or molecular formula) to a ranked list of human-readable chemical-name candidates via PubChem — the compound's Title plus its cleaned popularity-ranked synonyms. Used to let suppliers that can only search by name answer identifier queries: the identifier is converted to names, and a product is matched against whichever candidate scores best (so e.g. "Sodium hexametaphosphate" is reached even when the Title is "Hexasodium hexametaphosphate"). SMILES is handled separately by
resolveSmilesin@/helpers/smiles.