vostpt / greve-transportes-perigosos Goto Github PK
View Code? Open in Web Editor NEWBase Code for https://janaodaparaabastecer.vost.pt
Home Page: https://janaodaparaabastecer.vost.pt
License: MIT License
Base Code for https://janaodaparaabastecer.vost.pt
Home Page: https://janaodaparaabastecer.vost.pt
License: MIT License
Insert statistics' graphic on brand's BO, similar to the one on the homepage
The link on README file is pointing to file LICENSE.md instead of LICENSE (without the .md).
The generated link - https://github.com/vostpt/greve-transportes-perigosos/blob/master/LICENSE.md - makes GitHub redirect us to 404 page
If it makes sense to you, relative time periods are more helpful to understand "last updated", rather than full dates, as in this case the idea is to see how stale the information is.
So here's a suggestion for a quick timediff:
diff --git a/resources/js/map.js b/resources/js/map.js
index cd4a100..210a8dd 100644
--- a/resources/js/map.js
+++ b/resources/js/map.js
@@ -28,6 +28,19 @@ String.prototype.capitalize = function () {
});
};
+function timediff(date) {
+ let diffSeconds = Math.floor((new Date() - date) / 1000);
+ let days = Math.floor(diffSeconds / 86400);
+ let hours = Math.floor((diffSeconds % 86400) / 3600);
+ // ceil because we don't care about seconds
+ let minutes = Math.min(59, Math.ceil((diffSeconds % 3600) / 60));
+ var res = ""
+ if (res || days > 0) { res += " " + days + "d"; }
+ if (res || hours > 0) { res += " " + hours + "h"; }
+ if (res || minutes > 0) { res += " " + minutes + "m"; }
+ return res.trim();
+}
+
function loadPoints() {
return new Promise(function (resolve, reject) {
points = [];
@@ -131,9 +144,11 @@ function loadPoints() {
else {
tooltip += '<p style="margin-bottom:0">Marca: '+ fuelStation.brand +'</p>';
}
- var date = new Date(fuelStation.updated_at.replace(/ /, 'T') + '+01:00');
+ let date = new Date(fuelStation.updated_at.replace(/ /, 'T') + '+01:00');
+ // let dateString = date.toLocaleString();
+ let dateString = timediff(date);
tooltip += '<p style="margin-bottom:0">ID: '+fuelStation.id+'</p>';
- tooltip += '<p style="margin-bottom:0">Última atualização em: '+date.toLocaleString()+'</p>';
+ tooltip += '<p style="margin-bottom:0">Última atualização: '+dateString+'</p>';
points.push({
"type": "Feature",
"geometry": {
Based on feedback from users:
Fetch information from the shared source maintained by Waze to allow quick edits by VOST Portugal's team.
This information will be consolidated with Waze at a later date.
This feature has high priority
In the list of gas stations a new field with simple lat / lon (and/or link to google maps for fuel stations confirmation purposes ( because it has streetview, - waze only has streetview in edit mode).
Context
ENSE is the official entity in Portugal.
As far as we know they are getting information every day in the morning and in the afternoon.
On this website they have information regarding the REPA network
Problem
ENSE will not share their data in an open format. The way that the information is presented is not user friendly
Objective
608766585309626368
Context
One of the biggest problems is the integrity of the data. We have seen some invalid submissions happen.
Problem
A standard user can submit fuel information for any fuel station disregarding his location.
Objective
Color blind people can't distinguish the points in the map.
Please include a tool tip with description.
The idea is to allow creating a DB entry by double-clicking on the map, automatically filling in the Lat. and Lon. This feature should work for new gas station entries too.
On mouse over return:
https://www.prio.pt/pt/postos/rede-de-postos_289.html?tab=1&type=1
When we are zoomed in in the map and click an icon we are zoomed out automagically, which is annoying.
When clicking an icon the popup info window is huge!
Can you make this smaller and add clear information about available fuels? Pricing would be nice too.
In mobile devices, which the majority of accesses come from I believe, the site has some issues.
When scrolling, the whole page scrolls instead of the map.
The legend gets behind the search field...
On "Consultar", it would be nice to see the time of the last-updated so we know how state is the information of the status of a fuel station.
there seems to be timestamps on the DB, and on app/Http/Controllers/CacheController.php it should be possible to write the updated timestamp on the cache.JSON file, on the line
$json = FuelStation::all('id', 'name', 'brand', 'long', 'lat', 'repa', 'sell_gasoline', 'sell_diesel', 'sell_lpg', 'has_gasoline', 'has_diesel', 'has_lpg')->toJson();
and then adapt the html+javascript to show the date on the box of the fuel station status
O strangelesi criou o posto "4168 Cepsa-Côja" via https://janaodaparaabastecer.vost.pt/api/v1, via PC.
No entanto este posto:
a) não está visível, via PC, pelo Consultar, Ajudar ou ~panel/stations/list
b) está visível, via mobile iOS, pelo Consultar ou Ajudar
Ver screenshots com as avidências no Discord-taskforce-jndpa 15Ago07:57
Add information about fuel supply risk from ENSE (national energy sector regulator).
I don't know if there is any available API to gather this info, but in their website the information is available in line 692 of the HTML source code.
INCLUDE IN MEDIA
Dashboard Code
<style>.embed-container {position: relative; padding-bottom: 80%; height: 0; max-width: 100%;} .embed-container iframe, .embed-container object, .embed-container iframe{position: absolute; top: 0; left: 0; width: 100%; height: 100%;} small{position: absolute; z-index: 40; bottom: 0; margin-bottom: -15px;}</style><div class="embed-container"><iframe width="500" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" title="BASEMAP" src="https://arcgis.com/apps/opsdashboard/index.html#/a4890bfd60df4c07bd67c857b73b452f"></iframe></div>
Dashboard Description
Uma dashboard em tempo real dos dados recolhidos no site "Já Não Dá Para Abastecer", feita em ArcGIS com o apoio da ESRI Portugal.
Termos e condições de uso:Full Credits a VOSTPT / Esri Portugal / ArcGis
CREATE NEW MENU ITEM "MORE STATS"*
Embed above code on website
Excelente projeto, se soubesse php ajudava 😄 ❤️
Due to some input please change top bar color to #3399ff
Implement a method to calculate total submissions + submissions per hour to be shown in a line graph within the Dashboard and main page.
Implement a method to calculate number of reported fuel stations without Gasolina / Gasóleo / GPL per hour to be shown in three different line graphs on the dashboard and main page.
Graphs should be made available as an iFrame as well
BP can be found here: https://www.bp.com/content/dam/bp-plus/pt_pt/downloads/PDF/Lista-de-Postos-de-Abastecimento-BP.pdf
GALP: https://estrada.galp.pt/mapa? // KML: http://www.galpenergia.com/PT/ProdutosServicos/Documents/galpfrota/Galp-Frota-Google-Earth.kml
CEPSA: http://pertodesi.cepsa.com/
Vários: https://www.maisgasolina.com/lista-de-postos/ (necessário cross check)
Intermarché: https://www.google.com/maps/d/viewer?mid=1pHlEPJHf4bSfjAxUJNoPX06bTjE&ll=40.108348730661376%2C-8.544612316406301&z=8
Direcção Geral da Energia: https://www.precoscombustiveis.dgeg.pt/
What's the best way to get this data on our side? What other gas stations are there with an impact?
If I search for "Ja nao da para abastecer"
It gives me this message that the strike is over:
https://imgur.com/a/5Spk4YY
or even:
"Após a desconvocação da greve, a nossa missão chegou ao fim. Obrigado a todos os que contribuíram com informação válida, que tantas pessoas ajudou. Obrigado a todos os que contribuíram com informação inválida, que tanto nos ajudou a aprender e a crescer. Ficam aqui os números, que falam por si. Site"
Add facebook, twitter and instagram buttons to the website :)
On list view the option "Ver Mapa" should:
Context
To submit an update about a Fuel Station, we evaluate that there are enough entries submitted from standard users. The amount of entries needed is configured through an admin panel.
Problem
Some reports indicate that in some locations, the information would not update due to the lack of submissions. This happens mostly because there are some locations that don't have enough people using the website to report, so we have to evaluate this information manually or reduce the number of entries needed and creating another problem in other locations.
Objective
Create a set of polygons with "My Google Maps" that separates geographically locations that should have a different amount of entries evaluated and describe them with the number of entries needed.
Add an integer column "num_entries" in the fuel station's table to identify how many entries each station needs
Create a script that verifies all the fuel stations without "num_entries", checks which polygon feats the geographical position and fills the "num_entries" column with the given number of that polygon.
Feat the submission method of the map to validate the number of entries with "num_entries" of each station
Safari does not like ISO dates without timezones, so the recent "last updated" is broken.
This would be a quick hack that will assume the dates coming from the backend are WEST. Dates shall always be either UNIX timestamps, when after 1970, or full ISO 8601 dates, including timestamps.
Also, localization wise, we don't Capitalize Every Word in Portuguese ;)
diff --git a/resources/js/map.js b/resources/js/map.js
index 2ac903b..cd4a100 100644
--- a/resources/js/map.js
+++ b/resources/js/map.js
@@ -131,9 +131,9 @@ function loadPoints() {
else {
tooltip += '<p style="margin-bottom:0">Marca: '+ fuelStation.brand +'</p>';
}
- var date = new Date(fuelStation.updated_at);
+ var date = new Date(fuelStation.updated_at.replace(/ /, 'T') + '+01:00');
tooltip += '<p style="margin-bottom:0">ID: '+fuelStation.id+'</p>';
- tooltip += '<p style="margin-bottom:0">Última Atualização em: '+date.toLocaleString()+'</p>';
+ tooltip += '<p style="margin-bottom:0">Última atualização em: '+date.toLocaleString()+'</p>';
points.push({
"type": "Feature",
"geometry": {
@@ -193,7 +193,7 @@ function getAttributions() {
var minutes = date.getMinutes();
var hour = date.getHours();
let attributions = [...customAttributions];
- attributions.push('Última Atualização às: ' + ("0" + hour).slice(-2) + 'h' + ("0" + minutes).slice(-2) + 'm' + ("0" + seconds).slice(-2) + 's');
+ attributions.push('Última atualização às: ' + ("0" + hour).slice(-2) + 'h' + ("0" + minutes).slice(-2) + 'm' + ("0" + seconds).slice(-2) + 's');
return attributions;
}
If an error is detected an error message is shown when clicking Reportar.
If there is no error, the information in the form is just reset without any success message.
It's necessary to add a GDPR (RGPD) disclaimer to the site naodaparaabastecer.pt :
Link to VostPt disclaimer here:
https://docs.google.com/document/d/1MLdWYBOW2se4AR8BJ4PAFMFjN7i5gZUq_zwzzXGjNRw/edit?usp=sharing
On the top-right option panel add filters so users can visualize:
Probably it was made on purpose but the method fetchcsv@APIController is not protected by authentication.
When looking at the "consultar" map, it would be nice to be able to jump directly to the "ajuda", to the same fuel station, to contribute to update the status of the fuel station.
The two screens are slightly different, with the "consultar" more efficient to search for stuff, as the "ajudar" is not that clear on the brand of the station, making it quite hard, specially on a mobile, to look for a station, then have to go back to the beginning, ajudar, and search again for the same station.
Context:
Prio is now providing official data and information to the platform.
On the statistics page display a bar graphic just for PRIO below general availability's bars using #3D8FAA
for available. Name "PRIO" and linking to PRIO's homepage https://www.prio.pt/pt/postos/rede-de-postos_289.html?tab=1&type=1
Hopefully a free software one :-) Thanks!
This is a two fold issue:
Statistics, statistics, statistics! We want data!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.