Skip to content

Commit

Permalink
added brandenburg rki incidence
Browse files Browse the repository at this point in the history
  • Loading branch information
frievoe97 committed Sep 2, 2024
1 parent 695cf07 commit 6fa9345
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions src/views/v2/WeeklyInfectionsPlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ export default class VueComponent extends Vue {
private unselectedLines: string[] = []
private observedSewageData: any[] = []
private brandenburgIncidence: any[] = []
private async mounted() {
await this.fetchSewageData()
if (this.city === 'brandenburg') await this.fetchBrandenburgIncidenceData()
this.calculateValues()
this.unselectLines()
}
Expand Down Expand Up @@ -141,6 +143,59 @@ export default class VueComponent extends Vue {
}
}
private async fetchBrandenburgIncidenceData() {
const URL =
PUBLIC_SVN + 'original-data/Fallzahlen/RKI/COVID-19-Faelle_7-Tage-Inzidenz_Bundeslaender.csv'
const BRANDENBURG_ID = 16
try {
const raw = await fetch(URL).then(response => response.text())
const csv = Papaparse.parse(raw, {
header: true,
dynamicTyping: true,
skipEmptyLines: true,
}).data
const brandenburgIncidence = csv.filter(
f => f.Bundesland_id === BRANDENBURG_ID && f.Altersgruppe === '00+'
)
const updatedArray = brandenburgIncidence.map(obj => {
const newObj = { ...obj }
delete newObj.Bevoelkerung
delete newObj.Bundesland_id
delete newObj['Faelle_7-Tage']
delete newObj.Faelle_gesamt
delete newObj.Faelle_neu
delete newObj.Altersgruppe
return newObj
})
const incidenceLine: any = {
name: 'RKI Brandenburg Incidence',
visible: true,
type: 'scatter',
mode: 'markers',
marker: { size: 3 },
line: {
width: 3,
color: '#080',
dash: 'dot',
},
}
incidenceLine.visible = true
incidenceLine.x = updatedArray.map(row => row.Meldedatum)
incidenceLine.y = updatedArray.map(row => row['Inzidenz_7-Tage'])
this.brandenburgIncidence = [incidenceLine]
} catch (e) {
console.error('Could not load ' + URL)
console.error('' + e)
}
}
private async fetchSewageData() {
const cleanedDataByCity: any = {
cologne: 'CologneSewageDataCleaned.csv',
Expand Down Expand Up @@ -517,6 +572,10 @@ export default class VueComponent extends Vue {
if (this.observedSewageData.length) this.dataLines.push(this.observedSewageData[0])
if (this.observedSewageData.length > 1) this.dataLines.push(this.observedSewageData[1])
// console.log('brandenburgIncidence:', this.brandenburgIncidence)
if (this.city === 'brandenburg' && this.brandenburgIncidence.length)
this.dataLines.push(this.brandenburgIncidence[0])
// add RKI detection data if it exists
if (this.rkiDetectionData.x) this.dataLines.push(this.rkiDetectionData)
Expand Down

0 comments on commit 6fa9345

Please sign in to comment.