BoM compliance#
For more information about BoM item types relevant for compliance analysis, see Item types for Restricted Substances in the Granta MI product documentation.
For some important restrictions on BoM-based queries, see Items added during restricted substances analysis.
Query definition#
- class BomComplianceQuery#
Evaluates compliance for a BoM against a number of indicators.
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.The methods used to add the BoM and Indicators to this query return the query itself so that they can be chained together as required.
Once the query is fully constructed, use the cxn.
run()method to return a result of typePartComplianceQueryResult.Examples
>>> cxn = Connection("http://my_mi_server/mi_servicelayer").with_autologon().connect() >>> bom = "<PartsEco xmlns..." >>> indicator = WatchListIndicator( ... name="Prop 65", ... legislation_ids=["Prop65"] ... ) >>> query = ( ... BomComplianceQuery() ... .with_bom(bom) ... .with_indicators([indicator]) ... ) >>> cxn.run(query) <BomComplianceQueryResult: 1 PartWithCompliance 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 it defines a supported XML schema. XSD files are provided in
schemasfor full validation.- Parameters:
- bom
str BoM to use for the query.
- bom
- Returns:
QueryCurrent query object.
- Raises:
TypeErrorError raised if the method is called with values that do not match the types described earlier.
ValueErrorError raised if the bom isn’t valid XML, or isn’t in a known supported BoM format.
Notes
See the
ansys.grantami.bomanalytics.schemassubpackage for Ansys Granta XML BoM Schema Definitions.
- with_indicators(indicators)#
Add a list or set of
WatchListIndicatororRoHSIndicatorobjects to evaluate compliance against.- Parameters:
- indicators
list[WatchListIndicator|RoHSIndicator] List of indicators.
- indicators
- Returns:
QueryCurrent query object.
- Raises:
TypeErrorError to raise if the method is called with values that do not match the types described above.
Examples
>>> indicator = WatchListIndicator( ... name="Prop 65", ... legislation_ids=["Prop65"] ... ) >>> MaterialComplianceQuery().with_indicators([indicator]) <MaterialCompliance: 0 materials, batch size = 100, 1 indicators>
Query result#
- class BomComplianceQueryResult(results, indicator_definitions, messages)#
Retrieves the result of running the
BomComplianceQueryclass.This class summarizes the compliance status of a BoM against one or more indicators.
- compliance_by_indicator#
Compliance status for each indicator in the original query. The indicator name is used as the dictionary key.
The result for each indicator is determined by taking the worst result for that indicator across all items included in the query.
- Returns:
Examples
>>> compliance_result: MaterialComplianceQueryResult >>> compliance_result.compliance_by_indicator {'Prop 65': <WatchListIndicator, name: Prop 65, flag: WatchListFlag.WatchListAboveThreshold> }
- compliance_by_part_and_indicator#
Compliance status for each root part included in the BoM specified in the original query.
- Returns:
Examples
>>> result: BomComplianceQueryResult >>> result.compliance_by_part_and_indicator [<PartWithComplianceResult, 1 indicators>]
- 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
loggingmodule to theansys.grantami.bomanalyticslogger. By default, messages with a severity of"warning"or higher are printed on stderr.