Commit 202843f8 authored by alain's avatar alain 🐙
Browse files

update settings

parent e517991d
[submodule "frontend/data-on-a-map-app"]
path = frontend/data-on-a-map-app
url = https://git.waag.org/alain/data-on-a-map-app.git
url = https://gitlab.waag.org/code/data-on-a-map-app.git
......@@ -9,10 +9,16 @@ export const mapDefaults = {
// [52.366823, 4.877358].reverse(),
// [52.360942, 4.891785].reverse()
// ],
// bounds: [
// [52.357861, 4.889557].reverse(),
// [52.356061, 4.894613].reverse()
// ],
bounds: [
[52.366110, 4.877837].reverse(),
[52.360286, 4.883248].reverse()
],
[52.373574, 4.883638].reverse(),
[52.354316, 4.898663].reverse()
],
viewport: {
pitch: 40,
......
......@@ -3,14 +3,34 @@ import { addMissingDataPoints } from "../../data-on-a-map-app/src/util/data"
import { getDataAge } from "../../data-on-a-map-app/src/util/time"
//const endPointDataPlatform = process.env.NODE_ENV === 'development' ? "http://localhost:1884" : "https://data.waag.org"
const endPointDataPlatform = "https://data.waag.org"
export default {
name: "asokit",
sides: 24,
angle: 0,
factor: 0.5,
daysToFetch: 90,
//dataStart: "2019-06-25T00:00:00.000Z",
granularity: ["minutely", "hourly", "daily"],
granularities: {
minutely: {
label: "minuutwaarden",
dataPointsVisible: 3*60, // 3 hours
daysToFetch: 7
},
hourly: {
label: "uurwaarden",
dataPointsVisible: 7*24, // 7 days
daysToFetch: 90
},
daily: {
label: "dagwaarden",
dataPointsVisible: 60, // 31 days
daysToFetch: 365
}
},
//granularity: ["minutely", "hourly", "daily"],
dataStreams: {
db: {
single: {
......@@ -23,10 +43,10 @@ export default {
all: async function(parameter) {
try {
const allResponse = await fetch(`https://data.waag.org/api/asounds/asokit/stations`)
const allResponse = await fetch(`${endPointDataPlatform}/api/asounds/asokit/stations`)
const all = await allResponse.json()
const latestResponse = await fetch(`https://data.waag.org/api/asounds/asokit/recent`)
const latestResponse = await fetch(`${endPointDataPlatform}/api/asounds/asokit/recent`)
const latest = await latestResponse.json()
let offlineSensors = []
......@@ -40,16 +60,17 @@ export default {
name: `AmsterdamSounds Kit ${sensor.id.replace("slm_","")}: ${sensor.name}`,
source: "asokit",
coordinates: sensor.coordinates.reverse(),
mean: null
mean: null,
status: null
}
if(sensorData) {
const dataAgeInHours = getDataAge(sensorData.time, "hourly")
if(dataAgeInHours > 48) {
sensorDataReturn.name = sensorDataReturn.name + " (offline)"
sensorDataReturn.status = 0
} else if(dataAgeInHours > 8) {
sensorDataReturn.name = sensorDataReturn.name + " (geen recente data)"
sensorDataReturn.status = 1
} else {
sensorDataReturn.mean = sensorData.db_avg
sensorDataReturn.timestamp = sensorData.time
......@@ -57,7 +78,7 @@ export default {
}
} else {
offlineSensors.push(sensor.id)
sensorDataReturn.name = sensorDataReturn.name + " (offline)"
sensorDataReturn.status = 0
}
return sensorDataReturn
......@@ -83,7 +104,7 @@ export default {
const stationMeta = {
type: station.id,
name: station.name,
description: "<p>Dit is een AmsterdamSounds Kit. Dit prototype meet dBA. Als onderdeel van de pilot wordt er onderzoek gedaan naar de kwaliteit van de data afkomstig van deze kit.<p><p><a class='more' href='https://amsterdamsounds.waag.org/sensorkit/' target='_blank' rel='noopener noreferrer'>Meer info</a></p>"
description: "Dit is een AmsterdamSounds Kit. Dit prototype meet dBA. Als onderdeel van de pilot wordt er onderzoek gedaan naar de kwaliteit van de data afkomstig van deze kit.<br/><a class='more' href='https://amsterdamsounds.waag.org/sensorkit/' target='_blank' rel='noopener noreferrer'>Meer info</a>"
}
return stationMeta
......@@ -92,7 +113,7 @@ export default {
stationData: async function(station, parameter, start, end, granularity) {
try {
const response = await fetch(`https://data.waag.org/api/asounds/asokit?granularity=hourly&sensor_id=${encodeURI(station.id)}&start=${start}&end=${end}`)
const response = await fetch(`${endPointDataPlatform}/api/asounds/asokit?granularity=${encodeURI(granularity)}&sensor_id=${encodeURI(station.id)}&start=${start}&end=${end}`)
const responseData = await response.json()
let data = responseData.map(d => {
......
......@@ -3,6 +3,10 @@ import { addMissingDataPoints } from "../../data-on-a-map-app/src/util/data"
import { getDataAge } from "../../data-on-a-map-app/src/util/time"
//const endPointDataPlatform = process.env.NODE_ENV === 'development' ? "http://localhost:1884" : "https://data.waag.org"
const endPointDataPlatform = "https://data.waag.org"
export default {
name: "cidata",
sides: 4,
......@@ -10,6 +14,23 @@ export default {
factor: 0.75,
daysToFetch: 120,
//dataStart: "2019-06-25T00:00:00.000Z",
granularities: {
minutely: {
label: "minuutwaarden",
dataPointsVisible: 3*60, // 3 hours
daysToFetch: 7
},
hourly: {
label: "uurwaarden",
dataPointsVisible: 7*24, // 7 days
daysToFetch: 90
},
daily: {
label: "dagwaarden",
dataPointsVisible: 60, // 31 days
daysToFetch: 365
}
},
granularity: ["minutely", "hourly", "daily"],
dataStreams: {
db: {
......@@ -23,10 +44,10 @@ export default {
all: async function(parameter) {
try {
const allResponse = await fetch(`https://data.waag.org/api/asounds/cidata/stations`)
const allResponse = await fetch(`${endPointDataPlatform}/api/asounds/cidata/stations`)
const all = await allResponse.json()
const latestResponse = await fetch(`https://data.waag.org/api/asounds/cidata/recent`)
const latestResponse = await fetch(`${endPointDataPlatform}/api/asounds/cidata/recent`)
const latest = await latestResponse.json()
let offlineSensors = []
......@@ -42,16 +63,17 @@ export default {
coordinates: sensor.coordinates.reverse(),
mean: null,
timestamp: null,
dataAge: null
dataAge: null,
status: null
}
if(sensorData) {
const dataAgeInHours = getDataAge(sensorData.time, "hourly")
if(dataAgeInHours > 48) {
sensorDataReturn.name = sensorDataReturn.name + " (offline)"
sensorDataReturn.status = 0
} else if(dataAgeInHours > 8) {
sensorDataReturn.name = sensorDataReturn.name + " (geen recente data)"
sensorDataReturn.status = 1
} else {
sensorDataReturn.mean = sensorData.db_avg
sensorDataReturn.timestamp = sensorData.time
......@@ -59,7 +81,7 @@ export default {
}
} else {
offlineSensors.push(sensor.id)
sensorDataReturn.name = sensorDataReturn.name + " (offline)"
sensorDataReturn.status = 0
}
return sensorDataReturn
......@@ -86,7 +108,7 @@ export default {
const stationMeta = {
type: station.id,
name: station.name,
description: "<p>Dit is een Convergence Instruments Klasse 1 microfoon. Deze wordt gebruikt om de kwaliteit van de data afkomstig van de Amsterdam Sounds Kit te valideren.</p><p><a class='more' href='https://amsterdamsounds.waag.org/sensorkit/' target='_blank' rel='noopener noreferrer'>Meer info</a></p>"
description: "Dit is een Convergence Instruments Klasse 1 microfoon. Deze wordt gebruikt om de kwaliteit van de data afkomstig van de Amsterdam Sounds Kit te valideren.<br/><a class='more' href='https://amsterdamsounds.waag.org/sensorkit/' target='_blank' rel='noopener noreferrer'>Meer info</a>"
}
return stationMeta
......@@ -95,7 +117,7 @@ export default {
stationData: async function(station, parameter, start, end, granularity) {
try {
const response = await fetch(`https://data.waag.org/api/asounds/cidata?granularity=hourly&sensor_id=${encodeURIComponent(station.id)}&start=${start}&end=${end}`)
const response = await fetch(`${endPointDataPlatform}/api/asounds/cidata?granularity=${encodeURIComponent(granularity)}&sensor_id=${encodeURIComponent(station.id)}&start=${start}&end=${end}`)
const responseData = await response.json()
let data = responseData.map(d => {
......
......@@ -8,13 +8,13 @@ export const texts = {
},
dataStreams: {
single: {
label: "gemiddelde"
label: "Gemiddelde in tijdseenheid"
},
mean: {
label: "gemiddelde"
label: "Gemiddelde in tijdseenheid"
},
minmax: {
label: "min-max waarde"
label: "Min/max waarden in tijdseenheid"
}
}
}
Subproject commit 53525a80a5b7a2ba5334186a04522d591bdbc85b
Subproject commit e217b8a94e6cf1df28e4b9dcfd636cc5b55930b0
Supports Markdown
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