CartoDB / dataservices-api

The CARTO Data Services API
https://carto.com/docs/carto-engine/dataservices-api/
BSD 3-Clause "New" or "Revised" License
22 stars 14 forks source link

HERE Bulk geocoder: Read all responses #610

Closed Algunenano closed 3 years ago

Algunenano commented 3 years ago

Modify the HERE bulk geocoder to not only read the positive results but also the ids that weren't matched and the input errors.

Example forcing the bulk geocoder to trigger below the limit (100):

SELECT * FROM cdb_dataservices_server._cdb_bulk_geocode_street_point ('rmrodriguez'::text, NULL::text,
'[{"id": 722, "city": "Gloucester", "state": "ON", "address": "2599 Innes chemin", "country": "Canada"}, 
  {"id": 723, "city": "Marionville", "state": "ON", "address": "9575 Marionville chemin", "country": "Canada"},
  {"id": 735, "city": "Subdury",  "state": "ON", "address": "504 St-Raphael rue", "country": "Canada"},
  {"id": 100, "city": null, "state": null, "address": null, "country": null}]'::jsonb);

In this case HERE returns the address for 722, doesn't match 723 and 735 and returns an error for 100.

The old result:

 cartodb_id |                      the_geom                      |                                   metadata                                   
------------+----------------------------------------------------+------------------------------------------------------------------------------
        722 | 0101000020E61000004339D1AE42E452C0CF49EF1B5FB74640 | {"precision": "precise", "relevance": 1.0, "match_types": ["street_number"]}
(1 row)

The new result:

cartodb_id |                      the_geom                      |                                   metadata                                   
------------+----------------------------------------------------+------------------------------------------------------------------------------
        100 |                                                    | {"error": "Bulk geocoder failed"}
        722 | 0101000020E61000004339D1AE42E452C0CF49EF1B5FB74640 | {"precision": "precise", "relevance": 1.0, "match_types": ["street_number"]}
        723 |                                                    | {}
        735 |                                                    | {}
(4 rows)

References ch102254