rolfberkenbosch / meteoalert-api

MIT License
12 stars 9 forks source link

Updates to support matching areas based on their statistical code #30

Closed ronanmu closed 5 months ago

ronanmu commented 1 year ago

Hi, I've updated the logic which matches the 'province' parameter against the results which come back from Meteoalarm. It will still attempt to match based on the province name matching (regex case insensitive as before) , but will now also test if the province param passed matches the code for the geoCode area, which should give better matches for some people who are having trouble with the areaDesc match...

e.g. For an alert like:

  <cap:geocode>
      <valueName>EMMA_ID</valueName>
      <value>UK105</value>
  </cap:geocode>
  <link href="https://meteoalarm.org?geocode=EMMA_ID:UK105" hreflang="en" title="Strathclyde"/>
  <cap:areaDesc>Strathclyde</cap:areaDesc>

now either of 'Strathclyde' or 'UK105' will be a match. From my quick checking, the code is either FIPS, NUTS2 or EMMA_ID but varies by country.

I've added in some tests to verify this, as well as some appropriate mocks and data. Should be non-breaking for users of HomeAssistant 🤞🏻

ronanmu commented 1 year ago

Hi @rolfberkenbosch, have you had an opportunity to take a look at this? Thanks :-)

netsoft-ruidias commented 5 months ago

Hi @rolfberkenbosch, this is an old issue, can you please merge this code or let us know why you won't do it?

rolfberkenbosch commented 5 months ago

Sorry, i missed this one. I just this release this one on release v0.3.1.