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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HERE API autocomplete #11507

Merged

Conversation

sinaeftekhar
Copy link
Contributor

Current version of api being used by decidim(6.2) is going to be deprecated soon(December 31st, 2023 according to their website). Already new api keys wont be supported for the older versions.

馃搶 Related Issues

Link your PR to an issue

鈾ワ笍 Thank you!

@alecslupu
Copy link
Contributor

@sinaeftekhar Can you take care of the failing specs?

@andreslucena andreslucena changed the title Update here api autocomplete Update HERE API autocomplete Sep 7, 2023
Copy link
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

Note that we also need to change the format here:

["street", "houseNumber"],
"district",
"city",
"county",
"state",
"country"
];

Some of the keys in the format have changed (review them):
https://developer.here.com/documentation/geocoding-search-api/api-reference-swagger.html

Address fields beginning

@andreslucena
Copy link
Member

@sinaeftekhar whenever you have the time, can you check this out? As its an API deprecation, we want to add this to v0.28 and (probably) also backport this so its available to older versions.

Don't hesitate in letting us know if you don't have the time as we can retake this with the Decidim Association resources. Thanks!

@sinaeftekhar sinaeftekhar marked this pull request as draft October 11, 2023 12:59
@sinaeftekhar
Copy link
Contributor Author

Dear @andreslucena
Sorry for the delay.
I've fixed the failing tests(the current failing test looks like a flaky/irrelevant to this PR).

@sinaeftekhar sinaeftekhar marked this pull request as ready for review October 13, 2023 07:05
@alecslupu
Copy link
Contributor

alecslupu commented Oct 15, 2023

I have created a new application in platform.here.com, and tried the API key in a Decidim / develop branch. Using that application, I got an error while using the key.

Switching to this branch, using the same config I could load the map and I was able to partially geolocate my address from admin.

