{
  "id": 21445,
  "title": "why do some user_location_city ids   belong to multiple country and regions?",
  "url": "/competitions/expedia-hotel-recommendations/discussion/21445",
  "author_name": "",
  "post_date": "2016-06-05T17:04:15.957Z",
  "votes": null,
  "comment_count": 3,
  "views": 624,
  "content": "<p>For a quite long while, I just assumed that each city id was only corresponding with one country and region id. However, I was apparently wrong. Does anyone know how the city id was assigned?\nThanks</p>\n\n<p>as shown by the sql:</p>\n\n<p>select count(distinct user_location_country) as cnty,count(distinct user_location_region) as reg,user_location_city \nfrom train \ngroup by user_location_city \norder by cnty desc,reg desc\n limit 10;\n+------+-----+--------------------+\n| cnty | reg | user_location_city |\n+------+-----+--------------------+\n|   97 |  48 |              26750 |\n|    7 |   8 |              39443 |\n|    6 |  23 |              55763 |\n|    6 |  16 |              24848 |\n|    6 |  12 |              19334 |\n|    6 |  11 |              16992 |\n|    6 |  10 |              41447 |\n|    6 |   8 |              20307 |\n|    6 |   8 |              16637 |\n|    6 |   7 |              36062 |\n+------+-----+--------------------+</p>",
  "messages": [
    {
      "id": "122599",
      "postDate": "06/05/2016 17:04:15",
      "content": "<p>For a quite long while, I just assumed that each city id was only corresponding with one country and region id. However, I was apparently wrong. Does anyone know how the city id was assigned?\nThanks</p>\n\n<p>as shown by the sql:</p>\n\n<p>select count(distinct user_location_country) as cnty,count(distinct user_location_region) as reg,user_location_city \nfrom train \ngroup by user_location_city \norder by cnty desc,reg desc\n limit 10;\n+------+-----+--------------------+\n| cnty | reg | user_location_city |\n+------+-----+--------------------+\n|   97 |  48 |              26750 |\n|    7 |   8 |              39443 |\n|    6 |  23 |              55763 |\n|    6 |  16 |              24848 |\n|    6 |  12 |              19334 |\n|    6 |  11 |              16992 |\n|    6 |  10 |              41447 |\n|    6 |   8 |              20307 |\n|    6 |   8 |              16637 |\n|    6 |   7 |              36062 |\n+------+-----+--------------------+</p>",
      "rawMarkdown": "For a quite long while, I just assumed that each city id was only corresponding with one country and region id. However, I was apparently wrong. Does anyone know how the city id was assigned?\r\nThanks\r\n\r\nas shown by the sql:\r\n\r\nselect count(distinct user_location_country) as cnty,count(distinct user_location_region) as reg,user_location_city \r\nfrom train \r\ngroup by user_location_city \r\norder by cnty desc,reg desc\r\n limit 10;\r\n+------+-----+--------------------+\r\n| cnty | reg | user_location_city |\r\n+------+-----+--------------------+\r\n|   97 |  48 |              26750 |\r\n|    7 |   8 |              39443 |\r\n|    6 |  23 |              55763 |\r\n|    6 |  16 |              24848 |\r\n|    6 |  12 |              19334 |\r\n|    6 |  11 |              16992 |\r\n|    6 |  10 |              41447 |\r\n|    6 |   8 |              20307 |\r\n|    6 |   8 |              16637 |\r\n|    6 |   7 |              36062 |\r\n+------+-----+--------------------+",
      "votes": null
    },
    {
      "id": "122913",
      "postDate": "06/08/2016 08:58:22",
      "content": "<p>as I remember from older threads, the hashing was done using only the city name so same city name on different countries will have the same code...</p>",
      "rawMarkdown": "as I remember from older threads, the hashing was done using only the city name so same city name on different countries will have the same code...",
      "votes": null
    },
    {
      "id": "122928",
      "postDate": "06/08/2016 14:13:08",
      "content": "<p>[quote=jingzhou;122599]</p>\n\n<p>For a quite long while, I just assumed that each city id was only corresponding with one country and region id. However, I was apparently wrong. Does anyone know how the city id was assigned?\nThanks</p>\n\n<p>as shown by the sql:</p>\n\n<p>select count(distinct user_location_country) as cnty,count(distinct user_location_region) as reg,user_location_city \nfrom train \ngroup by user_location_city \norder by cnty desc,reg desc\n limit 10;\n+------+-----+--------------------+\n| cnty | reg | user_location_city |\n+------+-----+--------------------+\n|   97 |  48 |              26750 |\n|    7 |   8 |              39443 |\n|    6 |  23 |              55763 |\n|    6 |  16 |              24848 |\n|    6 |  12 |              19334 |\n|    6 |  11 |              16992 |\n|    6 |  10 |              41447 |\n|    6 |   8 |              20307 |\n|    6 |   8 |              16637 |\n|    6 |   7 |              36062 |\n+------+-----+--------------------+</p>\n\n<p>[/quote]</p>\n\n<p>User could login their account at different places and book hotel. User_location_city could be from the IP address where they login their account.</p>",
      "rawMarkdown": "[quote=jingzhou;122599]\r\n\r\nFor a quite long while, I just assumed that each city id was only corresponding with one country and region id. However, I was apparently wrong. Does anyone know how the city id was assigned?\r\nThanks\r\n\r\nas shown by the sql:\r\n\r\nselect count(distinct user_location_country) as cnty,count(distinct user_location_region) as reg,user_location_city \r\nfrom train \r\ngroup by user_location_city \r\norder by cnty desc,reg desc\r\n limit 10;\r\n+------+-----+--------------------+\r\n| cnty | reg | user_location_city |\r\n+------+-----+--------------------+\r\n|   97 |  48 |              26750 |\r\n|    7 |   8 |              39443 |\r\n|    6 |  23 |              55763 |\r\n|    6 |  16 |              24848 |\r\n|    6 |  12 |              19334 |\r\n|    6 |  11 |              16992 |\r\n|    6 |  10 |              41447 |\r\n|    6 |   8 |              20307 |\r\n|    6 |   8 |              16637 |\r\n|    6 |   7 |              36062 |\r\n+------+-----+--------------------+\r\n\r\n[/quote]\r\n\r\nUser could login their account at different places and book hotel. User_location_city could be from the IP address where they login their account.",
      "votes": null
    },
    {
      "id": "122999",
      "postDate": "06/09/2016 04:07:00",
      "content": "<p>Thank you very much Diego and Harry</p>",
      "rawMarkdown": "Thank you very much Diego and Harry",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 122913,
      "author_name": "dmenin",
      "author_url": "",
      "post_date": "06/08/2016 08:58:22",
      "content": "<p>as I remember from older threads, the hashing was done using only the city name so same city name on different countries will have the same code...</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 122928,
      "author_name": "harrybrown",
      "author_url": "",
      "post_date": "06/08/2016 14:13:08",
      "content": "<p>[quote=jingzhou;122599]</p>\n\n<p>For a quite long while, I just assumed that each city id was only corresponding with one country and region id. However, I was apparently wrong. Does anyone know how the city id was assigned?\nThanks</p>\n\n<p>as shown by the sql:</p>\n\n<p>select count(distinct user_location_country) as cnty,count(distinct user_location_region) as reg,user_location_city \nfrom train \ngroup by user_location_city \norder by cnty desc,reg desc\n limit 10;\n+------+-----+--------------------+\n| cnty | reg | user_location_city |\n+------+-----+--------------------+\n|   97 |  48 |              26750 |\n|    7 |   8 |              39443 |\n|    6 |  23 |              55763 |\n|    6 |  16 |              24848 |\n|    6 |  12 |              19334 |\n|    6 |  11 |              16992 |\n|    6 |  10 |              41447 |\n|    6 |   8 |              20307 |\n|    6 |   8 |              16637 |\n|    6 |   7 |              36062 |\n+------+-----+--------------------+</p>\n\n<p>[/quote]</p>\n\n<p>User could login their account at different places and book hotel. User_location_city could be from the IP address where they login their account.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 122999,
      "author_name": "zotsing",
      "author_url": "",
      "post_date": "06/09/2016 04:07:00",
      "content": "<p>Thank you very much Diego and Harry</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "122599": "For a quite long while, I just assumed that each city id was only corresponding with one country and region id. However, I was apparently wrong. Does anyone know how the city id was assigned?\r\nThanks\r\n\r\nas shown by the sql:\r\n\r\nselect count(distinct user_location_country) as cnty,count(distinct user_location_region) as reg,user_location_city \r\nfrom train \r\ngroup by user_location_city \r\norder by cnty desc,reg desc\r\n limit 10;\r\n+------+-----+--------------------+\r\n| cnty | reg | user_location_city |\r\n+------+-----+--------------------+\r\n|   97 |  48 |              26750 |\r\n|    7 |   8 |              39443 |\r\n|    6 |  23 |              55763 |\r\n|    6 |  16 |              24848 |\r\n|    6 |  12 |              19334 |\r\n|    6 |  11 |              16992 |\r\n|    6 |  10 |              41447 |\r\n|    6 |   8 |              20307 |\r\n|    6 |   8 |              16637 |\r\n|    6 |   7 |              36062 |\r\n+------+-----+--------------------+",
    "122913": "as I remember from older threads, the hashing was done using only the city name so same city name on different countries will have the same code...",
    "122928": "[quote=jingzhou;122599]\r\n\r\nFor a quite long while, I just assumed that each city id was only corresponding with one country and region id. However, I was apparently wrong. Does anyone know how the city id was assigned?\r\nThanks\r\n\r\nas shown by the sql:\r\n\r\nselect count(distinct user_location_country) as cnty,count(distinct user_location_region) as reg,user_location_city \r\nfrom train \r\ngroup by user_location_city \r\norder by cnty desc,reg desc\r\n limit 10;\r\n+------+-----+--------------------+\r\n| cnty | reg | user_location_city |\r\n+------+-----+--------------------+\r\n|   97 |  48 |              26750 |\r\n|    7 |   8 |              39443 |\r\n|    6 |  23 |              55763 |\r\n|    6 |  16 |              24848 |\r\n|    6 |  12 |              19334 |\r\n|    6 |  11 |              16992 |\r\n|    6 |  10 |              41447 |\r\n|    6 |   8 |              20307 |\r\n|    6 |   8 |              16637 |\r\n|    6 |   7 |              36062 |\r\n+------+-----+--------------------+\r\n\r\n[/quote]\r\n\r\nUser could login their account at different places and book hotel. User_location_city could be from the IP address where they login their account.",
    "122999": "Thank you very much Diego and Harry"
  },
  "source": "meta"
}