Repository navigation
fix(api): match only the subtype's own refurbishment variants - #61
Merged
Merged
Conversation
GET /variants/:country/match returned every variant whose code began with CC.N.TYPE.PERIOD and labelled them by position: existing state, medium, advanced, then "Refurbishment level N". Where a period has several subtypes (48 of 400 type and period groups) or extra variants (.004, .011 to .053, ReEx.002.*), other subtypes and alternative packages were presented as deeper refurbishment. NL SFH 03 returned Deta .001 to .003 followed by Gen as "Refurbishment level 4" to 6. The endpoint now takes an optional subtype query parameter, default Gen, and returns only TABULA's standard variants ReEx.001.001, .002 and .003 of CC.N.TYPE.PERIOD.SUBTYPE, ordered by Number_BuildingVariant. The response echoes subtype, and prefix now includes it. Each entry gains number and description. description is TABULA's Description_BuildingVariant, empty where the workbook stores "0". label is the description when there is one, otherwise TABULA's name for the number: Existing state, Usual refurbishment, Advanced refurbishment. In recent periods the standard variants are construction standards (DE SFH 11: KfW Effizienzhaus 70, passive house), which the generic names would misstate. Labelling by number rather than position also fixes subtypes that lack a variant: the newest BE and NL periods return variants 1 and 3, and HU and IE groups numbered only from .011 return an empty list. The OpenAPI spec and docs/api.md describe the new parameter and fields.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Summary
GET /api/v1/variants/{country}/matchnow returns only TABULA's standard refurbishment variants (ReEx.001.001,.002,.003) of one building subtype, labelled by variant number instead of by position.Before, every variant of the type and period came back, so other subtypes and alternative packages appeared as "Refurbishment level 4" and up. For example,
NL SFH 03listed theDetavariants and then theGenones as levels 4 to 6.API change
subtypequery parameterGen. Case as in TABULA codes (Deta,Semi,Bel80).prefixDE.N.SFH.06.Geninstead ofDE.N.SFH.06.subtyperesponse fielddata[].numberNumber_BuildingVariant(1, 2 or 3).data[].descriptionDescription_BuildingVariant, empty where TABULA gives none.data[].labelA subtype that lacks a standard variant returns only those it has: the newest BE and NL periods return variants 1 and 3. A subtype with none returns an empty
datalist, for example HU AB 02Ind, which is numbered from.011.Verification
go vet ./...andgo test ./...pass../internal/utils/ ./internal/db/ ./internal/db/repository/) pass. A newbelgiumfixture mixes two subtypes, a missing variant 2,.004andReEx.002.*.make schema-checkpasses.NL SFH 03DE SFH 11.011to.023as levels 4 to 9BE TH 05 Semi.003labelled mediumHU AB 02 Ind.011to.013labelled existing, medium, advanced