BoM impacted substances#
For more information about BoM item types relevant for impacted substances analysis, refer to the BoM item types for Restricted Substances section of the online documentation.
Consult Items added during restricted substances analysis for some important restrictions on BoM-based queries.
Query definition#
- class BomImpactedSubstancesQuery#
Gets the substances impacted by a list of legislations for a BoM.
The BoM must be in the Ansys Granta 1711 XML BoM format or Ansys Granta 2301 XML BoM format.
All BoM-based queries only operate on a single BoM. As a result, the
.with_batch_size()
method is not implemented for BoM-based queries.Once the query is fully constructed, use the cxn.
run()
method to return a result of typeBomImpactedSubstancesQueryResult
.Examples
>>> cxn = Connection("http://my_mi_server/mi_servicelayer").with_autologon().connect() >>> bom = "<PartsEco xmlns..." >>> query = ( ... BomImpactedSubstancesQuery() ... .with_bom("<PartsEco xmlns...") ... .with_legislation_ids(["Candidate_AnnexXV"]) ... ) >>> cxn.run(query) <BomImpactedSubstancesQueryResult: 1 Bom1711WithImpactedSubstances results>
- with_bom(bom)#
Set the BoM to use for the query.
See the documentation for the parent query class for supported BoM formats.
Minimal validation is performed on the provided
bom
to ensure the request is sent to the appropriate endpoint. XSD files are provided inschemas
for full validation.- Parameters:
- bom
str
BoM to use for the query.
- bom
- Returns:
Query
Current query object.
- Raises:
TypeError
Error raised if the method is called with values that do not match the types described earlier.
ValueError
Error raised if the bom isn’t valid XML, or isn’t in a known supported BoM format.
Notes
See the
ansys.grantami.bomanalytics.schemas
sub-package for Ansys Granta XML BoM Schema Definitions.
- with_legislation_ids(legislation_ids)#
Add a list or set of legislations to retrieve the impacted substances for.
Legislations are identified based on their
Legislation ID
attribute value.
Query result#
- class BomImpactedSubstancesQueryResult(results, messages)#
Retrieves the result of running the
BomImpactedSubstancesQuery
class.This class describes the substances in the specified BoM impacted by one or more legislations.
- impacted_substances_by_legislation#
View of the results for a query for impacted substances, grouped by legislation only.
The substances from all items specified in the query are merged for each legislation, providing a single list of impacted substances grouped by legislation only. Substances are duplicated where they appear in multiple items for the same legislation.
- Returns:
- impacted_substances
dict
[str
,ImpactedSubstance
]
- impacted_substances
Examples
>>> result: MaterialImpactedSubstancesQueryResult >>> result.impacted_substances_by_legislation {'Candidate_AnnexXV': [ <ImpactedSubstance: {"cas_number": 90481-04-2}>, ...] }
- impacted_substances#
View of the results for a query for impacted substances, flattened into a single list.
The substances from all items specified in the query are merged across item and legislation, providing a single flat list. Substances are duplicated where they appear in multiple items or legislations.
- Returns:
- impacted_substances
list
[ImpactedSubstance
]
- impacted_substances
Examples
>>> result: MaterialImpactedSubstancesQueryResult >>> result.impacted_substances [<ImpactedSubstance: {"cas_number": 90481-04-2}>, ...]
- messages#
Messages generated by Granta MI when running the query. The presence of one or more messages means that something unexpected happened when running the query but that the query could still be completed.
Messages are sorted in order of decreasing severity and are available in the Service Layer log file.
Messages are also logged using the Python
logging
module to theansys.grantami.bomanalytics
logger. By default, messages with a severity of"warning"
or higher are printed on stderr.