CARCINOGEN_STATUS
This function returns carcinogenic classification data for a chemical identified by CAS Registry Number. If no method is provided, it returns all available source classifications; if a method is provided, it returns that source-specific classification.
The wrapped library provides classifications from major references such as IARC and NTP. The result is serialized to JSON text so it can be consumed consistently in Excel formulas and downstream parsing steps.
Excel Usage
=CARCINOGEN_STATUS(CASRN, method)
CASRN(str, required): Chemical Abstracts Service Registry Number identifier (-).method(str, optional, default: null): Source method name for classification lookup (e.g., IARC, NTP) (-).
Returns (str): JSON string containing status information.
Example 1: Amitrole Carcinogen Status
Inputs:
| CASRN |
|---|
| 61-82-5 |
Excel formula:
=CARCINOGEN_STATUS("61-82-5")
Expected output:
"{\"International Agency for Research on Cancer\": \"Not classifiable as to its carcinogenicity to humans (3)\", \"National Toxicology Program 13th Report on Carcinogens\": \"Reasonably Anticipated\"}"
Example 2: Amitrole IARC classification
Inputs:
| CASRN | method |
|---|---|
| 61-82-5 | IARC |
Excel formula:
=CARCINOGEN_STATUS("61-82-5", "IARC")
Expected output:
"\"Not classifiable as to its carcinogenicity to humans (3)\""
Example 3: Amitrole NTP classification
Inputs:
| CASRN | method |
|---|---|
| 61-82-5 | NTP |
Excel formula:
=CARCINOGEN_STATUS("61-82-5", "NTP")
Expected output:
"\"Reasonably Anticipated\""
Example 4: Benzene Carcinogen Status
Inputs:
| CASRN |
|---|
| 71-43-2 |
Excel formula:
=CARCINOGEN_STATUS("71-43-2")
Expected output:
"{\"International Agency for Research on Cancer\": \"Carcinogenic to humans (1)\", \"National Toxicology Program 13th Report on Carcinogens\": \"Known\"}"
Python Code
Show Code
import json
from chemicals.safety import Carcinogen
def carcinogen_status(CASRN, method=None):
"""
Looks up if a chemical is listed as a carcinogen according to specific methods.
See: https://chemicals.readthedocs.io/chemicals.safety.html
This example function is provided as-is without any representation of accuracy.
Args:
CASRN (str): Chemical Abstracts Service Registry Number identifier (-).
method (str, optional): Source method name for classification lookup (e.g., IARC, NTP) (-). Default is None.
Returns:
str: JSON string containing status information.
"""
try:
method_map = {
"IARC": "International Agency for Research on Cancer",
"NTP": "National Toxicology Program 13th Report on Carcinogens",
}
normalized_method = method_map.get(method, method)
res = Carcinogen(CASRN, method=normalized_method)
if res is None:
return "Error: Data not available"
return json.dumps(res)
except Exception as e:
return f"Error: {str(e)}"