From 500835a4c1f556c1e8d8e9d9eff3e10d8cd3baf7 Mon Sep 17 00:00:00 2001 From: Diana Shkolnikov Date: Fri, 6 Nov 2015 16:17:11 -0500 Subject: [PATCH 1/6] Update addressit module to not strip 0s from zipcodes --- package.json | 2 +- test/ciao/search/address_parsing.coffee | 2 +- test/unit/fixture/search_full_address.js | 4 ++-- test/unit/fixture/search_regions_address.js | 2 +- test/unit/helper/text_parser.js | 18 +++++++++++++++--- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index be08ea46..88e9ea2c 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "elasticsearch": ">=1.2.1" }, "dependencies": { - "addressit": "1.3.0", + "addressit": "git://github.com/dianashk/addressit.git@9da3f04128c22b28710a993a4cedd0ad4f5aa4a3", "async": "^0.9.0", "check-types": "^3.3.1", "cluster2": "git://github.com/missinglink/cluster2.git#node_zero_twelve", diff --git a/test/ciao/search/address_parsing.coffee b/test/ciao/search/address_parsing.coffee index 83d3e1bc..e39f484e 100644 --- a/test/ciao/search/address_parsing.coffee +++ b/test/ciao/search/address_parsing.coffee @@ -34,7 +34,7 @@ json.geocoding.query['size'].should.eql 10 #? address parsing json.geocoding.query.parsed_text['name'].should.eql '30 w 26th st' -json.geocoding.query.parsed_text['number'].should.eql 30 +json.geocoding.query.parsed_text['number'].should.eql '30' json.geocoding.query.parsed_text['street'].should.eql 'w 26th st' json.geocoding.query.parsed_text['state'].should.eql 'NY' json.geocoding.query.parsed_text['regions'].should.eql [] diff --git a/test/unit/fixture/search_full_address.js b/test/unit/fixture/search_full_address.js index 93572705..5d8d676f 100644 --- a/test/unit/fixture/search_full_address.js +++ b/test/unit/fixture/search_full_address.js @@ -88,7 +88,7 @@ module.exports = { },{ 'match': { 'address.number': { - 'query': 123, + 'query': '123', 'boost': vs.var('address:housenumber:boost').get(), 'analyzer': vs.var('address:housenumber:analyzer').get() } @@ -104,7 +104,7 @@ module.exports = { }, { 'match': { 'address.zip': { - 'query': 10010, + 'query': '10010', 'boost': vs.var('address:postcode:boost').get(), 'analyzer': vs.var('address:postcode:analyzer').get() } diff --git a/test/unit/fixture/search_regions_address.js b/test/unit/fixture/search_regions_address.js index cc04943b..5ee79796 100644 --- a/test/unit/fixture/search_regions_address.js +++ b/test/unit/fixture/search_regions_address.js @@ -87,7 +87,7 @@ module.exports = { },{ 'match': { 'address.number': { - 'query': 1, + 'query': '1', 'boost': vs.var('address:housenumber:boost').get(), 'analyzer': vs.var('address:housenumber:analyzer').get() } diff --git a/test/unit/helper/text_parser.js b/test/unit/helper/text_parser.js index a4ce64e3..3accf7b9 100644 --- a/test/unit/helper/text_parser.js +++ b/test/unit/helper/text_parser.js @@ -85,7 +85,7 @@ module.exports.tests.parse_address = function(test, common) { var address = parser.get_parsed_address(query_string); t.equal(typeof address, 'object', 'valid object for the address'); - t.equal(address.number, 123, 'parsed house number'); + t.equal(address.number, '123', 'parsed house number'); t.equal(address.street, 'main st', 'parsed street'); t.deepEqual(address.regions, ['new york'], 'parsed city'); t.equal(address.state , 'NY', 'parsed state'); @@ -96,11 +96,23 @@ module.exports.tests.parse_address = function(test, common) { var address = parser.get_parsed_address(query_string); t.equal(typeof address, 'object', 'valid object for the address'); - t.equal(address.number, 123, 'parsed house number'); + t.equal(address.number, '123', 'parsed house number'); t.equal(address.street, 'main st', 'parsed street'); t.deepEqual(address.regions, ['new york'], 'parsed city'); t.equal(address.state , 'NY', 'parsed state'); - t.equal(address.postalcode, 10010, 'parsed zip'); + t.equal(address.postalcode, '10010', 'parsed zip is a string'); + t.end(); + }); + test('valid address with leading 0s in zipcode', function(t) { + var query_string = '339 W Main St, Cheshire, 06410'; + var address = parser.get_parsed_address(query_string); + + console.log(address); + + t.equal(typeof address, 'object', 'valid object for the address'); + t.equal(address.street, 'W Main St', 'parsed street'); + t.deepEqual(address.regions, ['Cheshire'], 'parsed city'); + t.equal(address.postalcode, '06410', 'parsed zip'); t.end(); }); }; From 804a520839ae5dc2b0db48f75d2301bf925aaefa Mon Sep 17 00:00:00 2001 From: Diana Shkolnikov Date: Fri, 6 Nov 2015 16:30:16 -0500 Subject: [PATCH 2/6] Fix github link --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 88e9ea2c..e5cb2abc 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "elasticsearch": ">=1.2.1" }, "dependencies": { - "addressit": "git://github.com/dianashk/addressit.git@9da3f04128c22b28710a993a4cedd0ad4f5aa4a3", + "addressit": "git://github.com/dianashk/addressit.git#9da3f04128c22b28710a993a4cedd0ad4f5aa4a3", "async": "^0.9.0", "check-types": "^3.3.1", "cluster2": "git://github.com/missinglink/cluster2.git#node_zero_twelve", From bb3fede3c0b2b3bd781bd429565e450ed5a1cfda Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Mon, 9 Nov 2015 15:37:24 -0500 Subject: [PATCH 3/6] Fix references to address zip --- middleware/confidenceScore.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/middleware/confidenceScore.js b/middleware/confidenceScore.js index 68b85c0d..ea5f83e4 100644 --- a/middleware/confidenceScore.js +++ b/middleware/confidenceScore.js @@ -100,7 +100,7 @@ function checkForDealBreakers(req, hit) { return true; } - if (check.assigned(req.clean.parsed_text.postalcode) && req.clean.parsed_text.postalcode !== hit.zip) { + if (check.assigned(req.clean.parsed_text.postalcode) && req.clean.parsed_text.postalcode !== hit.address.zip) { logger.debug('[confidence][deal-breaker]: postalcode !== zip'); return true; } @@ -208,7 +208,7 @@ function propMatch(textProp, hitProp, expectEnriched) { * @param {object} [hit.address] * @param {string|number} [hit.address.number] * @param {string} [hit.address.street] - * @param {string|number} [hit.zip] + * @param {string|number} [hit.address.zip] * @param {string} [hit.admin1_abbr] * @param {string} [hit.alpha3] * @returns {number} From c6c547f6a23ad3a8dd46dc8b20fed5ef50e71c71 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Mon, 9 Nov 2015 15:37:45 -0500 Subject: [PATCH 4/6] Log expected and actual zipcode when computing confidence --- middleware/confidenceScore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleware/confidenceScore.js b/middleware/confidenceScore.js index ea5f83e4..b100b973 100644 --- a/middleware/confidenceScore.js +++ b/middleware/confidenceScore.js @@ -101,7 +101,7 @@ function checkForDealBreakers(req, hit) { } if (check.assigned(req.clean.parsed_text.postalcode) && req.clean.parsed_text.postalcode !== hit.address.zip) { - logger.debug('[confidence][deal-breaker]: postalcode !== zip'); + logger.debug('[confidence][deal-breaker]: postalcode !== zip (' + req.clean.parsed_text.postalcode + ' !== ' + hit.address.zip + ')'); return true; } } From f3915f58a9f2dc2b683e43ac29a24f90557410d3 Mon Sep 17 00:00:00 2001 From: Grant Heffernan Date: Fri, 20 Nov 2015 08:23:04 -0500 Subject: [PATCH 5/6] deploy to prod_build when staging is updated, not production --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 1db0b1ba..37a6e3d7 100644 --- a/circle.yml +++ b/circle.yml @@ -11,7 +11,7 @@ deployment: - git clone git@github.com:mapzen/pelias-deploy.git && cd pelias-deploy && bundle install - cd pelias-deploy && bundle exec rake deploy:api[dev] prod_build: - branch: production + branch: staging commands: - git clone git@github.com:mapzen/pelias-deploy.git && cd pelias-deploy && bundle install - cd pelias-deploy && bundle exec rake deploy:api[prod_build] From ed2d8bea72f08113dcfb43789002d2b35b23147f Mon Sep 17 00:00:00 2001 From: Diana Shkolnikov Date: Mon, 30 Nov 2015 10:27:08 -0500 Subject: [PATCH 6/6] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e5cb2abc..eb9a4b10 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "elasticsearch": ">=1.2.1" }, "dependencies": { - "addressit": "git://github.com/dianashk/addressit.git#9da3f04128c22b28710a993a4cedd0ad4f5aa4a3", + "addressit": "git://github.com/dianashk/addressit.git#temp", "async": "^0.9.0", "check-types": "^3.3.1", "cluster2": "git://github.com/missinglink/cluster2.git#node_zero_twelve",