Commit 9767ba67 authored by Fabrice Gangler's avatar Fabrice Gangler 🎨
Browse files

FIX: update SILL import script

parent 9654eabd
Pipeline #15721 failed with stage
in 5 minutes and 1 second
......@@ -18,22 +18,23 @@ $url = "https://raw.githubusercontent.com/DISIC/sill/master/2020/sill-2020.csv";
$fileName = 'SILL_2020.csv';
$dataSrc = file_get_contents($url);
file_put_contents($fileName, $dataSrc); /* [0] => ID
[1] => nom
[2] => fonction
[3] => annees
[4] => statut
[5] => parent
[6] => public
[7] => similaire-a
[8] => wikidata
[9] => comptoir-du-libre
[10] => licence */
[1] => nom
[2] => fonction
[3] => annees
[4] => statut
[5] => parent
[6] => public
[7] => support
[8] => similaire-a
[9] => wikidata
[10] => comptoir-du-libre
[11] => licence */
// column numbers of the csv file
$numberOfFileFields = 16;
$numberOfFileFields = 17;
$colYears = 3;
$colWikidata = 8;
$colComptoir = 9;
$colWikidata = 9;
$colComptoir = 10;
// file processing
$row = 1;
......@@ -68,8 +69,11 @@ if (($handle = fopen($fileName, "r")) !== false) {
$idWikidata = $data[$colWikidata];
$lineYears = explode(';', $data[$colYears]);
foreach ($lineYears as $year) {
$year = (int) trim($year);
$years[$year][$idComptoir] = $idWikidata;
$year = trim($year);
if ($year !== '') {
$year = (int) $year;
$years[$year][$idComptoir] = $idWikidata;
}
}
} else {
$noIds[$row] = $data;
......@@ -100,6 +104,7 @@ echo "\n------> ". ($row - 1) . " src";
echo "\n------> ". (count($noIds) - 1). " NO id comptoir";
foreach ($years as $year => $Ids) {
echo "\n------> ". count($Ids) . " software for SILL-$year";
// print_r($Ids);
}
echo "\n\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment