{"action":"created","issue":{"url":"https://api.github.com/repos/alphagov/imminence/issues/116","labels_url":"https://api.github.com/repos/alphagov/imminence/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/alphagov/imminence/issues/116/comments","events_url":"https://api.github.com/repos/alphagov/imminence/issues/116/events","html_url":"https://github.com/alphagov/imminence/pull/116","id":114587969,"number":116,"title":"Autocorrect mistakes in postcodes entered into local transaction pages","user":{"login":"issyl0","id":355033,"avatar_url":"https://avatars.githubusercontent.com/u/355033?v=3","gravatar_id":"","url":"https://api.github.com/users/issyl0","html_url":"https://github.com/issyl0","followers_url":"https://api.github.com/users/issyl0/followers","following_url":"https://api.github.com/users/issyl0/following{/other_user}","gists_url":"https://api.github.com/users/issyl0/gists{/gist_id}","starred_url":"https://api.github.com/users/issyl0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/issyl0/subscriptions","organizations_url":"https://api.github.com/users/issyl0/orgs","repos_url":"https://api.github.com/users/issyl0/repos","events_url":"https://api.github.com/users/issyl0/events{/privacy}","received_events_url":"https://api.github.com/users/issyl0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-02T12:49:49Z","updated_at":"2015-11-06T11:54:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/alphagov/imminence/pulls/116","html_url":"https://github.com/alphagov/imminence/pull/116","diff_url":"https://github.com/alphagov/imminence/pull/116.diff","patch_url":"https://github.com/alphagov/imminence/pull/116.patch"},"body":"- We were seeing lots of errors for postcodes entered\r\n  with obvious typos, eg. hyphens instead of spaces, 0 instead of O, I\r\n  instead of 1, etc, so this is an attempt at fixing most common ones.\r\n- Strip most non-alphanumerics and trailing whitespace. Also use the\r\n  `uk_postcode` gem to fix transposition of I/1, O/0.\r\n- The `routes.rb` file had a constraint on the `areas/postcode` route,\r\n  but this change failed to work with it, so I've removed it in favour\r\n  of a better regex in the controller.\r\n\r\nTrello: https://trello.com/c/2KHTEa4l/127-auto-correct-mistakes-in-postcodes-entered-by-users-on-local-transaction-pages.\r\n\r\n(Thanks to @h-lame for help with understanding the tests.)"},"comment":{"url":"https://api.github.com/repos/alphagov/imminence/issues/comments/154392418","html_url":"https://github.com/alphagov/imminence/pull/116#issuecomment-154392418","issue_url":"https://api.github.com/repos/alphagov/imminence/issues/116","id":154392418,"user":{"login":"issyl0","id":355033,"avatar_url":"https://avatars.githubusercontent.com/u/355033?v=3","gravatar_id":"","url":"https://api.github.com/users/issyl0","html_url":"https://github.com/issyl0","followers_url":"https://api.github.com/users/issyl0/followers","following_url":"https://api.github.com/users/issyl0/following{/other_user}","gists_url":"https://api.github.com/users/issyl0/gists{/gist_id}","starred_url":"https://api.github.com/users/issyl0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/issyl0/subscriptions","organizations_url":"https://api.github.com/users/issyl0/orgs","repos_url":"https://api.github.com/users/issyl0/repos","events_url":"https://api.github.com/users/issyl0/events{/privacy}","received_events_url":"https://api.github.com/users/issyl0/received_events","type":"User","site_admin":false},"created_at":"2015-11-06T11:54:12Z","updated_at":"2015-11-06T11:54:12Z","body":"(Copied @alext's comment over from the gds-api-adapters PR.)\r\n\r\n> I'm not sure why we would need this in Imminence. It doesn't seem correct for an API to be doing this > autocorrection. IMO, that should be done by the component that interacts with the end-user, not an API further down the chain.\r\n\r\n@alext: Are you suggesting then that we do the same sanitization in all of the apps that use Imminence (https://github.com/search?utf8=%E2%9C%93&q=user%3Aalphagov+%27gds_api%2Fimminence%27&type=Code&ref=searchresults (the GitHub search is slightly weird there, but...)), rather than in Imminence itself which covers most bases, with a special case for Frontend as it talks to MapIt directly?"}}