def display_processed_request(self, response, group):

        self.clear_map()
        action = response['action']
        result = response['result']
        print(response)

        # No data extracted
        if len(result) == 0:
            return

        title, result_array, keys = extract_multidim_results(result)

        # If dim is 1 then we know that it's just a value, so no grouping was done
        if len(keys) == 0:
            if 'geo-city' in response.keys() or 'geo-country' in response.keys():
                try:
                    location_name = response['geo-country'] if 'geo-country' in response.keys() else None
                    location_name = response['geo-city'] if 'geo-city' in response.keys() else location_name
                    location_name = location_name[0] if isinstance(location_name, list) else location_name
                    location = Map.geocode(location_name)
                    print(location)
                    self.map.marker(*location, color='red', title='%d' % result[0][0])
                except:
                    pass
                html = self.map.get_html()
                self.setHtml(html)

            else:
                # Maybe first field is a country/city
                try:
                    location_name = result[0][1]
                    location = Map.geocode(location_name)
                    self.map.marker(*location, color='red', title='%d' % result[0][0])
                except:
                    pass
                html = self.map.get_html()
                self.setHtml(html)


            return

        if 'geo-country' not in group and 'geo-city' not in group:
            return

        country = 'geo-country' in group

        if action in [DBConnector.A_comp, DBConnector.A_comp_grp_city, DBConnector.A_comp_grp_country]:

            # 1 D, Only 1D data supported
            if len(result_array.shape) == 1:
                if country:
                    self.display_grouping_country(result_array, keys[0])
                else:
                    self.display_grouping_city(result_array, keys[0], response['geo-country'])
        else:
            self.clear_map()
 def get_country(self, name):
     extended_name = ('%s country' % name).title()
     try:
         location = self.country_cache[extended_name]
     except KeyError:
         location = Map.geocode(extended_name)
         if location is not None:
             self.country_cache[extended_name] = location
             with open(self.country_cache_path, 'wb') as f:
                 pickle.dump(self.country_cache, f)
     return location