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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match countries against iso-codes JSON directly #136

Closed
alanorth opened this issue Feb 27, 2023 · 3 comments
Closed

Match countries against iso-codes JSON directly #136

alanorth opened this issue Feb 27, 2023 · 3 comments
Labels
backend Related to backend application improvement P-medium Medium priority

Comments

@alanorth
Copy link
Member

alanorth commented Feb 27, 2023

We should be using the iso_3166-1.json data directly from the iso-codes project, as this is the most up-to-date data and doesn't rely on using outdated packages from npmjs.com. For example, we are currently using iso-3166-1 from npmjs.com, which is missing several country names from the past few years:

  • Eswatini
  • North Macedonia
  • Türkiye

This data also contains common names for countries so matches more widely than the vanilla ISO.org data. For example:

  • common_name: Bolivia
  • name: Bolivia, Plurinational State of
  • official_name: Plurinational State of Bolivia

We can use this when matching country name text values with Alpha2 / Alpha3 codes (also provided by the iso-codes data).

@alanorth alanorth added P-medium Medium priority improvement labels Feb 27, 2023
@alanorth alanorth added the backend Related to backend application label Jul 21, 2023
@alanorth
Copy link
Member Author

Great, this is working as of #185.

@mohammadsalem I notice that we still don't match based on common names, for example see Tanzania in AReS from WorldFish. I could add a value mapping, but I know you added common names to your iso_3166-1 library so it should be simple. Thanks.

mohammadsalem added a commit that referenced this issue Nov 20, 2023
mohammadsalem added a commit that referenced this issue Nov 20, 2023
@alanorth
Copy link
Member Author

As of #185 we are now using @mohammadsalem's iso_3166-1 NPM library that tracks Debian's iso-codes releases and matches against alpha 2, alpha 3, and other possible names.

@alanorth
Copy link
Member Author

Leaving a comment here, as I'm getting an error due to the postinstall script of the @mohammad231/iso_3166-1 package:

npm ERR! code 1
npm ERR! path /home/aorth/src/git/OpenRXV/backend/node_modules/@mohammad231/iso_3166-1
npm ERR! command failed
npm ERR! command sh -c node download_iso_3166-1.js
npm ERR! node:events:492
npm ERR!       throw er; // Unhandled 'error' event
npm ERR!       ^
npm ERR!
npm ERR! AggregateError
npm ERR!     at internalConnectMultiple (node:net:1114:18)
npm ERR!     at internalConnectMultiple (node:net:1177:5)
npm ERR!     at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
npm ERR!     at listOnTimeout (node:internal/timers:575:11)
npm ERR!     at process.processTimers (node:internal/timers:514:7)
npm ERR! Emitted 'error' event on ClientRequest instance at:
npm ERR!     at TLSSocket.socketErrorListener (node:_http_client:495:9)
npm ERR!     at TLSSocket.emit (node:events:514:28)
npm ERR!     at emitErrorNT (node:internal/streams/destroy:151:8)
npm ERR!     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
npm ERR!   code: 'ETIMEDOUT',
npm ERR!   [errors]: [
npm ERR!     Error: connect ETIMEDOUT 209.87.16.44:443
npm ERR!         at createConnectionError (node:net:1634:14)
npm ERR!         at Timeout.internalConnectMultipleTimeout (node:net:1685:38)
npm ERR!         at listOnTimeout (node:internal/timers:575:11)
npm ERR!         at process.processTimers (node:internal/timers:514:7) {
npm ERR!       errno: -110,
npm ERR!       code: 'ETIMEDOUT',
npm ERR!       syscall: 'connect',
npm ERR!       address: '209.87.16.44',
npm ERR!       port: 443
npm ERR!     },
npm ERR!     Error: connect ENETUNREACH 2607:f8f0:614:1::1274:44:443 - Local (:::0)
npm ERR!         at internalConnectMultiple (node:net:1176:40)
npm ERR!         at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
npm ERR!         at listOnTimeout (node:internal/timers:575:11)
npm ERR!         at process.processTimers (node:internal/timers:514:7) {
npm ERR!       errno: -101,
npm ERR!       code: 'ENETUNREACH',
npm ERR!       syscall: 'connect',
npm ERR!       address: '2607:f8f0:614:1::1274:44',
npm ERR!       port: 443
npm ERR!     }
npm ERR!   ]
npm ERR! }
npm ERR!
npm ERR! Node.js v20.9.0

In my case the temporary solution was to disable IPv6 on my host:

# echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6
# echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend application improvement P-medium Medium priority
Projects
None yet
Development

No branches or pull requests

1 participant