up variance

This commit is contained in:
Tykayn 2023-08-31 22:07:57 +02:00 committed by tykayn
parent ef2fdc7ff2
commit e117c1e58d
6 changed files with 17469 additions and 15399 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
;variance de ./etalab_data/toilettes/small.csv;généré le:;Fri Aug 18 2023 13:39:11 GMT+0200 (heure dété dEurope centrale);lignes du csv original:;10;fait avec make_variance_from_csv.ts de Tykayn
;TYPE;STATUT;ADRESSE;ARRONDISSEMENT;HORAIRE;ACCES_PMR;RELAIS_BEBE;URL_FICHE_EQUIPEMENT;geo_shape_1;geo_shape_2;geo_point_2d_1;geo_point_2d_2
;3;1;9;7;4;2;3;7;9;9;9;9
;SANISETTE;;63 AVENUE DU GENERAL LECLERC;75003;24 h / 24;Oui;;;2.3164276371957278;48.82101412751667;48.82101412751667;2.3164276371957278
;TOILETTES;;JARDIN HENRI SAUVAGE;75007;Voir fiche équipement;Non;Non;https://www.paris.fr/equipements/jardin-henri-sauvage-ex-square-amiraux-boinod-2702;2.3195679829481666;48.82896483276907;48.82896483276907;2.3195679829481666
;WC PUBLICS PERMANENTS;;SQUARE DU TEMPLE;75012;;;Oui;https://www.paris.fr/equipements/square-du-temple-elie-wiesel-2425;2.320485389226217;48.836321683521824;48.836321683521824;2.320485389226217
;;;JARDIN DU MOULIN DE LA POINTE;75013;6 h - 22 h;;;https://www.paris.fr/equipements/jardin-du-monument-aux-meres-francaises-2564;2.3279795895584483;48.838257002553206;48.838257002553206;2.3279795895584483
;;;BOIS DE VINCENNES - PARC FLORAL DE PARIS - PINEDE;75014;;;;https://www.paris.fr/equipements/parc-floral-de-paris-1;2.3523880408452515;48.8409122311636;48.8409122311636;2.3523880408452515
;;;JARDIN CATHERINE LABOURE;75015;;;;https://www.paris.fr/equipements/jardin-catherine-laboure-2465;2.356788716578511;48.851401300193594;48.851401300193594;2.356788716578511
;;;JARDIN JAMES JOYCE;75018;;;;https://www.paris.fr/equipements/jardin-james-joyce-2560;2.3604997434830852;48.86260809408294;48.86260809408294;2.3604997434830852
;;;Parc Rives de Seine;;;;;;2.3737508079721192;48.86428649324811;48.86428649324811;2.3737508079721192
;;;face au 55 BOULEVARD DE VAUGIRARD;;;;;;2.4446432727101697;48.89412215800546;48.89412215800546;2.4446432727101697
1 ;variance de ./etalab_data/toilettes/small.csv;généré le:;Fri Aug 18 2023 13:39:11 GMT+0200 (heure d’été d’Europe centrale);lignes du csv original:;10;fait avec make_variance_from_csv.ts de Tykayn
2 ;TYPE;STATUT;ADRESSE;ARRONDISSEMENT;HORAIRE;ACCES_PMR;RELAIS_BEBE;URL_FICHE_EQUIPEMENT;geo_shape_1;geo_shape_2;geo_point_2d_1;geo_point_2d_2
3 ;3;1;9;7;4;2;3;7;9;9;9;9
4 ;SANISETTE;;63 AVENUE DU GENERAL LECLERC;75003;24 h / 24;Oui;;;2.3164276371957278;48.82101412751667;48.82101412751667;2.3164276371957278
5 ;TOILETTES;;JARDIN HENRI SAUVAGE;75007;Voir fiche équipement;Non;Non;https://www.paris.fr/equipements/jardin-henri-sauvage-ex-square-amiraux-boinod-2702;2.3195679829481666;48.82896483276907;48.82896483276907;2.3195679829481666
6 ;WC PUBLICS PERMANENTS;;SQUARE DU TEMPLE;75012;;;Oui;https://www.paris.fr/equipements/square-du-temple-elie-wiesel-2425;2.320485389226217;48.836321683521824;48.836321683521824;2.320485389226217
7 ;;;JARDIN DU MOULIN DE LA POINTE;75013;6 h - 22 h;;;https://www.paris.fr/equipements/jardin-du-monument-aux-meres-francaises-2564;2.3279795895584483;48.838257002553206;48.838257002553206;2.3279795895584483
8 ;;;BOIS DE VINCENNES - PARC FLORAL DE PARIS - PINEDE;75014;;;;https://www.paris.fr/equipements/parc-floral-de-paris-1;2.3523880408452515;48.8409122311636;48.8409122311636;2.3523880408452515
9 ;;;JARDIN CATHERINE LABOURE;75015;;;;https://www.paris.fr/equipements/jardin-catherine-laboure-2465;2.356788716578511;48.851401300193594;48.851401300193594;2.356788716578511
10 ;;;JARDIN JAMES JOYCE;75018;;;;https://www.paris.fr/equipements/jardin-james-joyce-2560;2.3604997434830852;48.86260809408294;48.86260809408294;2.3604997434830852
11 ;;;Parc Rives de Seine;;;;;;2.3737508079721192;48.86428649324811;48.86428649324811;2.3737508079721192
12 ;;;face au 55 BOULEVARD DE VAUGIRARD;;;;;;2.4446432727101697;48.89412215800546;48.89412215800546;2.4446432727101697

View File

@ -18,17 +18,22 @@ let mini_arguments: any = minimist(process.argv.slice(2))
// } // }
let csv_content = 'variance de dataset\n'; let csv_content = 'variance de dataset\n';
let separator = ';'; let separator = ',';
let separator_fallback = ';';
let data_variance: any = {}; let data_variance: any = {};
let inputFile = 'sanisettesparis_reworked' let folder = 'toilettes'
let fileName = `sanisettesparis_${inputFile}.csv`; let inputFile = 'small.csv'
let inputPath = `./etalab_data/toilettes/${inputFile}.csv` let fileNameOutput = `variance_${inputFile}`;
let inputPath = `./etalab_data/${folder}/${inputFile}`
// let inputPath = './etalab_data/toilettes/small_datas.csv' // let inputPath = './etalab_data/toilettes/small_datas.csv'
let outputPath = 'etalab_data/toilettes' let outputPath = `etalab_data/${folder}`
if (mini_arguments['source']) { if (mini_arguments['source']) {
inputPath = mini_arguments['source'] inputPath = mini_arguments['source']
} }
if (mini_arguments['separator']) {
separator = mini_arguments['separator']
}
let columns_headings: Array<string> = []; let columns_headings: Array<string> = [];
let lines_count = 0; let lines_count = 0;
let longest_variance_count = 0; let longest_variance_count = 0;
@ -37,6 +42,7 @@ let longest_variance_count = 0;
function getColumnsFromRow(row: string) { function getColumnsFromRow(row: string) {
let headings: any = [] let headings: any = []
console.log('elem', row) console.log('elem', row)
headings = row.split(separator) headings = row.split(separator)
return headings return headings
} }
@ -48,7 +54,6 @@ console.log('open file ', inputPath)
*/ */
function reorderValuesInDataVariance() { function reorderValuesInDataVariance() {
columns_headings.forEach((heading: string) => { columns_headings.forEach((heading: string) => {
data_variance[heading] = data_variance[heading].sort((a: any, b: any) => a - b) data_variance[heading] = data_variance[heading].sort((a: any, b: any) => a - b)
}) })
} }
@ -65,12 +70,27 @@ fs.readFile(inputPath, function (err: any, fileData: any) {
throw new Error(err) throw new Error(err)
} }
console.log('line ', lines_count) console.log('line ', lines_count)
console.log('lines.length', lines.length)
lines.forEach((line: any) => { lines.forEach((line: any) => {
line = line[0] line = line[0]
if (lines_count === 0) { if (lines_count === 0) {
console.log('line', line)
if(line.indexOf(separator) === -1){
console.log('separator not found: ', separator, 'trying other separator')
if(line.indexOf(separator_fallback) === -1){
console.log('separator not found: ', separator_fallback)
throw new Error('no separator found in csv')
}else{
console.log('fallback separator found: ', separator_fallback, 'now using it ')
separator = separator_fallback
}
}
columns_headings = getColumnsFromRow(line) columns_headings = getColumnsFromRow(line)
console.log('columns_headings.length', columns_headings.length) console.log('columns_headings.length', columns_headings.length)
// console.log('columns_headings', columns_headings) // console.log('columns_headings', columns_headings)
@ -118,8 +138,7 @@ fs.readFile(inputPath, function (err: any, fileData: any) {
console.log('longest_variance_count', longest_variance_count) console.log('longest_variance_count', longest_variance_count)
reorderValuesInDataVariance() reorderValuesInDataVariance()
utils.writeFile(fileName, writeCSVVariance(), outputPath) utils.writeFile(fileNameOutput, writeCSVVariance(), outputPath)
// console.log('data_variance', data_variance)
}) })
} }

View File

@ -0,0 +1,7 @@
#!/bin/bash
echo "reprendre la data d'osm et convertir en geojson pour corriger en conflater ensuite"
osm2geojson "/home/tykayn/Nextcloud/projets/bornes elec irve osm/essonne_charging_stations_to_fix_phone.osm" "/home/poule/encrypted/stockage-syncable/www/development/html/mapping-osm-geojson/etalab_data/irve_bornes_recharge/essonne_charging_stations_to_fix_phone.geojson"
ts-node convert_to_osm_tags.ts --engine=true --source="/home/poule/encrypted/stockage-syncable/www/development/html/mapping-osm-geojson/etalab_data/irve_bornes_recharge/essonne_charging_stations_to_fix_phone.geojson"