diff options
author | hellekin <hellekin@cepheide.org> | 2020-11-12 01:10:28 +0100 |
---|---|---|
committer | hellekin <hellekin@cepheide.org> | 2020-11-12 01:10:28 +0100 |
commit | 8d9387cf64929b6467b6ba52f22ca0aa5ed35782 (patch) | |
tree | 37533e75476680ebad4cd1d47e3e578b879726ba /doc | |
parent | b6aeac4d9274f17e748efb3715aa08f4b7c361f2 (diff) | |
parent | 757decefafb5d82557a8b7fa9691f94f19c3207e (diff) | |
download | incommon-map-8d9387cf64929b6467b6ba52f22ca0aa5ed35782.tar.gz |
Merged master
Diffstat (limited to 'doc')
-rw-r--r-- | doc/import/Concertes/How to read files.txt | 4 | ||||
-rw-r--r-- | doc/import/LocationsParser.rb | 28 | ||||
-rw-r--r-- | doc/import/README.md | 6 | ||||
-rw-r--r-- | doc/import/dewey-maps-categories-en.json | 526 | ||||
-rw-r--r-- | doc/import/parser.rb | 4 |
5 files changed, 562 insertions, 6 deletions
diff --git a/doc/import/Concertes/How to read files.txt b/doc/import/Concertes/How to read files.txt index 2c427cc..1c7dd3c 100644 --- a/doc/import/Concertes/How to read files.txt +++ b/doc/import/Concertes/How to read files.txt @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2020 IN COMMON Collective <collective@incommon.cc +# +# SPDX-License-Identifier: CC-BY-SA-4.0 + Nom Se trouve dans le fichier EntreprisesSignaletique.csv Description diff --git a/doc/import/LocationsParser.rb b/doc/import/LocationsParser.rb index 3ce79c0..9a8eba5 100644 --- a/doc/import/LocationsParser.rb +++ b/doc/import/LocationsParser.rb @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2020 IN COMMON Collective <collective@incommon.cc> +# +# SPDX-License-Identifier: AGPL-3.0-or-later + #This file parses the data from the "Concertes" and "Dewey" folders #It creates a file "Locations.geojson" which is in the geoJson format to be used with a map @@ -10,6 +14,18 @@ class Parser @list_of_locations["type"] = "FeatureCollection" @list_of_locations["features"] = [] end + def sanitize(data) + #Sanitize data. Puts "" instead of null in empty data, and puts "" instead of "/" + if (data == nil) + data = "" + end + data = data.strip + res = data + if (data == "/") + res = "" + end + return res + end def parseDeweyFiles(data_file) #Parses the .json files contained in the Dewey folder data = JSON.parse(File.read(data_file)) @@ -27,9 +43,9 @@ class Parser new_item["properties"]["name"] = data[i]["fields"]["name"] new_item["properties"]["description"] = data[i]["fields"]["comment"] new_item["properties"]["entry_number"] = data[i]["pk"] - new_item["properties"]["phone_number"] = data[i]["fields"]["phone"] - new_item["properties"]["website"] = data[i]["fields"]["web"] - new_item["properties"]["email"] = data[i]["fields"]["email"] + new_item["properties"]["phone_number"] = sanitize(data[i]["fields"]["phone"]) + new_item["properties"]["website"] = sanitize(data[i]["fields"]["web"]) + new_item["properties"]["email"] = sanitize(data[i]["fields"]["email"]) new_item["properties"]["address"] = data[i]["fields"]["address"] new_item["properties"]["city"] = "" #No equivalent in Dewey data new_item["properties"]["postal_code"] = "" #No equivalent in Dewey data @@ -55,9 +71,9 @@ class Parser new_item["properties"]["name"] = data[i]["Denomination_FULL"] new_item["properties"]["description"] = data[i]["description"] new_item["properties"]["entry_number"] = data[i]["NumEntr"] - new_item["properties"]["phone_number"] = coord[i]["Tel"] - new_item["properties"]["website"] = coord[i]["Web"] - new_item["properties"]["email"] = coord[i]["Email"] + new_item["properties"]["phone_number"] = sanitize(coord[i]["Tel"]) + new_item["properties"]["website"] = sanitize(coord[i]["Web"]) + new_item["properties"]["email"] = sanitize(coord[i]["Email"]) new_item["properties"]["address"] = coord[i]["Adresse"] new_item["properties"]["city"] = data[i]["INS_COMMUNE"] new_item["properties"]["postal_code"] = coord[i]["Code postal"] diff --git a/doc/import/README.md b/doc/import/README.md index f5c4096..92108a3 100644 --- a/doc/import/README.md +++ b/doc/import/README.md @@ -1,3 +1,9 @@ +<!-- +SPDX-FileCopyrightText: 2020 IN COMMON Collective <collective@incommon.cc> + +SPDX-License-Identifier: CC-BY-SA-4.0 +--> + ## Parsing Resources The script `parser.rb` creates a file named `Locations.geojson`, which contains diff --git a/doc/import/dewey-maps-categories-en.json b/doc/import/dewey-maps-categories-en.json new file mode 100644 index 0000000..96a8441 --- /dev/null +++ b/doc/import/dewey-maps-categories-en.json @@ -0,0 +1,526 @@ +[ + { + "id": 8, + "name": "Housing and Dwelling", + "subcategories": [ + { + "id": 148, + "name": "Campings" + }, + { + "id": 158, + "name": "Care home" + }, + { + "id": 130, + "name": "Community land trust" + }, + { + "id": 198, + "name": "Community living (for the homeless)" + }, + { + "id": 150, + "name": "Homeless shelters (by night)" + }, + { + "id": 149, + "name": "Hostels" + }, + { + "id": 165, + "name": "Housing cooperatives" + }, + { + "id": 131, + "name": "Legalized squat" + }, + { + "id": 168, + "name": "Participatory housing, cohousing" + }, + { + "id": 164, + "name": "Renters cooperatives" + }, + { + "id": 114, + "name": "Right to housing" + } + ], + "color": "BCBCBC" + }, + { + "id": 6, + "name": "Drinking and Eating", + "subcategories": [ + { + "id": 155, + "name": "Aromatic plants" + }, + { + "id": 27, + "name": "Community-Supported Agriculture (groups)" + }, + { + "id": 185, + "name": "Community-Supported Agriculture (producers)" + }, + { + "id": 180, + "name": "Cooking Classes" + }, + { + "id": 115, + "name": "Drinkable water" + }, + { + "id": 182, + "name": "Food advise" + }, + { + "id": 154, + "name": "Free lunches" + }, + { + "id": 170, + "name": "Market" + }, + { + "id": 28, + "name": "Recuperation of food products" + }, + { + "id": 123, + "name": "Small Breweries" + }, + { + "id": 135, + "name": "Social Grocery Stores" + }, + { + "id": 118, + "name": "Social Restaurants" + } + ], + "color": "95A5A6" + }, + { + "id": 11, + "name": "Getting Clean and Clothed", + "subcategories": [ + { + "id": 46, + "name": "Give-away shops" + }, + { + "id": 210, + "name": "Give Boxes" + }, + { + "id": 144, + "name": "Public showers" + }, + { + "id": 207, + "name": "Public toilets" + }, + { + "id": 104, + "name": "Second-hand clothes" + }, + { + "id": 156, + "name": "Social Clothing Store" + } + ], + "color": "848482" + }, + { + "id": 12, + "name": "Lighting Up and Warming Up", + "subcategories": [ + { + "id": 122, + "name": "Energy advisors" + }, + { + "id": 195, + "name": "Homeless booths" + }, + { + "id": 176, + "name": "Solar techniques" + }, + { + "id": 134, + "name": "Support for renovation" + } + ], + "color": "948279" + }, + { + "id": 10, + "name": "Healing and Caring", + "subcategories": [ + { + "id": 18, + "name": "Community health center" + }, + { + "id": 192, + "name": "Control of addictions" + }, + { + "id": 199, + "name": "Defibrillators (free access)" + }, + { + "id": 145, + "name": "Health networks" + }, + { + "id": 157, + "name": "Health services for the homeless" + }, + { + "id": 190, + "name": "Mental health associations" + }, + { + "id": 143, + "name": "Palliative care associations" + }, + { + "id": 208, + "name": "Public hospitals" + }, + { + "id": 191, + "name": "Therapeutic communities" + } + ], + "color": "59706a" + }, + { + "id": 1, + "name": "Recycling and Repairing", + "subcategories": [ + { + "id": 50, + "name": "Book boxes" + }, + { + "id": 132, + "name": "Community composting" + }, + { + "id": 120, + "name": "Flea market" + }, + { + "id": 205, + "name": "Glass recycling" + }, + { + "id": 42, + "name": "Repair cafés" + }, + { + "id": 113, + "name": "Reused building materials" + }, + { + "id": 47, + "name": "Reused computer material" + }, + { + "id": 136, + "name": "Reusing inkcartridges" + }, + { + "id": 206, + "name": "Used clothes bins" + }, + { + "id": 138, + "name": "Woodworking workshops" + } + ], + "color": "16A085" + }, + { + "id": 7, + "name": "Breathing and Going Green", + "subcategories": [ + { + "id": 127, + "name": "Beekeeping associations" + }, + { + "id": 121, + "name": "Community composting" + }, + { + "id": 194, + "name": "Naturalist association" + }, + { + "id": 133, + "name": "Natural reserves" + }, + { + "id": 129, + "name": "Public parcs" + }, + { + "id": 125, + "name": "Seed exchange" + }, + { + "id": 128, + "name": "Support for gardeners" + }, + { + "id": 116, + "name": "Vegetable gardens" + } + ], + "color": "27AE60" + }, + { + "id": 3, + "name": "Meeting and Helping Each Other", + "subcategories": [ + { + "id": 202, + "name": "Associations for gender equality" + }, + { + "id": 204, + "name": "Community centers NL" + }, + { + "id": 211, + "name": "Complementary currency" + }, + { + "id": 209, + "name": "International cooperation and solidarity" + }, + { + "id": 184, + "name": "Local exchange trading system" + }, + { + "id": 102, + "name": "Neighborhood Committees" + }, + { + "id": 10, + "name": "Neighborhood houses" + }, + { + "id": 197, + "name": "Recent immigrants welcoming" + }, + { + "id": 188, + "name": "Refugees welcome" + }, + { + "id": 119, + "name": "School Support Associations" + }, + { + "id": 14, + "name": "Support for family and children" + }, + { + "id": 16, + "name": "Support for people with disabilities" + }, + { + "id": 19, + "name": "Support for seniors" + }, + { + "id": 193, + "name": "Support for the homeless" + }, + { + "id": 201, + "name": "Transition initiatives" + }, + { + "id": 15, + "name": "Women's association" + }, + { + "id": 17, + "name": "Youth House" + } + ], + "color": "2980B9" + }, + { + "id": 2, + "name": "Learning and Training", + "subcategories": [ + { + "id": 187, + "name": "Adapted work companies" + }, + { + "id": 13, + "name": "Adult and continuing education" + }, + { + "id": 87, + "name": "Coworking, shared offices" + }, + { + "id": 91, + "name": "Defense of cultural heritage" + }, + { + "id": 92, + "name": "Public libraries" + }, + { + "id": 12, + "name": "Support fo local economy" + }, + { + "id": 103, + "name": "Training centres" + }, + { + "id": 90, + "name": "Urban ecology associations" + } + ], + "color": "34495E" + }, + { + "id": 13, + "name": "Expressing Yourself and Communicating", + "subcategories": [ + { + "id": 124, + "name": "Free Internet access" + }, + { + "id": 174, + "name": "Free Software Associations" + }, + { + "id": 43, + "name": "Hackerspaces" + }, + { + "id": 109, + "name": "Independent media" + }, + { + "id": 177, + "name": "Scrivener" + } + ], + "color": "BD3525" + }, + { + "id": 9, + "name": "Transportation and Hauling", + "subcategories": [ + { + "id": 212, + "name": "Bicycle pumps" + }, + { + "id": 140, + "name": "Bike deliveries" + }, + { + "id": 179, + "name": "Bike lessons" + }, + { + "id": 147, + "name": "Bikessharing" + }, + { + "id": 71, + "name": "Bike workshops" + }, + { + "id": 141, + "name": "Carsharing" + }, + { + "id": 196, + "name": "Taxisharing" + } + ], + "color": "D35400" + }, + { + "id": 4, + "name": "Going Out and Hobbies", + "subcategories": [ + { + "id": 171, + "name": "'Art Deco’ walks" + }, + { + "id": 173, + "name": "'Art Nouvau’ walks" + }, + { + "id": 200, + "name": "'Comic strips’ walks" + }, + { + "id": 110, + "name": "Concert places" + }, + { + "id": 117, + "name": "Dance schools" + }, + { + "id": 186, + "name": "Holiday for all" + }, + { + "id": 139, + "name": "Independant cinemas" + }, + { + "id": 100, + "name": "Literary walks" + }, + { + "id": 111, + "name": "Museums and exhibitions" + }, + { + "id": 203, + "name": "Music classes for all" + }, + { + "id": 96, + "name": "Sport clubs and infrastructures" + }, + { + "id": 183, + "name": "'Street Art’ walks" + }, + { + "id": 98, + "name": "Theatres" + } + ], + "color": "EEAD0E" + } +] diff --git a/doc/import/parser.rb b/doc/import/parser.rb index 06566d7..25c7313 100644 --- a/doc/import/parser.rb +++ b/doc/import/parser.rb @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2020 IN COMMON Collective <collective@incommon.cc +# +# SPDX-License-Identifier: AGPL-3.0-or-later + require 'json' require 'csv' require 'set' |