bw2io.chemidplus#

Attributes#

Exceptions#

Missing

404 or other error code returned.

Multiple

Multiple results for given search query.

Classes#

ChemIDPlus

Use the ChemIDPlus API to lookup synonyms for chemicals, including pesticides.

Functions#

canonical_cas(s)

CAS numbers have up to ten digits; we remove zero padding and add hyphens where needed.

Module Contents#

exception bw2io.chemidplus.Missing[source]#

Bases: Exception

404 or other error code returned.

Parameters:
  • exception (Exception) – Exception to raise.

  • signature. (Initialize self. See help(type(self)) for accurate)

exception bw2io.chemidplus.Multiple[source]#

Bases: Exception

Multiple results for given search query.

Parameters:
  • exception (Exception) – Exception to raise.

  • signature. (Initialize self. See help(type(self)) for accurate)

class bw2io.chemidplus.ChemIDPlus[source]#

Use the ChemIDPlus API to lookup synonyms for chemicals, including pesticides.

Always used to match against a master list. Seeded with names from ecoinvent.

api_cache[source]#

Dictionary with raw data from API, key is canonical name.

Type:

dict

master_mapping[source]#

Dictionary from synonyms, including canonical names, to master flows.

Type:

dict

forbidden_keys[source]#

Identifiers that aren’t unique in the ChemIDPlus system.

Type:

set

match(synonym, search=True)[source]#

Match a synonym to a master flow.

match_cas(number)[source]#

Match a CAS number to a master flow.

process_request(request)[source]#

Process a request to the ChemIDPlus API.

load_cache()[source]#

Load the cache of API results.

save_cache()[source]#

Save the cache of API results.

add_master_term(term, CAS)[source]#
load_cache()[source]#
match(synonym, search=True)[source]#
match_cas(number)[source]#
process_request(response)[source]#
save_cache()[source]#
CAS_TEMPLATE = 'https://chem.nlm.nih.gov/api/data/search?data=complete&exp=rn%2Feq%2F{cas}'[source]#
NAME_TEMPLATE = 'https://chem.nlm.nih.gov/api/data/search?data=complete&exp=na%2Feq%2F{name}'[source]#
api_cache[source]#
forbidden_keys[source]#
master_mapping[source]#
bw2io.chemidplus.canonical_cas(s)[source]#

CAS numbers have up to ten digits; we remove zero padding and add hyphens where needed.

Parameters:

s (str) – CAS number.

Returns:

Canonical CAS number.

Return type:

str

bw2io.chemidplus.DIRPATH[source]#