fix(geo-data): correct country_id mismatch in states.csv and cities.csv#1681
fix(geo-data): correct country_id mismatch in states.csv and cities.csv#1681YogeshK34 wants to merge 4 commits into
Conversation
Signed-off-by: yogeshk34 <khutwadyogesh34@gmail.com>
Signed-off-by: yogeshk34 <khutwadyogesh34@gmail.com>
…776) Signed-off-by: yogeshk34 <khutwadyogesh34@gmail.com>
Signed-off-by: yogeshk34 <khutwadyogesh34@gmail.com>
📝 WalkthroughWalkthroughThe Prisma seed script is refactored to handle Keycloak 409 conflict responses by looking up the existing user's ID and updating the local DB with encrypted credentials, instead of returning early. The README is substantially rewritten with pnpm, Keycloak, and Prisma setup details. A ChangesPlatform Setup and Seed Improvements
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
README.md (1)
120-121: ⚡ Quick winAvoid
:latestimage tags in setup docs.Using floating tags for Keycloak and NATS makes local setup non-reproducible and can break onboarding when upstream defaults/env contracts change. Pin tested versions in the README commands.
Also applies to: 225-226
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@README.md` around lines 120 - 121, Replace the floating `:latest` Docker image tags with specific pinned version numbers in the README.md setup documentation. This applies to both the Keycloak image reference in the `quay.io/keycloak/keycloak:latest start-dev` command and the NATS image reference (also marked in the comment). Use tested and working versions instead of latest to ensure reproducible local setup and prevent onboarding breakage when upstream images are updated.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@README.md`:
- Around line 120-121: Replace the floating `:latest` Docker image tags with
specific pinned version numbers in the README.md setup documentation. This
applies to both the Keycloak image reference in the
`quay.io/keycloak/keycloak:latest start-dev` command and the NATS image
reference (also marked in the comment). Use tested and working versions instead
of latest to ensure reproducible local setup and prevent onboarding breakage
when upstream images are updated.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1f3e22dc-aeb7-4c53-8edb-6bbac85a74d2
⛔ Files ignored due to path filters (3)
libs/prisma-service/prisma/data/geo-location-master-data/cities.csvis excluded by!**/*.csvlibs/prisma-service/prisma/data/geo-location-master-data/states.csvis excluded by!**/*.csvpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
README.mddocker-compose.ymllibs/prisma-service/prisma/seed.tspackage.json



Problem
states.csvcontains a systematiccountry_idcorruption affecting all countries from Germany onward (~148 countries). Thecountry_codecolumn is correct, butcountry_idvalues don't match the IDs incountries.csv— causing states of one country to be served under another.Example:
This means selecting India in the UI returned Iran's states. Selecting Hong Kong returned India's states. No error is thrown — the data is silently wrong.
cities.csvhad the same downstream corruption.Root Cause
The
country_idcolumn was not derived fromcountries.csvIDs. Thecountry_codecolumn was always correct, butcountry_iddiverged for ~148 countries starting alphabetically around Germany.Fix
Regenerated
country_idin both CSVs by mappingcountry_code(ISO) → correctidfromcountries.csv.states.csv— 4,581 rows correctedcities.csv— 105,446 rows correctedImpact
Testing
Summary by CodeRabbit
Documentation
Infrastructure
Bug Fixes
Chores