developmentseed / developmentseed/titiler-covjson

Modeler part 2c: to_coverage_collection

Open
#24 1 comment 0 reactions 0 assignees View on GitHub
deferred
Dominant language
Python
Stars
1
Forks
1
Avg merge
2d 1h
Merged PRs (30d)
12

Description

Part of #18 (and #8). Third of three PRs splitting #18. Depends only on the union + `to_coverage` (not on Point), so it can land in either order after the Grid-only refactor.

**Add `to_coverage_collection(inputs)` for multi-result responses.**

### Tasks
- `modeler.py`: `to_coverage_collection(inputs: list[CoverageInput]) -> CoverageCollection`.
- Raise `ValueError` on empty `inputs`.
- Build one member `Coverage` per input via `to_coverage`.
- Derive collection-level `parameters` and `referencing` from `inputs[0]`; **validate** every other input yields equal parameters and equal referencing, raising `ValueError` on mismatch (no silent per-member metadata loss).
- Hoist: rebuild members (via `model_copy`, frozen-safe) so they carry no per-coverage `parameters` and no per-domain `referencing`; both live at the collection level.
- Set `CoverageCollection.domainType` only when all members share one domain type.
- Tests (schema-validated): happy path (shared parameters/referencing hoisted, members stripped); mismatch-raises; empty-raises.

### Done when
`uv run pytest`, `uv run ruff check`, `uv run ruff format --check`, and `uv run mypy` all pass.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in modeler.py at the to_coverage entry point and the CoverageInput, Coverage, and CoverageCollection models. Add schema-validated tests for the shared-metadata happy path, metadata mismatches, and empty inputs. Done means uv run pytest, uv run ruff check, uv run ruff format --check, and uv run mypy all pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.