Skip to content

Commit

Permalink
added estimatedReportedAndUnreportedCases
Browse files Browse the repository at this point in the history
  • Loading branch information
frievoe97 committed Dec 18, 2024
1 parent 6fe9f6e commit 122e4e9
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/views/v2/V2RunViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@
:seedComparison="seedComparison"
:showSeedComparison="showSeedComparison"
:city="city"
:estimatedReportedAndUnreportedCases="estimatedReportedAndUnreportedCases"
)

//- ---------- VIRUS STRAINS -------
Expand Down Expand Up @@ -673,6 +674,7 @@ export default defineComponent({
unreportedIncidence: [] as any[],
unreportedIncidenceNRW: [] as any[],
estimatedReportedAndUnreportedCases: [] as any[],
currentSituation: {} as any,
loadedSeriesData: {} as any,
Expand Down Expand Up @@ -1139,6 +1141,7 @@ export default defineComponent({
cityCap() {
this.loadUnreportedIncidence()
this.loadUnreportedIncidenceNRW()
this.loadEstimatedReportedAndUnreportedCases()
},
async '$store.state.isWideMode'() {
Expand Down Expand Up @@ -1842,6 +1845,32 @@ export default defineComponent({
}
},
async loadEstimatedReportedAndUnreportedCases() {
if (this.cityCap == 'Cologne') {
const url =
'https://svn.vsp.tu-berlin.de/repos/public-svn/matsim/scenarios/countries/de/episim/original-data/Fallzahlen/MaxvonKleist/EstimatedCasesMaxvonKleist.csv'
try {
const response = await fetch(url)
const csvContents = await response.text()
this.estimatedReportedAndUnreportedCases = Papa.parse(csvContents, {
header: true,
dynamicTyping: true,
skipEmptyLines: true,
}).data
this.estimatedReportedAndUnreportedCases = this.estimatedReportedAndUnreportedCases.map(
element => ({
min_n_true: element.min_n_true,
date: element.date,
})
)
} catch (e) {
console.warn(e)
}
}
},
async loadUnreportedIncidence() {
if (this.cityCap == 'Cologne') {
const url =
Expand Down
38 changes: 37 additions & 1 deletion src/views/v2/WeeklyInfectionsPlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default defineComponent({
seedComparison: { type: Array as PropType<any[]>, required: true },
unreportedIncidence: { type: Array as PropType<any[]>, required: true },
unreportedIncidenceNRW: { type: Array as PropType<any[]>, required: true },
estimatedReportedAndUnreportedCases: { type: Array as PropType<any[]>, required: true },
rkiDetectionData: {
type: Object as PropType<{
x?: any[]
Expand Down Expand Up @@ -438,6 +439,41 @@ export default defineComponent({
this.calculateUnreportedNRW()
},
addEstimatedReportedAndUnreportedCases() {
const totalPopulation = 82000000
const incidencePer100k = 100000
if (!this.estimatedReportedAndUnreportedCases.length) return
const estimatedReportedAndUnreportedCases: any = {
type: 'scatter',
mode: 'markers',
marker: { size: 4, color: '#ff0000' },
x: [] as any,
y: [] as any,
}
let sumMinNTrue = 0
for (let i = 3; i + 3 < this.estimatedReportedAndUnreportedCases.length; i = i + 7) {
for (let j = i - 3; j < i + 4; j++) {
sumMinNTrue += this.estimatedReportedAndUnreportedCases[j].min_n_true
}
estimatedReportedAndUnreportedCases.x.push(this.estimatedReportedAndUnreportedCases[i].date)
estimatedReportedAndUnreportedCases.y.push(
sumMinNTrue / (totalPopulation / incidencePer100k)
)
sumMinNTrue = 0
}
estimatedReportedAndUnreportedCases.name =
'Estimated Reported and Unreported Cases (Germany, XX et al.)'
estimatedReportedAndUnreportedCases.visible = true
this.dataLines.push(estimatedReportedAndUnreportedCases)
},
calculateSeedComparison(factor100k: number) {
if (this.seedComparison.length == 0) return
Expand Down Expand Up @@ -652,8 +688,8 @@ export default defineComponent({
if (this.rkiDetectionData.x) this.dataLines.push(this.rkiDetectionData)
this.calculateSeedComparison(factor100k)
this.calculateObserved(factor100k)
this.addEstimatedReportedAndUnreportedCases()
},
reformatDate(day: string) {
Expand Down

0 comments on commit 122e4e9

Please sign in to comment.