Skip to content

feat(api): surface construction-year band on GET /data/:code - #37

Merged
jravani merged 2 commits into
mainfrom
feat/surface-construction-year-on-data
Sep 8, 2026
Merged

feat(api): surface construction-year band on GET /data/:code#37
jravani merged 2 commits into
mainfrom
feat/surface-construction-year-on-data

Conversation

@jravani

@jravani jravani commented Sep 8, 2026

Copy link
Copy Markdown
Member

Problem

The backend wants to pre-fill a default construction year for a
building from the TABULA variant code city2tabula already assigns it,
without asking the user to type one. Year1_Building and
Year2_Building - the archetype's period band - already exist as
populated integer columns for every country (ResolvePeriodByYear and
ListPeriods already read them), but GET /api/v1/data/:code did not
expose them.

Change

Adds both fields to BuildingThematic. The existing struct-mapper
matches DB columns to struct fields by json tag, so no repository,
handler, SQL, or migration change is needed - the columns already
exist and are already populated.

They land at
tabula_data.BasicParameters.BuildingAppearance.Year1_Building /
Year2_Building, using the same 0/9999 open-ended sentinels as
/api/v1/periods.

Testing

  • go test ./...
  • Verified the new assertion fails to compile against the pre-fix
    model and passes after adding the fields.

Closes #35

The backend wants to pre-fill a default construction year for a
building from the TABULA variant code city2tabula already assigns it,
without asking the user to type one. Year1_Building and Year2_Building
- the archetype's period band - already exist as populated integer
columns for every country (ResolvePeriodByYear and ListPeriods already
read them), but GET /api/v1/data/:code did not expose them.

Add both to BuildingThematic. The existing struct-mapper matches DB
columns to struct fields by json tag, so no repository, handler, SQL,
or migration change is needed - the columns already exist and are
already populated.

They land at
tabula_data.BasicParameters.BuildingAppearance.Year1_Building /
Year2_Building, using the same 0/9999 open-ended sentinels as
/api/v1/periods.

Closes #35
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…tion-year-on-data

# Conflicts:
#	docs/api.md
@jravani
jravani merged commit ddef648 into main Sep 8, 2026
5 checks passed
@jravani
jravani deleted the feat/surface-construction-year-on-data branch September 8, 2026 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Surface construction-year band on GET /api/v1/data/{code}

2 participants