EWC-CAT
EWC Hazard Classification
1. Identity
Depends on module:
Purpose
Classifies waste line items as hazardous or non-hazardous (and optionally assigns hazard class metadata) by resolving an EWC-based mapping dataset (e.g. ewc_all_categories) under ZAR version control.
This engine is the missing governance step that makes hazardous waste reporting auditable:
- the classification rule is explicit,
- dataset version is pinned,
- and every item carries provenance.
Typical usage
- Ingest waste contractor manifests/invoices containing EWC codes
- Enrich line items with:
hazardous,hazard_class, canonicalewc_itemid, recommended unit - Feed clean items into
MEID_CALC_WASTE_AGGR(which then becomes a pure aggregator)
2. Contract References (ZAR)
2.1 Input Schema
ZAR Address: schema.compute.waste.haz_classify.inputs.v1_0_0
Required conceptual fields:
items: list of waste line items to classifymapping_ref: ZAR reference to the EWC mapping dataset (defaults allowed)jurisdiction: optional (e.g.,EU,NO,UK) for regional variationsalignment:BY_YEAR|BY_INDEX(defaultBY_YEAR)
Each item conceptually includes:
period(typically year)valueunit(e.g.,kg,tonne)- one of:
ewc_code(preferred, e.g."01 03 04*"or"010304*")ewc_item(internal key, e.g."04")
- optional:
site_idsupplier_id/contractor_idinvoice_id/manifest_iddescription(free text)regional_code(if different fromjurisdiction)
2.2 Options Schema
ZAR Address: schema.compute.waste.haz_classify.options.v1_0_0
Common options:
match_mode:EWC_CODE|EWC_ITEM|AUTO(defaultAUTO)normalize_ewc_code: boolean (default true)asterisk_means_hazardous: boolean (default true)
(EU convention:*indicates hazardous entry)unknown_code_policy:ERROR|FLAG|ASSIGN_NON_HAZARDOUS|ASSIGN_UNKNOWN(defaultFLAG)regional_variations_policy:APPLY_IF_PRESENT|IGNORE(defaultAPPLY_IF_PRESENT)unit_normalization:NO_CONVERT|CONVERT_TO_RECOMMENDED(defaultNO_CONVERT)rounding: optional digits
Unit conversion is delegated (as per your architecture rule). This engine only requests conversion if
CONVERT_TO_RECOMMENDED.
2.3 Output Schema
ZAR Address: schema.compute.waste.haz_classify.output.v1_0_0
Outputs include:
items_classified: same items enriched with classification fieldssummary: counts by classification outcomemetadata: mapping version/hash, unknown handling stats, jurisdiction used
Enriched fields per item:
hazardous: boolean or enumhazard_class:HAZARDOUS|NON_HAZARDOUS|UNKNOWNewc_item(canonical internal key)ewc_code_normalizedrecommended_unitreuse_recyclable_flagclassification_confidence(v1: 1.0 for exact match, lower for heuristic)classification_provenance(mapping_ref + row id + rule path)
3. Mapping Dataset Contract (ewc_all_categories)
The mapping dataset MUST provide at least these columns (your example fits perfectly):
ewc_item(canonical id)ewc_code(string, may include*)hazard_class(HAZARDOUS/NON_HAZARDOUS)- optional:
hazardous(boolean/Yes)regional_variations(json/text)recommended_unitreuse_recyclable_flagdescription
The engine MUST treat the dataset as authoritative and versioned:
mapping_refMUST resolve to an immutable ZAR artifact- the output MUST carry
mapping_ref+build_hash(or dataset hash if stored separately)
4. Classification Semantics (Normative)
Let an input item be .
4.1 EWC code normalization
If normalize_ewc_code = true, transform ewc_code into canonical form:
- remove spaces
- uppercase
- keep trailing
*if present
Example:
"01 03 04*"→"010304*""01 03 04 *"→"010304*"
Call the normalized code .
4.2 Matching strategy
If match_mode:
EWC_CODE: match only by normalizedewc_codeEWC_ITEM: match only byewc_itemAUTO:- try
ewc_code - fallback to
ewc_item
- try
Let the matched mapping row be .
If no match:
- apply
unknown_code_policy
4.3 Hazard determination (EU star rule)
If asterisk_means_hazardous = true and the matched ewc_code ends with *,
then hazard is hazardous even if the dataset row is missing the hazard flag.
Final hazard class:
- If match exists:
hazard_class(i) = hazard_class(m(i))
unless overridden by star rule
- If no match:
- depends on
unknown_code_policy
- depends on
Star override (if enabled):
4.4 Regional variations
If regional_variations_policy = APPLY_IF_PRESENT and a region key matches the request (jurisdiction or regional_code), apply overrides from regional_variations.
The output MUST record whether a regional override was applied.
4.5 Recommended unit enrichment
If mapping contains recommended_unit, set:
recommended_unit(i) = recommended_unit(m(i))
If unit_normalization = CONVERT_TO_RECOMMENDED, the engine MUST:
- emit a conversion request (or call the conversion dependency in execution)
- record the conversion provenance
5. Input/Output Examples
Example A — simple EWC code classification
{
"mapping_ref": "DATASET.WASTE.EWC_ALL_CATEGORIES.v1",
"jurisdiction": "EU",
"items": [
{ "period": 2025, "value": 40, "unit": "tonne", "ewc_code": "01 03 04*" },
{ "period": 2025, "value": 500, "unit": "tonne", "ewc_code": "17 01 07" }
]
}
Output (illustrative):
{
"items_classified": [
{
"period": 2025,
"value": 40,
"unit": "tonne",
"ewc_code": "01 03 04*",
"ewc_code_normalized": "010304*",
"ewc_item": "04",
"hazard_class": "HAZARDOUS",
"hazardous": true,
"recommended_unit": "tonnes",
"reuse_recyclable_flag": false,
"classification_confidence": 1.0,
"classification_provenance": {
"mapping_ref": "DATASET.WASTE.EWC_ALL_CATEGORIES.v1",
"matched_key": "ewc_code",
"matched_row_ewc_item": "04",
"rule_path": "dataset_match+asterisk_override"
}
},
{
"period": 2025,
"value": 500,
"unit": "tonne",
"ewc_code": "17 01 07",
"ewc_code_normalized": "170107",
"hazard_class": "NON_HAZARDOUS",
"hazardous": false,
"classification_confidence": 1.0,
"classification_provenance": {
"mapping_ref": "DATASET.WASTE.EWC_ALL_CATEGORIES.v1",
"matched_key": "ewc_code",
"rule_path": "dataset_match"
}
}
],
"summary": {
"total_items": 2,
"hazardous_items": 1,
"non_hazardous_items": 1,
"unknown_items": 0
}
}
6. Validation & Error Model
Invariants
- items must be non-empty
- each item must provide either
ewc_codeorewc_item - mapping dataset must resolve and be readable
- normalized codes must be syntactically valid (v1: simple regex)
Error codes (suggested)
WASTE_HAZ_MAP_NOT_FOUNDWASTE_HAZ_ITEM_MISSING_EWC_KEYWASTE_HAZ_INVALID_EWC_FORMATWASTE_HAZ_UNKNOWN_CODE_ERRORWASTE_HAZ_REGIONAL_OVERRIDE_INVALID
Errors MUST include:
- engine
cmi_short_code - item index + any manifest/invoice identifier + offending ewc code
7. Dependencies
MEID_TRANS_WASTE_HAZ_CLASSIFY depends on:
- schema resolver (ZAR)
- mapping dataset resolver (
mapping_ref) - optional unit conversion capability (delegated; only if unit normalization enabled)
Declared via ZAR dependencies.
8. Federation & Audit Requirements
To reproduce hazard classification externally, the export MUST include:
- engine identity (
cmiorzar_code) - engine build proof (
execution_ref+build_hash) - mapping dataset reference/version/hash (
mapping_ref) - jurisdiction/regional options used
- unknown handling policy
- per-item provenance (matched row / rule path)
Provenance chain MUST show:
… → MEID_TRANS_WASTE_HAZ_CLASSIFY → MEID_CALC_WASTE_AGGR → …
with cmi_short_code recorded in USO tail arrays.
9. Performance Notes
- Complexity: over items with hash-map lookup on
ewc_code_normalized - Memory: output size
- Dataset should be cached by
mapping_refin-memory per worker
10. Methods Served (v1)
Waste.item.classified(enrichment output)- (optional convenience) hazardous/non-hazardous subtotals if requested