Commit 58c5f364 authored by alain's avatar alain 💾

change luchtmeetnet settings for new hourly call

parent 71f252b9
......@@ -2,8 +2,8 @@ import { getLastHourISO, getNowISO, subtractOneHourISO } from "../../data-on-a-m
import { groupArrayOfObjectsBy, renameObjectKey, addMissingDataPoints } from "../../data-on-a-map-app/src/util/data"
const endPointDataPlatform = "https://data.waag.org"
//const endPointDataPlatform = process.env.NODE_ENV === 'development' ? "http://localhost:1881" : "https://data.waag.org"
//const endPointDataPlatform = "https://data.waag.org"
const endPointDataPlatform = process.env.NODE_ENV === 'development' ? "http://localhost:1881" : "https://data.waag.org"
const officialStations = {
......@@ -86,8 +86,8 @@ export default {
sides: 6,
angle: 0,
factor: 1,
dataStart: "2019-06-25T00:00:00.000Z",
daysToFetch: 60,
dataStart: "2020-03-14T00:00:00.000Z",
daysToFetch: 365,
dataStreams: {
pm25: {
single: {
......@@ -116,7 +116,7 @@ export default {
const lastHourISO = getLastHourISO()
const nowHourISO = getNowISO()
const allResponse = await fetch(`${endPointDataPlatform}/api/getOfficialMeasurement?formula=${parameter.toUpperCase()}&start=${lastHourISO}&end=${nowHourISO}&station_id=${officialStations[parameter].join("&station_id=")}`)
const allResponse = await fetch(`${endPointDataPlatform}/api/holu/getOfficialMeasurement?formula=${parameter.toUpperCase()}&start=${lastHourISO}&end=${nowHourISO}&station_id=${officialStations[parameter].join("&station_id=")}`)
//const allResponse = await fetch(`${endPointDataPlatform}/api/holu/luchtmeetnet/tail?parameter=${parameter}&start=${lastHourISO}&end=${nowHourISO}&sensor_id=${officialStations[parameter].join("&sensor_id=")}`)
const all = await allResponse.json()
......@@ -158,20 +158,16 @@ export default {
stationData: async function(station, parameter, start, end, granularity) {
try {
const response = await fetch(`${endPointDataPlatform}/api/holu/getOfficialMeasurement?formula=${parameter.toUpperCase()}&station_id=${station.id}&start=${start}&end=${end}`)
//const response = await fetch(`${endPointDataPlatform}/api/holu/luchtmeetnet/tail?parameter=${parameter}&sensor_id=${station.id}&start=${start}&end=${end}`)
const response = await fetch(`${endPointDataPlatform}/api/holu/luchtmeetnet/hourly?parameter=${parameter}&sensor_id=${station.id}&start=${start}&end=${end}`)
const responseData = await response.json()
const groupedData = groupArrayOfObjectsBy(responseData, "formula")
let data = groupedData[0].map(x => {
const o = {
timestamp: new Date(x.timestamp_measured).getTime()
}
o[`${parameter}_mean`] = x.value
return o
let data = responseData.map(m => {
m.timestamp = new Date(m.time).getTime()
delete m.time
return m
})
if(data[0]) {
const dataStart = data[0].timestamp
const dataEnd = new Date(end).getTime()
......@@ -184,5 +180,9 @@ export default {
console.log(error)
return { status: "error" }
}
},
download: function(id, parameter, start, end) {
return `${endPointDataPlatform}/api/holu/luchtmeetnet/hourly?sensor_id=${id}&start=${start}&end=${end}&format=csv`
}
}
\ No newline at end of file
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