Skip to content

feat(postcodes/VN): bulk-import 63 Vietnam province postcodes via VNPost (#1039)#1457

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

feat(postcodes/VN): bulk-import 63 Vietnam province postcodes via VNPost (#1039)#1457
dr5hn merged 1 commit into
masterfrom
feat/postcodes-vietnam

Conversation

@dr5hn
Copy link
Copy Markdown
Owner

@dr5hn dr5hn commented Apr 27, 2026

Summary

Adds 63 Vietnam province-level postcodes parsed from the
navuitag/dvhcvn MySQL dump.

  • Coverage: country-only by design.
  • Granularity: one record per pre-2024 province with VNPost's
    6-digit code.

Why country-only

Vietnam's 2024-2025 administrative restructuring merged the source's
63 pre-2024 provinces into the post-merger 34 provinces represented
in CSC's states.json. A clean per-row state FK is no longer
possible from this dataset — matches the SE/SI/ZA/GR precedent.

Source & licence

Validation

  • python3 -m py_compile clean.
  • 100% of 63 codes match country.postal_code_regex (^(\d{6})$).
  • No auto-managed fields (id, created_at, updated_at, flag).

Test plan

  • Importer compiles and runs on a clean checkout.
  • Cross-reference validator passes (regex + country FK).
  • Idempotent merge verified.
  • CI pipeline green.

Refs #1039.

🤖 Generated with Claude Code

…ost (#1039)

Source: VNPost province-level postcodes parsed from the
navuitag/dvhcvn MySQL dump. Ships country-only by design — Vietnam's
2024-2025 administrative restructuring merged the source's 63
pre-2024 provinces into the post-merger 34 provinces represented in
states.json, so a clean per-row state FK is no longer possible from
this dataset (matches the SE/SI/ZA/GR precedent).

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 13:22
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. enhancement New feature or request labels 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

Schema Validation (63 records)

✅ All records passed validation

Cross-Reference Validation

✅ 63 reference(s) verified

Source URL Verification

✅ 2 source URL(s) accessible


All checks passed | Status: Ready for review

@dr5hn dr5hn merged commit 1459968 into master Apr 27, 2026
3 checks passed
@dr5hn dr5hn deleted the feat/postcodes-vietnam branch April 27, 2026 13:24
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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds province-level Vietnam postcodes (VNPost) to the contributions dataset and includes a script to (re)generate the JSON from the upstream navuitag/dvhcvn SQL dump.

Changes:

  • Added contributions/postcodes/VN.json containing 63 province-level postcode records.
  • Added bin/scripts/sync/import_vietnam_postcodes.py to fetch/parse the upstream SQL and write VN.json idempotently.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

File Description
contributions/postcodes/VN.json New Vietnam postcode dataset (country-only, province-level).
bin/scripts/sync/import_vietnam_postcodes.py New importer script to generate/merge VN.json from upstream SQL.

Comment on lines +147 to +161
"code": "390000",
"country_id": 240,
"country_code": "VN",
"locality_name": "Lai Châu",
"type": "full",
"source": "vnpost-via-navuitag"
},
{
"code": "390000",
"country_id": 240,
"country_code": "VN",
"locality_name": "Điện Biên",
"type": "full",
"source": "vnpost-via-navuitag"
},
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

There are duplicate postcodes assigned to different locality_name values (e.g., 390000 appears for both Lai Châu and Điện Biên). If consumers expect a unique mapping between province and postcode, this creates ambiguity and likely indicates an incorrect import/result. Recommend verifying the upstream values and correcting the conflicting entries, and/or enforcing a validation step in the importer that fails when the same code is emitted for multiple distinct provinces (unless duplicates are explicitly intended and documented).

Copilot uses AI. Check for mistakes.
Comment on lines +347 to +361
"code": "790000",
"country_id": 240,
"country_code": "VN",
"locality_name": "Bà Rịa - Vũng Tàu",
"type": "full",
"source": "vnpost-via-navuitag"
},
{
"code": "790000",
"country_id": 240,
"country_code": "VN",
"locality_name": "Bắc Ninh",
"type": "full",
"source": "vnpost-via-navuitag"
},
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

Another postcode duplication: 790000 is assigned to both Bà Rịa - Vũng Tàu and Bắc Ninh. Same concern as above—this likely breaks lookups keyed by code and suggests at least one of these rows is wrong. Please validate against the source and fix the conflicting code(s); consider adding an importer-side check to detect and error on duplicated code values across distinct locality_names.

Copilot uses AI. Check for mistakes.
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 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