Commit 0eb5dcc
committed
fix: dynamically parse all census field appends
Replace hardcoded census year parsing (census2010, census2020, census2023)
with dynamic detection and parsing of any census field returned by the API.
Changes:
- Modified _parse_fields() to automatically detect and parse any field
matching the pattern "census" + digits (e.g., census2024, census2025)
- Removed slots=True from GeocodioFields to allow dynamic field passing
via **kwargs (backwards compatible, negligible performance impact)
- Only parses census fields that are defined in the GeocodioFields model
Benefits:
- Fixes issue where census2024 was not being parsed
- Future-proof: new census years only require adding a field definition
to GeocodioFields, no changes needed to parsing logic
- Maintains backwards compatibility with all existing census fields
Fixes #121 parent 0a06fca commit 0eb5dcc
2 files changed
+13
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
460 | 457 | | |
461 | 458 | | |
462 | 459 | | |
| |||
515 | 512 | | |
516 | 513 | | |
517 | 514 | | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | 515 | | |
522 | 516 | | |
523 | 517 | | |
| |||
528 | 522 | | |
529 | 523 | | |
530 | 524 | | |
| 525 | + | |
531 | 526 | | |
532 | 527 | | |
533 | 528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| |||
0 commit comments