diff --git a/playground/jon/load-world-for-typeahead/load_world.bpmn b/playground/jon/load-world-for-typeahead/load_world.bpmn new file mode 100644 index 00000000..212a5051 --- /dev/null +++ b/playground/jon/load-world-for-typeahead/load_world.bpmn @@ -0,0 +1,200 @@ + + + + + + Flow_0tn4ed3 + + + + Flow_0lz96a1 + + + + + + + { +"typeahead": {}, + "cities_result": [ + { + "id": 52, + "name": "Ashkāsham", + "state_id": 3901, + "state_code": "BDS", + "state_name": "Badakhshan", + "country_id": 1, + "country_code": "AF", + "country_name": "Afghanistan", + "latitude": "36.68333000", + "longitude": "71.53333000", + "wikiDataId": "Q4805192" + }, + { + "id": 68, + "name": "Fayzabad", + "state_id": 3901, + "state_code": "BDS", + "state_name": "Badakhshan", + "country_id": 1, + "country_code": "AF", + "country_name": "Afghanistan", + "latitude": "37.11664000", + "longitude": "70.58002000", + "wikiDataId": "Q156558" + }, + { + "id": 78, + "name": "Jurm", + "state_id": 3901, + "state_code": "BDS", + "state_name": "Badakhshan", + "country_id": 1, + "country_code": "AF", + "country_name": "Afghanistan", + "latitude": "36.86477000", + "longitude": "70.83421000", + "wikiDataId": "Q10308323" + } + ] +} + { + "typeahead": { + "cities": [ + { + "search_term": "Ashkāsham", + "result": { + "name": "Ashkāsham", + "country": "Afghanistan", + "state": "Badakhshan" + } + }, + { + "search_term": "Fayzabad", + "result": { + "name": "Fayzabad", + "country": "Afghanistan", + "state": "Badakhshan" + } + }, + { + "search_term": "Jurm", + "result": { + "name": "Jurm", + "country": "Afghanistan", + "state": "Badakhshan" + } + } + ], + "countries": [ + { + "result": { + "name": "Afghanistan" + }, + "search_term": "Afghanistan" + } + ], + "states": [ + { + "result": { + "country": "Afghanistan", + "name": "Badakhshan" + }, + "search_term": "Badakhshan" + } + ] + } +} + + + + Flow_0w7oyed + Flow_0lz96a1 + + DataStoreReference_1oronwq + + def parse_cities_result(): + cities = [] + countries = [] + states = [] + states_by_country = {} + + for result in cities_result: + name = result["name"] + state = result["state_name"] + country = result["country_name"] + cities.append({"search_term": name, "result": {"name": name, "state": state, "country": country}}) + if country not in states_by_country: + states_by_country[country] = set() + states_by_country[country].add(state) + + for country in states_by_country.keys(): + countries.append({"search_term": country, "result":{"name": country}}) + for state in states_by_country[country]: + states.append({"search_term": state, "result": {"name": state, "country": country}}) + + return { "cities": cities, "countries": countries, "states": states } + +typeahead = parse_cities_result() + +del(cities_result) + + + + + + + + + + + + + + + Flow_0tn4ed3 + Flow_0w7oyed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/playground/jon/load-world-for-typeahead/process_model.json b/playground/jon/load-world-for-typeahead/process_model.json index 272c33c6..0fb53060 100644 --- a/playground/jon/load-world-for-typeahead/process_model.json +++ b/playground/jon/load-world-for-typeahead/process_model.json @@ -4,6 +4,6 @@ "exception_notification_addresses": [], "fault_or_suspend_on_exception": "fault", "metadata_extraction_paths": null, - "primary_file_name": null, - "primary_process_id": null + "primary_file_name": "load_world.bpmn", + "primary_process_id": "load_world" } \ No newline at end of file