Spaces:
Running
Running
Upload hts_validator.py
Browse files- hts_validator.py +27 -27
hts_validator.py
CHANGED
|
@@ -32,7 +32,7 @@ SCENARIO_SUMMARIES = {
|
|
| 32 |
"S14": "Plastics keyword + metal HTS - override, should ONLY apply 99030125",
|
| 33 |
"S15": "Steel HTS + aluminum keyword - should apply 99030125, no 99030133 or 232 tariffs",
|
| 34 |
"S16": "Aluminum HTS + steel keyword - should apply 99030125, no 99030133 or 232 tariffs",
|
| 35 |
-
"S17": "Copper HTS but NO copper keyword - should apply copper tariffs +
|
| 36 |
"COPPER_OK": "Copper HTS + copper keyword - verify copper tariffs applied",
|
| 37 |
"NONE": "No applicable scenario - entry does not match any validation rules",
|
| 38 |
}
|
|
@@ -636,32 +636,32 @@ class HTSValidator:
|
|
| 636 |
unexpected_hts=[],
|
| 637 |
issue="; ".join(issues) if issues else "Correct - copper HTS + keyword"
|
| 638 |
)
|
| 639 |
-
else:
|
| 640 |
-
# S17: Copper HTS but NO copper keyword - apply copper tariffs +
|
| 641 |
-
expected = list(COPPER_CODES) + [
|
| 642 |
-
issues = []
|
| 643 |
-
|
| 644 |
-
if not has_copper_tariff:
|
| 645 |
-
issues.append("Missing copper tariff (99037801/02)")
|
| 646 |
-
if not
|
| 647 |
-
issues.append("Missing
|
| 648 |
-
if
|
| 649 |
-
issues.append("Should NOT have
|
| 650 |
-
|
| 651 |
-
status = "PASS" if not issues else "FAIL"
|
| 652 |
-
return ValidationResult(
|
| 653 |
-
entry_number=entry_number,
|
| 654 |
-
description=description,
|
| 655 |
-
primary_hts=primary_hts,
|
| 656 |
-
additional_hts=additional_hts,
|
| 657 |
-
scenario_id="S17",
|
| 658 |
-
scenario_summary=SCENARIO_SUMMARIES["S17"],
|
| 659 |
-
status=status,
|
| 660 |
-
expected_hts=expected,
|
| 661 |
-
missing_hts=(list(COPPER_CODES) if not has_copper_tariff else []) + ([
|
| 662 |
-
unexpected_hts=[
|
| 663 |
-
issue="; ".join(issues) if issues else "Correct - copper HTS without keyword, has copper tariffs +
|
| 664 |
-
)
|
| 665 |
|
| 666 |
# S9: Copper keyword but NOT in copper list
|
| 667 |
if has_copper_kw and not in_copper:
|
|
|
|
| 32 |
"S14": "Plastics keyword + metal HTS - override, should ONLY apply 99030125",
|
| 33 |
"S15": "Steel HTS + aluminum keyword - should apply 99030125, no 99030133 or 232 tariffs",
|
| 34 |
"S16": "Aluminum HTS + steel keyword - should apply 99030125, no 99030133 or 232 tariffs",
|
| 35 |
+
"S17": "Copper HTS but NO copper keyword - should apply copper tariffs + 99030133, no 99030125",
|
| 36 |
"COPPER_OK": "Copper HTS + copper keyword - verify copper tariffs applied",
|
| 37 |
"NONE": "No applicable scenario - entry does not match any validation rules",
|
| 38 |
}
|
|
|
|
| 636 |
unexpected_hts=[],
|
| 637 |
issue="; ".join(issues) if issues else "Correct - copper HTS + keyword"
|
| 638 |
)
|
| 639 |
+
else:
|
| 640 |
+
# S17: Copper HTS but NO copper keyword - apply copper tariffs + 99030133, no 99030125
|
| 641 |
+
expected = list(COPPER_CODES) + [GENERAL_301_CODE]
|
| 642 |
+
issues = []
|
| 643 |
+
|
| 644 |
+
if not has_copper_tariff:
|
| 645 |
+
issues.append("Missing copper tariff (99037801/02)")
|
| 646 |
+
if not has_301:
|
| 647 |
+
issues.append("Missing 99030133 - copper HTS without copper keyword")
|
| 648 |
+
if has_mismatch:
|
| 649 |
+
issues.append("Should NOT have 99030125 - no mismatch expected for copper HTS")
|
| 650 |
+
|
| 651 |
+
status = "PASS" if not issues else "FAIL"
|
| 652 |
+
return ValidationResult(
|
| 653 |
+
entry_number=entry_number,
|
| 654 |
+
description=description,
|
| 655 |
+
primary_hts=primary_hts,
|
| 656 |
+
additional_hts=additional_hts,
|
| 657 |
+
scenario_id="S17",
|
| 658 |
+
scenario_summary=SCENARIO_SUMMARIES["S17"],
|
| 659 |
+
status=status,
|
| 660 |
+
expected_hts=expected,
|
| 661 |
+
missing_hts=(list(COPPER_CODES) if not has_copper_tariff else []) + ([GENERAL_301_CODE] if not has_301 else []),
|
| 662 |
+
unexpected_hts=[MISMATCH_CODE] if has_mismatch else [],
|
| 663 |
+
issue="; ".join(issues) if issues else "Correct - copper HTS without keyword, has copper tariffs + 99030133"
|
| 664 |
+
)
|
| 665 |
|
| 666 |
# S9: Copper keyword but NOT in copper list
|
| 667 |
if has_copper_kw and not in_copper:
|