Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Residential Unit types captured via List component #192

Merged
merged 4 commits into from
Jul 3, 2024

Conversation

jessicamcinchak
Copy link
Member

@jessicamcinchak jessicamcinchak commented Jul 1, 2024

Based on:

Changes:

  • Adds residential unit type definitions to ODP Schema
    • Sites within the UK can have data.property.units.residential and/or data.proposal.units.residential
    • Sites within the GLA will have data.proposal.units.residential with possible children new, rebuilt, removed, retained
  • Updates existing Prior Approval example (in GLA with 1 rebuilt res unit)
  • Residential units introduce a lot of new enums - the type definitions to convert the enum to a typescript value/description pair were adding a lot of clutter to schema type files - so now they're co-located with their enum definition which I prefer (sorry this adds so much noise though!). This refactor does not actually effect the generated schema.json, changes there only reflect newly introduced types

Next:

  • Add units.residential types to minor, major and other applicable examples

@jessicamcinchak jessicamcinchak marked this pull request as ready for review July 2, 2024 20:46
@jessicamcinchak jessicamcinchak requested a review from a team July 2, 2024 20:46
@jessicamcinchak
Copy link
Member Author

Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - one minor language question that can be addressed here, or discussed later.

Co-locating enums and types seems like a good call 👍

*/
type IntersectingPlanningDesignation = {
intersects: true;
entities: Entity[] | [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason this isn't strictly an Entity[]?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of a weird relic.

You'll find it in existing examples like this (constraint values which don't map to a single Planning Data dataset etc):

{
  value: 'designated',
  description: 'Designated land',
  intersects: true,
  entities: [],
},

I think it was a strategy to require entity when intersects is true. But we could also make entity optional, then enforce entities: Entity[]. I'll revisit this one in another PR as a number of other examples will have to be updated!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation 👍

@@ -69,6 +71,14 @@ export interface UKProperty {
lastUseEndDate: Date;
};
};
units?: {
residential: {
tenure: UKTenureType;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick naming question - do we want to have "UK" / "National" just to be implicit in all these types, with subcategories based on them?

SoTenureType is always assumed to be national unless prefixes/suffixed by a region? e.g. GLATenureType or TenureTypeGLA

Main reason to flag this would be if something is currently national (e.g. Materials), but later becomes more distinct for a region it would mean changing the definition of the original type + adding a new one (e.g. MaterialsUK + MaterialsScotland - a breaking change) vs just adding a new type (MaterialsScotland - a minor change).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good question. In my mind, I'm using the UK prefix for specific cases when the GLA & UK categories have no overlap, which feels a little different than cases where the GLA categories extend national categories.

But you're right that this could very well create unnecessary breaking changes later. I'll open a follow-up re-naming PR before we do a proper release to remove the UK prefixes and make all of this consistent (it's going to touch a lot of files)!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep this seems like the best approach here 👍

types/schema/data/Proposal.ts Show resolved Hide resolved
@jessicamcinchak jessicamcinchak merged commit f635944 into main Jul 3, 2024
3 checks passed
@jessicamcinchak jessicamcinchak deleted the jess/residential-unit-list-schemas branch July 3, 2024 08:40
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.

2 participants