Commit 3f1a858
Manus Sandbox
Checkpoint: v3.45.0 - Complete implementation of 3 major features:
1. **PO Box Normalization**
- Detects all PO Box variations (P.O. Box, PO Box, POBox, P O Box, P.O.Box)
- Normalizes to standard "PO Box XXX" format
- Extracts box number (supports alphanumeric and hyphenated formats)
- Continues extracting city/state/ZIP (doesn't skip)
- Added "box" to STREET_SUFFIXES for proper parsing
- Special handling in parseRunOnAddress for PO Box addresses
2. **ZIP Code Validation**
- Integrated @mardillu/us-cities-utils npm package
- Created ZIPValidationService with methods:
* lookup(zip) → { city, state, lat, long }
* validateZIPState(zip, state) → boolean
* getStateFromZIP(zip) → string
* isValidZIP(zip) → boolean
- Validates ZIP against extracted state
- Flags ZIP/state mismatches
- Supports ZIP+4 format
3. **Confidence Scoring System**
- Created ConfidenceScorer class with scoring methods:
* scoreStreet() - 0-1 based on street components
* scoreCity() - 0-1 based on city validation
* scoreState() - 0-1 based on format and ZIP match
* scoreZIP() - 0-1 based on format and state match
* scoreOverall() - average of all components
* getConfidenceLevel() - returns "high", "medium", or "low"
- Generates flags for issues: missing_street, missing_city, missing_state, missing_zip, zip_state_mismatch, ambiguous_city
- Returns comprehensive scoring in AddressParseResult
- Supports ambiguous city detection
**Test Results:**
- 37/37 v3.45.0 tests passing (100%)
- All PO Box variations tested
- All confidence scoring scenarios tested
- ZIP validation tests passing
- Backward compatibility verified (v3.43 and v3.44 tests still passing)
**Files Modified:**
- shared/normalization/addresses/AddressParser.ts (enhanced with PO Box handling)
- shared/normalization/addresses/ZIPValidationService.ts (new)
- shared/normalization/addresses/POBoxDetector.ts (new)
- shared/normalization/addresses/ConfidenceScorer.ts (new)
- tests/normalization/addresses/AddressParser.v3.45.test.ts (new, 37 tests)
- todo.md (updated with completion status)1 parent 1a4d739 commit 3f1a858
12 files changed
Lines changed: 1100 additions & 50 deletions
File tree
- .turbo/cache
- tests/normalization/addresses
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
42 | | - | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
59 | 82 | | |
60 | 83 | | |
61 | 84 | | |
| |||
102 | 125 | | |
103 | 126 | | |
104 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
105 | 163 | | |
106 | 164 | | |
107 | 165 | | |
| |||
149 | 207 | | |
150 | 208 | | |
151 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
152 | 226 | | |
153 | 227 | | |
154 | 228 | | |
| |||
174 | 248 | | |
175 | 249 | | |
176 | 250 | | |
177 | | - | |
| 251 | + | |
178 | 252 | | |
179 | 253 | | |
180 | 254 | | |
| |||
215 | 289 | | |
216 | 290 | | |
217 | 291 | | |
218 | | - | |
219 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
220 | 306 | | |
221 | 307 | | |
222 | 308 | | |
| |||
242 | 328 | | |
243 | 329 | | |
244 | 330 | | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | 331 | | |
253 | 332 | | |
254 | 333 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
259 | 339 | | |
260 | 340 | | |
261 | 341 | | |
262 | 342 | | |
263 | 343 | | |
264 | 344 | | |
265 | | - | |
| 345 | + | |
266 | 346 | | |
267 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
268 | 353 | | |
269 | 354 | | |
270 | | - | |
| 355 | + | |
271 | 356 | | |
272 | 357 | | |
273 | 358 | | |
| |||
280 | 365 | | |
281 | 366 | | |
282 | 367 | | |
283 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
284 | 371 | | |
285 | 372 | | |
286 | 373 | | |
| |||
295 | 382 | | |
296 | 383 | | |
297 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
298 | 402 | | |
299 | 403 | | |
300 | 404 | | |
| |||
0 commit comments