feat: canonical export-name converter for GeoPackage columns (MAPCO-10823)#212
Open
razbroc wants to merge 5 commits into
Open
feat: canonical export-name converter for GeoPackage columns (MAPCO-10823)#212razbroc wants to merge 5 commits into
razbroc wants to merge 5 commits into
Conversation
Adds toExportColumnName / convertKeysToExportColumns and the EXPORT_COLUMN_NAME_OVERRIDES table (change-case snakeCase with a single resolutionDegree -> resolution_deg override). This is the single source of truth for deriving snake_case export column names, to be shared by polygon-parts-worker (Layer Parts) and overseer (Layer Metadata). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ertions Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replaces the file-wide eslint-disable with a block-scoped disable around the single toEqual whose keys are export column names, keeping the rule active elsewhere. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
CL-SHLOMIKONCHA
requested changes
Jun 29, 2026
| }; | ||
|
|
||
| /** Maps a camelCase property to its GeoPackage export column name: an override if present, else `snakeCase`. */ | ||
| export const toExportColumnName = (propertyName: string): string => { |
Contributor
There was a problem hiding this comment.
Suggested change
| export const toExportColumnName = (propertyName: string): string => { | |
| export const toGpkgColumnName = (propertyName: string): string => { |
| }; | ||
|
|
||
| /** Renames an object's keys to their export column names, preserving values (incl. `null`). */ | ||
| export const convertKeysToExportColumns = (obj: Record<string, unknown>): Record<string, unknown> => { |
Contributor
There was a problem hiding this comment.
Suggested change
| export const convertKeysToExportColumns = (obj: Record<string, unknown>): Record<string, unknown> => { | |
| export const convertKeysToGpkgColumns = (obj: Record<string, unknown>): Record<string, unknown> => { |
Contributor
There was a problem hiding this comment.
you can avoid testing the toGpkgColumnName as you already tested it within the convertKeysToGpkgColumns tests
| import { snakeCase } from 'change-case'; | ||
|
|
||
| /** Export column names that differ from plain `snakeCase` (e.g. `resolution_degree` -> `resolution_deg`). */ | ||
| export const EXPORT_COLUMN_NAME_OVERRIDES: Record<string, string> = { |
Contributor
There was a problem hiding this comment.
Suggested change
| export const EXPORT_COLUMN_NAME_OVERRIDES: Record<string, string> = { | |
| export const GPKG_COLUMN_NAME_OVERRIDES: Record<string, string> = { |
Drops the redundant toExportColumnName block (covered transitively) and folds the per-key cases into a single object-level assertion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a shared canonical export-name converter for deriving snake_case GeoPackage export column names.
toExportColumnName/convertKeysToExportColumns—change-casesnakeCasefor the general rule.EXPORT_COLUMN_NAME_OVERRIDES— the single place naming exceptions live; one entry today:resolutionDegree → resolution_deg(the aggregate side already usesmaxResolutionDeg/minResolutionDeg).This is the single source of truth for export column names, consumed by polygon-parts-worker (Layer Parts) and overseer (Layer Metadata).
Why
Both repos independently snake_cased export columns; this unifies the naming (incl. the
resolution_degexception) so the two GeoPackage tables stay consistent.Tests
9 unit tests: general conversion, CE90/UTC acronym handling, every override entry, null-value preservation, null-prototype guarantee.
Closes #211
🤖 Generated with Claude Code