File size: 5,045 Bytes
625d5ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e934b8c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
625d5ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e934b8c
 
625d5ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
---

title: HTS Review Tool
sdk: streamlit
emoji: 👀
colorFrom: blue
colorTo: green
---

# HTS Checker - Tariff Audit Tool

A Streamlit application for auditing HTS (Harmonized Tariff Schedule) codes, validating primary HTS against additional tariffs and description keywords.

## Features

- **Auto-validation**: Validation runs automatically when file is uploaded
- **17 Scenarios**: Validates Steel, Aluminum, Copper tariff classifications
- **Unique Combinations View**: De-duplicates entries by HTS+Description for efficient review
- **Interactive Filters**: Filter by HTS, description, status, scenario
- **Bulk Export**: Add filtered results to cache and export to Excel
- **HTS Reference**: View all Steel/Aluminum/Copper HTS lists with overlap analysis
- **Editable Keywords**: Customize metal, aluminum, copper, zinc, plastics keyword lists

## Validation Scenarios

| ID | Description |
|----|-------------|
| S1 | Steel HTS + 232 tariff applied - verify 99030133 present, no 99030125 |
| S2 | Metal keyword but NOT steel HTS - should apply 99030125, no 232 tariffs |
| S4 | Aluminum HTS + 232 tariff applied - verify 99030133 present, no 99030125 |
| S5 | Aluminum keyword but NOT aluminum HTS - should apply 99030125, no 232 tariffs |
| S7 | Dual Steel+Aluminum HTS - matches keyword, apply corresponding 232, no 99030125 |
| S7a | Dual Steel+Aluminum HTS + BOTH keywords - flag for manual review |
| S8 | Dual Steel+Aluminum HTS + NO keywords - flag for manual review |
| S9 | Copper keyword but NOT copper HTS - should apply 99030125, no 232 tariffs |
| S11 | Dual Aluminum+Copper HTS + copper keyword - apply 99030133 + copper tariffs, no 99030125 |
| S12 | Dual Aluminum+Copper HTS + aluminum keyword - apply 99030133 + aluminum 232, no 99030125 |
| S13 | Zinc keyword - should ONLY apply 99030125, no 232 tariffs allowed |
| S14 | Plastics keyword + metal HTS - override, should ONLY apply 99030125 |
| S15 | Steel HTS + aluminum keyword - should apply 99030125, no 99030133 or 232 tariffs |
| S16 | Aluminum HTS + steel keyword - should apply 99030125, no 99030133 or 232 tariffs |
| S17 | Copper HTS but NO copper keyword - should apply copper tariffs + 99030125, no 99030133 |

## Key Additional HTS Codes

| Code | Type |
|------|------|
| 99038190, 99038191 | Steel Section 232 |
| 99038507, 99038508 | Aluminum Section 232 |
| 99037801, 99037802 | Copper tariffs |
| 99030133 | General 301 (accompanies 232) |
| 99030125 | Mismatch/Override code |

## Input File Format

Upload Excel file with these columns:
- **Column E (Description)**: Product description for keyword matching
- **Column F (Tariff)**: 10-digit Primary HTS code
- **Columns I-N (Primary 1-6)**: Additional HTS codes applied

## Default Keywords

**Metal**: steel, stainless steel, carbon steel, iron, metal

**Aluminum**: aluminum, aluminium

**Copper**: copper

**Zinc**: zinc

**Plastics**: plastic, abs, pu, pvc, polyester, nylon

## Tabs

1. **Upload & Filter**: Upload Excel file, apply initial filters
2. **Validation Results**: View all results with interactive filters, add to export cache
3. **Unique Combinations**: De-duplicated view by HTS+Description with occurrence count
4. **Keyword Management**: Edit keyword lists used for validation
5. **Export Selection**: Manage export cache and download Excel reports
6. **HTS Reference**: View Steel/Aluminum/Copper HTS lists and overlaps

## Password Protection

The app requires password authentication. Configure it using one of these methods:

### For Hugging Face Spaces

1. Go to your Space's **Settings** > **Repository secrets**
2. Add a secret named `APP_PASSWORD` with your password value
3. The app will automatically use this for authentication

### For Local Development

Set the environment variable before running:

```bash

# Windows

set HTS_CHECKER_PASSWORD=your_password_here

streamlit run app.py



# Linux/Mac

export HTS_CHECKER_PASSWORD=your_password_here

streamlit run app.py

```

Or create a `.streamlit/secrets.toml` file:
```toml

APP_PASSWORD = "your_password_here"

```

**Note**: If no password is configured, the app runs without authentication (for development).

## Local Development

```bash

cd HTS_Checker

pip install -r requirements.txt

streamlit run app.py

```

## Hugging Face Deployment

1. Create a new Space on [Hugging Face](https://huggingface.co/spaces)
2. Select **Streamlit** as the SDK
3. Upload these files:
   - `app.py`
   - `hts_validator.py`
   - `HTS_list.py`
   - `requirements.txt`
4. Go to **Settings** > **Repository secrets** and add `APP_PASSWORD`
5. The app will auto-deploy with password protection

## Files

| File | Description |
|------|-------------|
| `app.py` | Streamlit UI application |
| `hts_validator.py` | Core validation logic |
| `HTS_list.py` | Steel, Aluminum, Copper HTS code lists |
| `requirements.txt` | Python dependencies |

## Requirements

- streamlit
- pandas
- openpyxl