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

migrate: find+replace article4, listed building grades, and flood zone fn #4151

Merged
merged 4 commits into from
Jan 20, 2025

Conversation

jessicamcinchak
Copy link
Member

@jessicamcinchak jessicamcinchak commented Jan 14, 2025

Updates GIS API, Planning Constraints editor modal "select-able" datasets, and all mocks per data migration plan here https://docs.google.com/spreadsheets/d/1Vtxp5BLweDPDooQoNhgOCYjCIBPRYIcOuyArGJRqOkI/edit?gid=1809688754#gid=1809688754

Copy link

github-actions bot commented Jan 14, 2025

Removed vultr server and associated DNS entries

@jessicamcinchak jessicamcinchak marked this pull request as ready for review January 20, 2025 10:33
@jessicamcinchak jessicamcinchak requested a review from a team January 20, 2025 10:34
@@ -41,6 +41,14 @@ export function handleOverrides(
);
}

const gradeAndZoneLookup: Record<string, string> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Noob question here - is there a reason "1": "One" isn't included in this mapping?

Copy link
Member Author

@jessicamcinchak jessicamcinchak Jan 20, 2025

Choose a reason for hiding this comment

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

Good question! Planning Data only hosts data for Flood Zones 2 & 3, not 1 ! PlanX content may have separate questions about Flood Zone 1 that are manually put to user which we've accounted for in content migration, but when dealing only with GIS API response we don't need to worry about 1 since it's never automatically checked/fetched 👍

Copy link
Contributor

@jamdelion jamdelion left a comment

Choose a reason for hiding this comment

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

Have added one question for my general understanding but otherwise looks good to me!

@jessicamcinchak jessicamcinchak merged commit e2f49c1 into main Jan 20, 2025
12 checks passed
@jessicamcinchak jessicamcinchak deleted the jess/migrate-constraint-fns branch January 20, 2025 11:21
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.

@jessicamcinchak Sorry just seen you've merged this.

There's an outstanding article4 here on this branch which I think also needs to update (?) - https://github.com/theopensystemslab/planx-new/blob/jess/migrate-constraint-fns/editor.planx.uk/src/@planx/components/PlanningConstraints/List.tsx#L175

Apologies for the basic question about the mapping - feel like there's something basic I've missed here...!

Comment on lines +217 to +220
const zoneLookup: Record<string, string> = {
"flood.zone.2": "flood.zoneTwo",
"flood.zone.3": "flood.zoneThree",
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'm missing something here sorry - might just be a part of the sequencing.

What we're doing below is mapping the old values (incoming request) to the new values (response sent to Editor).

The data migration is updating all values, why do we need this mapping?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry another opaque change/lack of code comment on my part ! These lookups are still necessary outside of actual content migration to correctly map the incoming Planning Data entity's flood-risk-level property to our correct data field.

Previously, our 2, 3, I, II, II* data value segments lined up exactly the same as Planning Data's values - but now they don't! See diff below as example -

Before: (entity) => entity["flood-risk-level"] === zone.split(".").pop()
After: (entity) => entity["flood-risk-level"] === oldZone.split(".").pop()

It's a bit messy but didn't think of a nicer way to handle this!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah perfect - that's the bit I'm missing - Planning Data are of course still using 2, 3 etc 👍

I was caught out by the old in the name here I think in combination with the migrations. Maybe just a comment like this will do?

// This maps the PlanningData key to the PlanX key
const zoneLookup: Record<string, string> = {

source: "Planning Data",
datasets: ["article4-direction-area"],
datasets: ["article-4-direction-area"],
Copy link
Contributor

Choose a reason for hiding this comment

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

This change surprised me - was this just wrong since these options were introduced?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes this was just wrong! Sorry didn't better highlight this.

These datasets are currently duplicated between API "base" metadata (actually referenced to make request) and editor modal (shown for source context only) - this is now corrected & future step here is to move to planx-core to remove duplication?

Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect - thanks for clarifying - this was what I figured 👍

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.

3 participants