MapColonies / MapColonies/raster-shared

Shared canonical export-name converter (camelCase to snake_case with override table)

Open
#211 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Ready For Development
Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
2m
Merged PRs (30d)
1

Description

## What to build

Add a shared **canonical export-name converter** to `raster-shared` that maps camelCase property keys to the snake_case column names used when writing GeoPackage export tables. It wraps `change-case`'s `snakeCase` for the general case and consults a small **override table** for naming exceptions.

The override table's only entry today is `resolutionDegree → resolution_deg` (the per-part resolution field). Note the aggregate fields `maxResolutionDeg`/`minResolutionDeg` already abbreviate, so they need no override. The override table is the single, documented place where export-naming exceptions are declared.

Name the function to reflect that it is the canonical export-column-name mapping (e.g. an export-column-name converter), **not** a generic snake_case utility, so future consumers understand it carries overrides. This converter is intended to replace Overseer's private `convertObjectKeysToSnakeCase` and to be consumed by `polygon-parts-worker`.

No snake_case TypeScript type is produced — snake_case is derived at runtime only; the camelCase Zod schemas in `raster-shared` remain the source of truth for field names.

Release a new `raster-shared` version so downstream repos can consume it.

## Acceptance criteria

- [ ] A converter exported from `raster-shared` maps an object's camelCase keys to snake_case keys, using `change-case` for the general case.
- [ ] Acronym/number tokens convert correctly: `horizontalAccuracyCE90 -> horizontal_accuracy_ce90`, `imagingTimeBeginUTC -> imaging_time_begin_utc`.
- [ ] An override table is consulted before the general rule; `resolutionDegree` maps to `resolution_deg`.
- [ ] Adding or removing an override is a single-location change.
- [ ] Unit tests cover the general conversion, the acronym/number cases, and every override entry.
- [ ] A new `raster-shared` version is released and publishable for downstream consumption.

## Blocked by

- None - can start immediately.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the raster-shared export surface, its existing tests, and the package release configuration; also inspect Overseer's private convertObjectKeysToSnakeCase and the polygon-parts-worker consumer. Add the shared converter and one documented override table, cover general, acronym/number, and override cases, then verify a new raster-shared version can be released for downstream use.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.