Minor bug fix and added date to graphs
diff --git a/cron/generateData.php b/cron/generateData.php
index fab3093..2489afa 100644
--- a/cron/generateData.php
+++ b/cron/generateData.php
@@ -10,7 +10,10 @@
"Terres de l'Ebre" => 176817,
"Girona" => 861753,
"Catalunya Central" => 526959,
- "Barcelona" => 5050190
+ "Barcelona" => 5050190,
+ "Barcelona Ciutat" => 1693449,
+ "Metropolità Sud" => 1370709,
+ "Metropolità Nord" => 1986032,
];
$CODENAME = [
@@ -20,7 +23,10 @@
"Terres de l'Ebre" => "TerresDeLEbre",
"Girona" => "Girona",
"Catalunya Central" => "CatalunyaCentral",
- "Barcelona" => "Barcelona"
+ "Barcelona" => "Barcelona",
+ "Barcelona Ciutat" => "BarcelonaCiutat",
+ "Metropolità Sud" => "MetropolitaSud",
+ "Metropolità Nord" => "MetropolitaNord",
];
function getSumDay($originalDay, $translation, &$dataRegio) {
@@ -69,8 +75,6 @@
if ($date > $newestDay) $newestDay = $date;
}
- $newestDay->sub(new DateInterval("P1D"));
-
$rhos = [];
for ($currentDate = (clone $oldestDay)->add(new DateInterval("P7D")); $currentDate < $newestDay; $currentDate->add(new DateInterval("P1D"))) {
@@ -112,7 +116,7 @@
$rhoAverage /= $rhoCount;
$summary[$regio][] = [
- "data" => $currentDate->format("c"),
+ "data" => $currentDate->format("d/m/y"),
"ia14" => (isset($HABITANTS[$regio]) ? $sum*(1e5/$HABITANTS[$regio]) : null),
"rho7" => $rhoAverage
];
diff --git a/cron/plot.gnu b/cron/plot.gnu
index 5c47817..6753638 100644
--- a/cron/plot.gnu
+++ b/cron/plot.gnu
@@ -15,25 +15,40 @@
# The different colored areas correspond to the classification of the EPG values defined on page 8 at https://biocomsc.upc.edu/en/shared/20200506_report_web_51.pdf
-set title "Terres de l'ebre"
+lastUpdated = system("tail -n 1 ".filesPrefix."TerresDeLEbre.dat | awk '{print $1;}'")
+set title "Terres de l'Ebre\n{/*0.4 Última dada (punt negre): ".lastUpdated."}"
plot 6*x w filledcurve y1=0 lt rgb "#ff9494", 100/x w filledcurve y1=0 lt rgb "#ffe494", 70/x w filledcurve y1=0 lt rgb "#dbff94", 30/x w filledcurve y1=0 lt rgb "#a0ff94", filesPrefix.'TerresDeLEbre.dat' u 2:3 w lp pt 6 lt rgb "black", "< tail -n 1 ".filesPrefix."TerresDeLEbre.dat" u 2:3 w lp pt 7 lt rgb "black"
-set title "Camp de Tarragona"
+lastUpdated = system("tail -n 1 ".filesPrefix."CampDeTarragona.dat | awk '{print $1;}'")
+set title "Camp de Tarragona\n{/*0.4 Última dada (punt negre): ".lastUpdated."}"
plot 6*x w filledcurve y1=0 lt rgb "#ff9494", 100/x w filledcurve y1=0 lt rgb "#ffe494", 70/x w filledcurve y1=0 lt rgb "#dbff94", 30/x w filledcurve y1=0 lt rgb "#a0ff94", filesPrefix.'CampDeTarragona.dat' u 2:3 w lp pt 6 lt rgb "black", "< tail -n 1 ".filesPrefix."CampDeTarragona.dat" u 2:3 w lp pt 7 lt rgb "black"
-set title "Alt Pirineu, Aran"
+lastUpdated = system("tail -n 1 ".filesPrefix."AltPirineuAran.dat | awk '{print $1;}'")
+set title "Alt Pirineu, Aran\n{/*0.4 Última dada (punt negre): ".lastUpdated."}"
plot 6*x w filledcurve y1=0 lt rgb "#ff9494", 100/x w filledcurve y1=0 lt rgb "#ffe494", 70/x w filledcurve y1=0 lt rgb "#dbff94", 30/x w filledcurve y1=0 lt rgb "#a0ff94", filesPrefix.'AltPirineuAran.dat' u 2:3 w lp pt 6 lt rgb "black", "< tail -n 1 ".filesPrefix."AltPirineuAran.dat" u 2:3 w lp pt 7 lt rgb "black"
-set title "Lleida"
+lastUpdated = system("tail -n 1 ".filesPrefix."Lleida.dat | awk '{print $1;}'")
+set title "Lleida\n{/*0.4 Última dada (punt negre): ".lastUpdated."}"
plot 6*x w filledcurve y1=0 lt rgb "#ff9494", 100/x w filledcurve y1=0 lt rgb "#ffe494", 70/x w filledcurve y1=0 lt rgb "#dbff94", 30/x w filledcurve y1=0 lt rgb "#a0ff94", filesPrefix.'Lleida.dat' u 2:3 w lp pt 6 lt rgb "black", "< tail -n 1 ".filesPrefix."Lleida.dat" u 2:3 w lp pt 7 lt rgb "black"
-set title "Girona"
+lastUpdated = system("tail -n 1 ".filesPrefix."Girona.dat | awk '{print $1;}'")
+set title "Girona\n{/*0.4 Última dada (punt negre): ".lastUpdated."}"
plot 6*x w filledcurve y1=0 lt rgb "#ff9494", 100/x w filledcurve y1=0 lt rgb "#ffe494", 70/x w filledcurve y1=0 lt rgb "#dbff94", 30/x w filledcurve y1=0 lt rgb "#a0ff94", filesPrefix.'Girona.dat' u 2:3 w lp pt 6 lt rgb "black", "< tail -n 1 ".filesPrefix."Girona.dat" u 2:3 w lp pt 7 lt rgb "black"
-set title "Catalunya central"
+lastUpdated = system("tail -n 1 ".filesPrefix."CatalunyaCentral.dat | awk '{print $1;}'")
+set title "Catalunya central\n{/*0.4 Última dada (punt negre): ".lastUpdated."}"
plot 6*x w filledcurve y1=0 lt rgb "#ff9494", 100/x w filledcurve y1=0 lt rgb "#ffe494", 70/x w filledcurve y1=0 lt rgb "#dbff94", 30/x w filledcurve y1=0 lt rgb "#a0ff94", filesPrefix.'CatalunyaCentral.dat' u 2:3 w lp pt 6 lt rgb "black", "< tail -n 1 ".filesPrefix."CatalunyaCentral.dat" u 2:3 w lp pt 7 lt rgb "black"
-set title "Barcelona"
-plot 6*x w filledcurve y1=0 lt rgb "#ff9494", 100/x w filledcurve y1=0 lt rgb "#ffe494", 70/x w filledcurve y1=0 lt rgb "#dbff94", 30/x w filledcurve y1=0 lt rgb "#a0ff94", filesPrefix.'Barcelona.dat' u 2:3 w lp pt 6 lt rgb "black", "< tail -n 1 ".filesPrefix."Barcelona.dat" u 2:3 w lp pt 7 lt rgb "black"
+lastUpdated = system("tail -n 1 ".filesPrefix."BarcelonaCiutat.dat | awk '{print $1;}'")
+set title "Barcelona Ciutat\n{/*0.4 Última dada (punt negre): ".lastUpdated."}"
+plot 6*x w filledcurve y1=0 lt rgb "#ff9494", 100/x w filledcurve y1=0 lt rgb "#ffe494", 70/x w filledcurve y1=0 lt rgb "#dbff94", 30/x w filledcurve y1=0 lt rgb "#a0ff94", filesPrefix.'BarcelonaCiutat.dat' u 2:3 w lp pt 6 lt rgb "black", "< tail -n 1 ".filesPrefix."BarcelonaCiutat.dat" u 2:3 w lp pt 7 lt rgb "black"
+
+lastUpdated = system("tail -n 1 ".filesPrefix."MetropolitaSud.dat | awk '{print $1;}'")
+set title "Metropolità Sud\n{/*0.4 Última dada (punt negre): ".lastUpdated."}"
+plot 6*x w filledcurve y1=0 lt rgb "#ff9494", 100/x w filledcurve y1=0 lt rgb "#ffe494", 70/x w filledcurve y1=0 lt rgb "#dbff94", 30/x w filledcurve y1=0 lt rgb "#a0ff94", filesPrefix.'MetropolitaSud.dat' u 2:3 w lp pt 6 lt rgb "black", "< tail -n 1 ".filesPrefix."MetropolitaSud.dat" u 2:3 w lp pt 7 lt rgb "black"
+
+lastUpdated = system("tail -n 1 ".filesPrefix."MetropolitaNord.dat | awk '{print $1;}'")
+set title "Metropolità Nord\n{/*0.4 Última dada (punt negre): ".lastUpdated."}"
+plot 6*x w filledcurve y1=0 lt rgb "#ff9494", 100/x w filledcurve y1=0 lt rgb "#ffe494", 70/x w filledcurve y1=0 lt rgb "#dbff94", 30/x w filledcurve y1=0 lt rgb "#a0ff94", filesPrefix.'MetropolitaNord.dat' u 2:3 w lp pt 6 lt rgb "black", "< tail -n 1 ".filesPrefix."MetropolitaNord.dat" u 2:3 w lp pt 7 lt rgb "black"
unset multiplot