From 7f1b84ae412024622f3a2cfad9e25420dd6d0a7a Mon Sep 17 00:00:00 2001 From: sartography-automated-committer Date: Thu, 13 Jul 2023 21:16:19 +0000 Subject: [PATCH] User: daniel.h.funk@gmail.com added process model file playground/dan/dans-first-progress-model/cereals_data_store.bpmn --- .../cereals_data_store.bpmn | 201 ++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 playground/dan/dans-first-progress-model/cereals_data_store.bpmn diff --git a/playground/dan/dans-first-progress-model/cereals_data_store.bpmn b/playground/dan/dans-first-progress-model/cereals_data_store.bpmn new file mode 100644 index 00000000..4f75cdef --- /dev/null +++ b/playground/dan/dans-first-progress-model/cereals_data_store.bpmn @@ -0,0 +1,201 @@ + + + + + + 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) + + + + + + + + + + + + + + Fetching data from Countries-States-Cities DB (GitHub) + + Flow_0tn4ed3 + Flow_0w7oyed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +