From eca6705b299c5afe2e8ed995529f7afc5559ae0b Mon Sep 17 00:00:00 2001 From: Nemael <100dragons@gmail.com> Date: Sat, 24 Oct 2020 11:14:07 +0200 Subject: Added sanitization of data, puts instead of null or / data. Also strips trailing whitespaces. It only sanitizes phone_number, website and email because they these data are following a format. Name, address, etc... are not sanitized --- doc/import/LocationsParser.rb | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'doc/import') diff --git a/doc/import/LocationsParser.rb b/doc/import/LocationsParser.rb index 3ce79c0..ccb165a 100644 --- a/doc/import/LocationsParser.rb +++ b/doc/import/LocationsParser.rb @@ -10,6 +10,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 +39,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 +67,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"] -- cgit v1.2.3 From bc486c6818949309ba90e9c7cb5d0a3fbd39b43a Mon Sep 17 00:00:00 2001 From: hellekin Date: Thu, 29 Oct 2020 22:50:49 +0100 Subject: REUSE: Add AGPL-3.0-or-later on remaining IN COMMON code --- config/initializers/inflections.rb | 4 ++++ config/initializers/sso_config.rb | 4 ++++ doc/import/LocationsParser.rb | 4 ++++ doc/import/parser.rb | 4 ++++ 4 files changed, 16 insertions(+) (limited to 'doc/import') diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 13e8739..0e49cd1 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2020 IN COMMON Collective +# +# SPDX-License-Identifier: AGPL-3.0-or-later + # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/config/initializers/sso_config.rb b/config/initializers/sso_config.rb index d88b595..cf3bf3f 100644 --- a/config/initializers/sso_config.rb +++ b/config/initializers/sso_config.rb @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2018-2020 IN COMMON Collective +# +# SPDX-License-Identifier: AGPL-3.0-or-later + # frozen_string_literal: true # See lib/sso/from_discourse.rb diff --git a/doc/import/LocationsParser.rb b/doc/import/LocationsParser.rb index ccb165a..9a8eba5 100644 --- a/doc/import/LocationsParser.rb +++ b/doc/import/LocationsParser.rb @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2020 IN COMMON Collective +# +# 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 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 Date: Thu, 29 Oct 2020 22:51:57 +0100 Subject: REUSE: Add CC-BY-SA-4.0 to documentation --- README.md | 6 ++++++ doc/import/Concertes/How to read files.txt | 4 ++++ doc/import/README.md | 6 ++++++ 3 files changed, 16 insertions(+) (limited to 'doc/import') diff --git a/README.md b/README.md index 7db80e4..7be6649 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +--- +SPDX-License-Identifier: CC-BY-SA-4.0 +SPDX-FileCopyrightText: 2020 IN COMMON Collective +--- + + # README This README would normally document whatever steps are necessary to get the 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 + +SPDX-License-Identifier: CC-BY-SA-4.0 +--> + ## Parsing Resources The script `parser.rb` creates a file named `Locations.geojson`, which contains -- cgit v1.2.3 From ca0ef5c8cc684b3316e05cd3dcd094e0500ef470 Mon Sep 17 00:00:00 2001 From: hellekin Date: Thu, 29 Oct 2020 23:09:46 +0100 Subject: Add original list of Dewey Maps categories --- doc/import/dewey-maps-categories-en.json | 526 +++++++++++++++++++++++++++++++ 1 file changed, 526 insertions(+) create mode 100644 doc/import/dewey-maps-categories-en.json (limited to 'doc/import') 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" + } +] -- cgit v1.2.3