surreydigitalservices / locate-api

Dropwizard API to power address lookups
MIT License
2 stars 1 forks source link

Empty response [] returned when an incorrect postcode is passed instead of no data found error #1

Closed DebrajSCC closed 8 years ago

DebrajSCC commented 8 years ago

When an invalid/incorrect post code is passed in authority or addressbase api , we get 200 status code and [] response from the api , instead of 404 - no data found error.

example : https://address.digitalservices.surreyi.gov.uk/addresses?postcode=dummy response received : [] and http status code 200

pmackay commented 8 years ago

Currently postcodes are parsed to be a sequence of 1-9 letters or numbers and a space. So not very specific. I will tighten up the check.

DebrajSCC commented 8 years ago

@pmackay ... thanks for the update. Just want to highlight one more thing here is that , when I pass KT1 2DN (which is our Surrey County Hall's post code) , surprisingly it returns empty response. Wondering why so ?

BforBen commented 8 years ago

@DebrajSCC do you know what county hall is classified as in the gazetteer?

dpspice commented 8 years ago

@DebrajSCC I am able to search the NLPG on their web site and KT1 2DN doesn't return any results there either - this would suggest that that postcode doesn't actually exist in the NLPG! @BforBen can you ask your LLPG custodian as County Hall will fall under Kingston!

BforBen commented 8 years ago

@dpspice Or maybe it's a PAF thing like a PO Box?

BforBen commented 8 years ago

@dpspice I've just spoken to the custodian. They can't see a record for KT1 2DN.

They have County Hall down as KT1 2EA with a UPRN of 100023056580. There are some children which all have the same post code except for the coffee shop.

dpspice commented 8 years ago

@BforBen Looking at the Royal Mail address finder, it looks as though both postcodes are valid for County Hall. KT1 2EA looks like it is the main one for the whole building while KT1 2DN looks to be used for a few smaller offices etc. Unless your custodian knows County Hall inside out it is unlikely that he/she would have known all of the different offices, floors and rooms that each have their own address and postcode. Maybe somebody at County could send you that information to add to your gazetteer?

BforBen commented 8 years ago

@dpspice we searched on "County Hall" and "Surrey County Council" and there was only 5 records that came back all a child of the UPRN in my last comment.

The Kingston gazetteer system is still the homebrew one at the moment so there could well be some anomalies. However...

The 2DN are all "Clerk to the Council" - could they be addresses that Royal Mail have created for County at their request? Royal Mail obviously know about them to route the mail. You can't see them in the NLPG so they must come from PAF.

@pmackay SSH is blocked on this network so I can't even try to connect to the SDS server - are you able to see if KT1 2DN even appears in the MongoDB or grep the AB files? I'm wondering if it does appear whether it is a classification issue that is causing the address to not be found.

dpspice commented 8 years ago

@BforBen @pmackay I bet they don't appear anywhere in the data .... we have loads of addresses like this that we simply don't know about - big office blocks are the worst as they are always getting split up and made into sub units etc.. almost impossible to keep up with what is happening, especially as in most cases if the post gets delivered to one point in the building it always finds its way to the correct place.

It probably doesn't matter really - could the KT1 2EA address just not be used for testing?

DebrajSCC commented 8 years ago

I think the api should consider both the delivery point address and geographic address in order to return the result. So agree with @BforBen , that if we can't see them in NLPG , we must look into PAF.

pmackay commented 8 years ago

Fix for postcode validation now on staging.

I cannot find KT1 2DN in the AB CSV files. I'm assuming AB Premium has the DeliveryPoints from PAF included, so not sure why it cannot be found. The importer only deals with Addressbase, nothing to do with any separate PAF though.

BforBen commented 8 years ago

@dpspice one to raise with the PSMA helpdesk I think as the post code is found on the RM website.

DebrajSCC commented 8 years ago

@dpspice - do you have any update from PSMA ?

dpspice commented 8 years ago

@DebrajSCC sorry I'm afraid that I have got so much on that I completely forgot to contact them! I'll log a call in the morning and let you know what they say.

dpspice commented 8 years ago

@DebrajSCC @BforBen @pmackay Here is the helpful response from the hub...

"As you have found, this postcode is not included in the LPI table of AddressBase premium which implies that the custodian has not added this address yet. The currency of the PAF data used in Epoch 44 was 02 September 2016. Therefore, if this postcode was added after this date, this will not be in the current release of AddressBase Premium."

I think that for the address to appear it needs to be added to the Kingston LLPG. We have loads of addresses like this, that we don't know about, especially in office blocks where they change the internal office layout regularly.

pmackay commented 8 years ago

@BforBen are you able to follow up and get the postcode added to the Kingston LLPG?

Am closing this as the original "empty response" issue should be resolved.