Skip to content

feat(postcodes/BR): bulk-import 5,692 municipality CEPs (#1039)#1446

Merged
dr5hn merged 1 commit into
masterfrom
feat/postcodes-brazil-bulk
Apr 27, 2026
Merged

feat(postcodes/BR): bulk-import 5,692 municipality CEPs (#1039)#1446
dr5hn merged 1 commit into
masterfrom
feat/postcodes-brazil-bulk

Conversation

@dr5hn
Copy link
Copy Markdown
Owner

@dr5hn dr5hn commented Apr 27, 2026

Adds Brazilian postcodes via the Maahzuka/database-CEPS mirror.

5,692 records, 100% state_id + 98% coordinate resolution.

Municipality-level coverage (one CEP per Brazilian município, using each muni's CEP_INICIAL as canonical). Full address-level Brazilian CEPs (~145k) are paywalled by Correios; this gives geocoding-grade coverage of every BR municipality.

Refs: #1039

Adds Brazilian postcodes via the Maahzuka/database-CEPS mirror (despite
the repo name suggesting Latin America scope, the data inside is purely
Brazilian Correios CEP municipality coverage).

1. bin/scripts/sync/import_brazil_postcodes.py — pipeline reading the
   xlsx via openpyxl streaming. Picks each municipality's CEP_INICIAL
   as the canonical postcode, formats as '#####-###'. State resolution
   via UF -> states.iso2 direct match (BR's 27 states use the same
   2-letter codes in source and CSC dataset).

2. contributions/postcodes/BR.json — 5,692 records covering all 27
   states with 100% state_id + 98% coordinate resolution.

Coverage note
- This is municipality-level coverage, not full address-level. Brazil
  has ~145,000 unique CEPs total but Correios paywalls full data.
  Each Brazilian municipality gets one canonical 'primary' code here,
  useful for geocoding and form auto-fill while keeping PR scope tight.

Validation (zero errors)
- All codes match countries.postal_code_regex (^\d{5}-\d{3}$)
- All FKs resolve, all state_codes agree with state.iso2

License & attribution
- Mirror: github.com/Maahzuka/database-CEPS
- Original publisher: Correios (Brazilian postal service)
- Each row: source: 'correios'

Refs: #1039

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 27, 2026 12:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 27, 2026
@dosubot dosubot Bot added the enhancement New feature or request label Apr 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

CSC Validation Report

PR Format

  • ✅ Description provided
  • ❌ Data source linked
  • ✅ Issue linked (recommended for data changes)
  • ✅ Justification / context provided

Labels applied: data:postcodes, large-contribution

⚠️ Large Contribution

This PR contains 5692 records. Large contributions require manual review.

Schema Validation (5692 records)

✅ All records passed validation

Cross-Reference Validation

✅ 11384 reference(s) verified

Geo-Bounds Check

  • ⚠️ contributions/postcodes/BR.json: Record 2255: coordinates (-3.8520214, -32.43518633) fall outside BR bounds [-33.75, 5.27] x [-73.99, -34.79] (with 0.45deg tolerance)

0 errors, 1 warning(s) | Status: Ready for review (with warnings)

@dr5hn dr5hn merged commit 614ce03 into master Apr 27, 2026
1 check passed
@dr5hn dr5hn deleted the feat/postcodes-brazil-bulk branch April 27, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:postcodes enhancement New feature or request large-contribution ready-for-review size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants