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

Incorrectly nested arrays in name_aliases #125

Open
orangejulius opened this issue Nov 28, 2019 · 2 comments
Open

Incorrectly nested arrays in name_aliases #125

orangejulius opened this issue Nov 28, 2019 · 2 comments
Labels

Comments

@orangejulius
Copy link
Member

While running a WOF import today I noticed the following error:

error: [whosonfirst] doc generator error: invalid document type, expecting: string got: Feldbach
error: [whosonfirst] {
  "id": 1394398051,
  "name": "Liebenfels",
  "name_aliases": [
    "Liebenfels",
    [
      "Feldbach"
    ],
    "Feldbach / Liebenfels"
  ],
  "name_langs": {
    "el": [
      "Φέλντμπαχ"
    ],
    "en": [
      [
        "Feldbach"
      ],
      "Feldbach / Liebenfels"
    ],
    "nl": [
      "Feldbach"
    ],
    "ro": [
      "Feldbach"
    ]
  },
  "place_type": "neighbourhood",
  "lat": 47.24069,
  "lon": 8.78906,
  "bounding_box": "8.78906,47.24069,8.78906,47.24069",
  "population": 7,
  "hierarchies": [
    {
      "continent_id": 102191581,
      "country_id": 85633051,
      "county_id": 1394212863,
      "localadmin_id": 1394253973,
      "locality_id": 1125908497,
      "neighbourhood_id": 1394398051,
      "region_id": 85682309
    }
  ]
}

It looks like, for whatever reason, a nested array is being created in the name_aliases field:

  "name_aliases": [
    "Liebenfels",
    [
      "Feldbach"
    ],
    "Feldbach / Liebenfels"
  ],

It's unclear if the underlying error is made in the WOF importer, or here in pelias/model. Looks like we should add a .flatten to any arrays before we send them off.

@missinglink
Copy link
Member

missinglink commented Nov 28, 2019

It's likely caused by the WOF data as we've seen this a few, times, before.

But yes, the pelias/model should reject these names as the expected type is a scalar string.

@missinglink
Copy link
Member

The code should already be doing this although that clearly isn't working...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants