NOTE: This Task helps me in tracking an upstream bug in a MiSE's Open Data dataset. Here further info.
WARNING: If you are not a MiSE technician perhaps this page is not very useful. But interesting anyway.
== Preamble (why I've found this issue) ==
In 2015 I've developed just another Italian fuel pumps comparator during a 24H hackaton promoted by a notable Italian insurance company. My team won it but that's not our story.
That tool is based on a dataset provided from the [[ https://en.wikipedia.org/wiki/Ministry_of_Economic_Development_(Italy) | MiSE ]]. Well, that dataset was borked since 2015 but now (2021) it's somehow even //more// borked and I could continue to apply hotfixes for myself or just ask the MiSE to fix their dataset for everybody.
More FAQs after [[ https://it.wikipedia.org/wiki/Accesso_abusivo_a_un_sistema_informatico_o_telematico | 615-ter ]]:
* No, I have not violated any security system
* No, that was not a protected memory sector
* No, I've not destroyed or damaged any system
* Yes, it's just a borked CSV and everyone can see it borked and it's not nice, but MiSE can fix
== Steps to reproduce ==
1. Download the [[ https://www.mise.gov.it/images/exportCSV/anagrafica_impianti_attivi.csv | anagrafica_impianti_attivi.csv ]] from [[ https://www.mise.gov.it/index.php/it/open-data/elenco-dataset/2032336-carburanti-prezzi-praticati-e-anagrafica-degli-impianti | Italian fuel pump dataset - MiSE ]]
2. Open with LibreOffice (set the separator to the semicolon)
3. Note that the dataset is borked at line `29`ID `46593`
Quick overview:
{F1471685}
Alternative quick overview (note line `29` here, ID `46593`):
{P17, lines=40, highlight=29}
== Problem n. 1 ==
The MiSE clearly is not using a suitable library to generate a CSV. and this causes a malformed dataset.
Solution:
Please, please, adopt a //real// CSV standard. Do not just use a semicolon as glue for your data.
Instructions:Reference:
* https://en.wikipedia.org/wiki/Comma-separated_values on Wikipedia
* https://www.php.net/manual/en/function.fputcsv.php for PHP
* https://pythonspot.com/files-spreadsheets-csv/ for Python
* http://commons.apache.org/proper/commons-csv/ for Java
* ...
== Problem n. 2 ==
The MiSE is not properly validatcleaning user input.
Please `trim` your values.
Example: avoid someone called "` Mario Rossi `" (note spaces includedat the beginning and at the end).
== Problem n. 3 ==
"CSV" means "//comma//-separated values" but MiSE generates //semicolon//-separated values.
I think it's too late to fix this butProposed solution: wontfix, heybut write that note somewhere.
Even if it's too late to fix this, I havit is not too late to report thisinform people.
== Proposed solution ==
Adopt whatever CSV library, instead of just using ";" as glue between whatever value.
This will fix a very bad programming approach that is actually compromising theirthat MiSE's dataset.
== Proposed workaround ==== In the meanwhile ==
CSomeone should contactt the fuel pump `MEGA SERVICE S.A.S. DI TERMINI MICHELE &C 123 di Licata, Km. 15+500, LICATA 92023 AG` asking them to fix their data, LICATA 92023 AG` to fixremoving the `"` from their data,name. asking them to remove the `"` fromThe MiSE cannot handle that case without breaking their name whole dataset.