CCCData API Reference¶
pycomptox.exposure.ccddata.CCCData
¶
Bases: CachedAPIClient
Client for accessing Chemical and Products Categories (CCC) data from EPA CompTox Dashboard.
This class provides methods for retrieving Product Use Category (PUC) information for chemicals, which describes how chemicals are used in consumer products.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str
|
CompTox API key. If not provided, will attempt to load from saved configuration or COMPTOX_API_KEY environment variable. |
None
|
base_url
|
str
|
Base URL for the CompTox API. Defaults to EPA's endpoint. |
'https://comptox.epa.gov/ctx-api/'
|
time_delay_between_calls
|
float, **kwargs
|
Delay in seconds between API calls for rate limiting. Default is 0.0 (no delay). |
0.0
|
Example
from pycomptox import CCCData ccc = CCCData()
Get product use category data¶
puc_data = ccc.product_use_category_by_dtxsid("DTXSID0020232") print(f"Products: {puc_data[0].get('prodCount')}")
Source code in src/pycomptox/exposure/ccddata.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
__init__(api_key=None, base_url='https://comptox.epa.gov/ctx-api/', time_delay_between_calls=0.0, **kwargs)
¶
Initialize the CCCData client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
Optional[str]
|
CompTox API key (optional, will be loaded from config if not provided) |
None
|
base_url
|
str
|
Base URL for the CompTox API |
'https://comptox.epa.gov/ctx-api/'
|
time_delay_between_calls
|
float
|
Delay between API calls in seconds |
0.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If no API key is provided or found in configuration |
Source code in src/pycomptox/exposure/ccddata.py
biomonitoring_data_by_dtxsid_and_ccd(dtxsid, projection='', use_cache=None)
¶
Get NHANES biomonitoring data for a chemical.
Retrieves NHANES (National Health and Nutrition Examination Survey) biomonitoring inferences for a specific chemical. The data includes demographic information, median values, and confidence bounds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsid
|
str
|
DSSTox Substance Identifier (e.g., 'DTXSID7020182') |
required |
projection
|
str
|
Optional projection type. Use 'ccd-biomonitoring' for CCD exposure biomonitoring page format. If omitted, default CCDBiomonitoring data is returned. |
''
|
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing biomonitoring data with fields: - id: Record identifier - dtxsid: Chemical identifier - demographic: Demographic group - median: Median value - upperBound: Upper confidence bound - lowerBound: Lower confidence bound - nhanesCohort: NHANES cohort identifier |
Raises:
| Type | Description |
|---|---|
ValueError
|
If dtxsid is not a valid non-empty string |
Example
ccc = CCCData() biomon = ccc.biomonitoring_data_by_dtxsid_and_ccd("DTXSID7020182") for record in biomon: ... print(f"{record['demographic']}: {record['median']}")
Source code in src/pycomptox/exposure/ccddata.py
chemical_weight_fraction_by_dtxsid(dtxsid, use_cache=None)
¶
Get chemical weight fraction data for a chemical.
Retrieves information about the weight fractions (concentrations) of a chemical in various products. This includes the product name, category, and the range of weight fractions reported.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsid
|
str
|
DSSTox Substance Identifier (e.g., 'DTXSID0020232') |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing weight fraction data with fields: - id: Record identifier - dtxsid: Chemical identifier - prodName: Product name - displayPuc: Display name for Product Use Category - pucKind: Kind of PUC classification - lowerweightfraction: Lower bound of weight fraction - upperweightfraction: Upper bound of weight fraction - weightfractiontype: Type of weight fraction measurement - gencat: General category - prodfam: Product family - prod_type: Product type - pucDefinition: Definition of the PUC - sourceName: Name of data source - sourceDescription: Description of data source - sourceUrl: URL of data source - sourceDownloadDate: Date source was downloaded - productCount: Number of products |
Raises:
| Type | Description |
|---|---|
ValueError
|
If dtxsid is not a valid non-empty string |
Example
ccc = CCCData() weight_fracs = ccc.chemical_weight_fraction_by_dtxsid("DTXSID0020232") for wf in weight_fracs: ... print(f"{wf['prodName']}: {wf['lowerweightfraction']}-{wf['upperweightfraction']}")
Source code in src/pycomptox/exposure/ccddata.py
general_use_keywords_by_dtxsid(dtxsid, use_cache=None)
¶
Get general use keywords data for a chemical.
Retrieves keywords that describe the general uses of a chemical across various sources. This provides a high-level overview of how the chemical is commonly used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsid
|
str
|
DSSTox Substance Identifier (e.g., 'DTXSID0020232') |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing keyword data with fields: - id: Record identifier - keywordset: Set of keywords describing uses - sourceCount: Number of sources reporting this use - dtxsid: Chemical identifier |
Raises:
| Type | Description |
|---|---|
ValueError
|
If dtxsid is not a valid non-empty string |
Example
ccc = CCCData() keywords = ccc.general_use_keywords_by_dtxsid("DTXSID0020232") for kw in keywords: ... print(f"{kw['keywordset']}: {kw['sourceCount']} sources")
Source code in src/pycomptox/exposure/ccddata.py
product_use_category_by_dtxsid(dtxsid, use_cache=None)
¶
Get Product Use Category data for a chemical.
Retrieves Product Use Category (PUC) information that describes how a chemical is used in consumer products. The PUC system categorizes products by general category, product family, and product type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsid
|
str
|
DSSTox Substance Identifier (e.g., 'DTXSID0020232') |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing PUC data with fields: - id: Record identifier - dtxsid: Chemical identifier - displayPuc: Display name for the PUC - pucKind: Kind of PUC classification - prodCount: Number of products - genCat: General category - prodfam: Product family - prodtype: Product type - definition: Definition of the category |
Raises:
| Type | Description |
|---|---|
ValueError
|
If dtxsid is not a valid non-empty string |
Example
ccc = CCCData() puc_data = ccc.product_use_category_by_dtxsid("DTXSID0020232") for puc in puc_data: ... print(f"{puc['displayPuc']}: {puc['prodCount']} products")
Source code in src/pycomptox/exposure/ccddata.py
production_volume_by_dtxsid(dtxsid, use_cache=None)
¶
Get Production Volume data for a chemical.
Retrieves production volume information for a specific chemical identified by its DSSTox Substance Identifier (DTXSID).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsid
|
str
|
DSSTox Substance Identifier (e.g., 'DTXSID0020232') |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dictionary containing production volume data with fields: - id: Record identifier - dtxsid: Chemical identifier - name: Production volume name/category - amount: Production volume amount |
Raises:
| Type | Description |
|---|---|
ValueError
|
If dtxsid is not a valid non-empty string |
Example
ccc = CCCData() prod_vol = ccc.production_volume_by_dtxsid("DTXSID0020232") print(f"Amount: {prod_vol['amount']}")
Source code in src/pycomptox/exposure/ccddata.py
reported_functional_use_by_dtxsid(dtxsid, use_cache=None)
¶
Get reported functional use data for a chemical.
Retrieves reported functional use categories for a chemical, describing the specific functions or purposes for which the chemical is used in products (e.g., preservative, solvent, surfactant).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsid
|
str
|
DSSTox Substance Identifier (e.g., 'DTXSID0020232') |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing functional use data with fields: - id: Record identifier - dtxsid: Chemical identifier - category: Functional use category - definition: Definition of the functional use |
Raises:
| Type | Description |
|---|---|
ValueError
|
If dtxsid is not a valid non-empty string |
Example
ccc = CCCData() func_uses = ccc.reported_functional_use_by_dtxsid("DTXSID0020232") for use in func_uses: ... print(f"{use['category']}: {use['definition']}")