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

EL-1692: postcode.io validates postcode and country #357

Merged

Conversation

MazOneTwoOne
Copy link
Contributor

@MazOneTwoOne MazOneTwoOne commented Sep 26, 2024

What does this pull request do?

  • create a new function called validate_postcode_and_return_country which uses postcode.io to validate full & partial postcodes and to look up country.
  • update clean method to use validate_postcode_and_return_country
  • add error logging to handle what happens when there is no validate country or when postcode.io is down.
  • add retries to the api call

Any other changes that would benefit highlighting?

  • for Guernsey & Jersey the country comes back as 'Channel Islands', I've had to use nhs_ha key.

Checklist

  • Provided JIRA ticket number in the title, e.g. "LGA-152: Sample title"

- create a new function called `validate_postcode_and_return_country` which uses `postcode.io` to validate full & partial postcodes and to look up country.
- update `clean` method to use `validate_postcode_and_return_country`
- add error logging to handle what happens when there is no validate country or when postcode.io is down
- add comment about flake8
@MazOneTwoOne MazOneTwoOne force-pushed the El-1692-postcode-lookup-validation-using-postcode-io branch from 73ab5bf to 62c60a1 Compare September 27, 2024 12:02
@MazOneTwoOne MazOneTwoOne marked this pull request as ready for review September 27, 2024 12:03
@MazOneTwoOne MazOneTwoOne requested a review from a team as a code owner September 27, 2024 12:03
Copy link
Contributor

@HettieS HettieS left a comment

Choose a reason for hiding this comment

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

A couple comments from me, be good to also get a python dev to review!

fala/apps/adviser/forms.py Outdated Show resolved Hide resolved
fala/apps/adviser/forms.py Outdated Show resolved Hide resolved
fala/apps/adviser/forms.py Outdated Show resolved Hide resolved
- add new test for scottish border postcodes & add extra comments for test cases
Copy link

sonarcloud bot commented Oct 2, 2024

Copy link
Contributor

@psweeting1 psweeting1 left a comment

Choose a reason for hiding this comment

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

LGTM

@MazOneTwoOne MazOneTwoOne merged commit 02b239d into main Oct 2, 2024
8 checks passed
@MazOneTwoOne MazOneTwoOne deleted the El-1692-postcode-lookup-validation-using-postcode-io branch October 2, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants