Skip to content

Conversation

GeoWill
Copy link
Contributor

@GeoWill GeoWill commented Oct 7, 2025

Rebased on #621
Wait till doc wording is figured out before merging.

@GeoWill GeoWill force-pushed the postcode-logging branch 3 times, most recently from 8e64fde to f0805ca Compare October 7, 2025 15:08
@GeoWill GeoWill requested a review from symroe October 7, 2025 15:14
Comment on lines +24 to +26
postcode_location = result.get("postcode_location", {})
properties = postcode_location.get("properties", {})
postcode = properties.get("postcode", None)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This feels very defensive, but I figure we don't want to fall over here because there wasn't a postcode_location or properties object.

Copy link
Member

Choose a reason for hiding this comment

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

Same comment from the EC API. We don't want to log None postcodes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I wasn't sure which way to go. I think we shouldn't end up logging None postcodes because we should always have a postcode from WDIV. If this broke then I was thinking that logging them was a good way to be able to look back and see how long the problem was. I guess it does just pollute the logs table though. Happy to put a check in and not log if postcode is None

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think it would be better to not log here, but to raise an error in Sentry. We still get to see when things are going wrong, but don't persist this to the logs

@GeoWill GeoWill marked this pull request as draft October 14, 2025 15:08
If WDIV returns a list of addresses don't log. We will log the result
returned if there is a follow up request on the address endpoint.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These wdiv_address.json files are included because we were using the same fixures to mock responses from the WDIV postcode endpoint and the WDIV address endpoint. The only difference is that the address endpoint always includes a single address object in the addresses array. This was how I was going to get the postcode, before it was added to the postcode_location geojson. However I left these files here since they make it a bit more explicit that the endpoints aren't exactly the same.

@GeoWill GeoWill marked this pull request as ready for review October 15, 2025 12:39
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