There is a problem with the geolocation part, and that is the Address dropdown is not always being shown, especially when searching with missing diacritics. (extracted to #11760)

When searching for Strada 脦nving , the request and dropdown works as expected :

API Request is :

GET | https://autocomplete.search.hereapi.com/v1/autocomplete?apiKey=MY_API_KEY&q=Strada 脦nving&lang=en
returned:

Api response ``` { "items":[ { "title":"Romania, Bucharest, Strada 脦nving膬torilor", "id":"here:af:street:AyzaPMHKHgM.Sj9jm-wB7C", "language":"en", "resultType":"street", "address":{ "label":"Strada 脦nving膬torilor, Bucharest, Romania", "countryCode":"ROU", "countryName":"Romania", "county":"Bucharest", "city":"Bucharest", "district":"Sectorul 3", "street":"Strada 脦nving膬torilor" }, "highlights":{ "title":[ { "start":20, "end":33 } ], "address":{ "label":[ { "start":0, "end":13 } ], "street":[ { "start":0, "end":13 } ] } } }, { "title":"Romania, Bragadiru, Strada 脦nving膬torilor", "id":"here:af:street:FdoEZ.A-bTJ8QWsaXOuZSC", "language":"en", "resultType":"street", "address":{ "label":"Strada 脦nving膬torilor, 077025 Bragadiru, Romania", "countryCode":"ROU", "countryName":"Romania", "county":"Ilfov", "city":"Bragadiru", "district":"Bragadiru", "street":"Strada 脦nving膬torilor", "postalCode":"077025" }, "highlights":{ "title":[ { "start":20, "end":33 } ], "address":{ "label":[ { "start":0, "end":13 } ], "street":[ { "start":0, "end":13 } ] } } }, { "title":"Romania, Glina, Strada 脦nving膬torilor", "id":"here:af:street:ACyLZwPy4O-h6CixNY8.LA", "language":"en", "resultType":"street", "address":{ "label":"Strada 脦nving膬torilor, 077105 Glina, Romania", "countryCode":"ROU", "countryName":"Romania", "county":"Ilfov", "city":"Glina", "street":"Strada 脦nving膬torilor", "postalCode":"077105" }, "highlights":{ "title":[ { "start":16, "end":29 } ], "address":{ "label":[ { "start":0, "end":13 } ], "street":[ { "start":0, "end":13 } ] } } } ] } ```

image

This does not work:
I am searching for Strada Inving ( mind the Capital i )

GET | https://autocomplete.search.hereapi.com/v1/autocomplete?apiKey=MY_API_KEY&q=Strada Inving&lang=en

Api response ``` { "items":[ { "title":"Romania, Bucharest, Strada 脦nving膬torilor", "id":"here:af:street:AyzaPMHKHgM.Sj9jm-wB7C", "language":"en", "resultType":"street", "address":{ "label":"Strada 脦nving膬torilor, Bucharest, Romania", "countryCode":"ROU", "countryName":"Romania", "county":"Bucharest", "city":"Bucharest", "district":"Sectorul 3", "street":"Strada 脦nving膬torilor" }, "highlights":{ "title":[ { "start":20, "end":33 } ], "address":{ "label":[ { "start":0, "end":13 } ], "street":[ { "start":0, "end":13 } ] } } }, { "title":"Romania, Bragadiru, Strada 脦nving膬torilor", "id":"here:af:street:FdoEZ.A-bTJ8QWsaXOuZSC", "language":"en", "resultType":"street", "address":{ "label":"Strada 脦nving膬torilor, 077025 Bragadiru, Romania", "countryCode":"ROU", "countryName":"Romania", "county":"Ilfov", "city":"Bragadiru", "district":"Bragadiru", "street":"Strada 脦nving膬torilor", "postalCode":"077025" }, "highlights":{ "title":[ { "start":20, "end":33 } ], "address":{ "label":[ { "start":0, "end":13 } ], "street":[ { "start":0, "end":13 } ] } } }, { "title":"Romania, Glina, Strada 脦nving膬torilor", "id":"here:af:street:ACyLZwPy4O-h6CixNY8.LA", "language":"en", "resultType":"street", "address":{ "label":"Strada 脦nving膬torilor, 077105 Glina, Romania", "countryCode":"ROU", "countryName":"Romania", "county":"Ilfov", "city":"Glina", "street":"Strada 脦nving膬torilor", "postalCode":"077105" }, "highlights":{ "title":[ { "start":16, "end":29 } ], "address":{ "label":[ { "start":0, "end":13 } ], "street":[ { "start":0, "end":13 } ] } } } ] } ```

image

Some other addresses that do not work if there is no :

  • Pia葲a Alba Iulia / Piata Alba Iulia
  • Splaiul Independen葲ei, Bucharest, Bucharest / Splaiul Independentei, Bucharest, Bucharest
  • Sebe葯, Alba / Sebes, Alba
  • Stenb盲ckinkatu 24, Taka-T枚枚l枚, Helsinki, Uusimaa, South Finland ( searched as Stenbackinkatu 24)
  • Veneentekij盲ntie 4, Lauttasaari, Helsinki, Uusimaa, South Finland ( searched as Veneentekijantie 4)

Copy link
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

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

LGTM.
the other issue i was commented about was fixed in a separate PR.

@andreslucena andreslucena added module: core type: fix PRs that implement a fix for a bug labels Oct 16, 2023
Copy link
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

I've checked it out locally and it works. I labeled as type: fix so we can backport it.

@andreslucena andreslucena merged commit 255f4c2 into decidim:develop Oct 16, 2023
90 checks passed
@ahukkanen ahukkanen deleted the fix/update_here_api_autocomplete_to_v1 branch October 16, 2023 06:18
@ahukkanen
Copy link
Contributor

The label fix (mentioned above) wasn't done in this so it means the country name won't show up in the results.

andreslucena pushed a commit that referenced this pull request Oct 16, 2023
* Update here api autocomplete

* Fix linting errors and a failing tests
entantoencuanto added a commit that referenced this pull request Oct 17, 2023
* develop: (30 commits)
  Add `process-content` to erb-lint's deprecated classes (#11762)
  Add possibility of overriding the tailwind.config.js (#11763)
  Ask old password when changing email or password (#11737)
  Add Projects (Budgets) to filtered search (#11740)
  Fix missing results on Geocoded when search without diacritics (#11761)
  Add robots.txt instructions (#11693)
  Add missing activerecord budget locales for search (#11766)
  Improve design of Admin's Sidebar pages (#11759)
  Show small static map on admin's meetings index with big screens  (#11715)
  Remove "Manage" button when there's a Sidebar (#11717)
  Fix admin breadcrumb in Process (#11757)
  Apply new rubocop rules on erb - Layout/MultilineMethodCallIndentation (#11756)
  Remove xlarge-* references from admin forms (#11712)
  Apply new rubocop rules on erb - Argument identation (#11707)
  Update HERE API autocomplete (#11507)
  Admin redesign proposal issues (#11668)
  Redesign: responsive links on cards (#11538)
  Refactor CI pipelines (#11196)
  Update postcss and graphql to latest versions (#11733)
  Fix develop pipeline (#11750)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: core type: fix PRs that implement a fix for a bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

here.com API deprecated, new API keys do not work with 6.2 Problem when adding new meeting
4 participants