From 5c6768bd4a687b2957ec4d25d799a80b2d6378d8 Mon Sep 17 00:00:00 2001 From: Peter Markewitz Date: Tue, 10 Oct 2023 07:08:53 +0000 Subject: [PATCH 1/4] add new vaccine "Comirnaty Omicron XBB.1.5" mapped to "biontechBivalent" --- src/data-requests/vaccination.ts | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/data-requests/vaccination.ts b/src/data-requests/vaccination.ts index cb11cc1a..370d111f 100644 --- a/src/data-requests/vaccination.ts +++ b/src/data-requests/vaccination.ts @@ -72,22 +72,23 @@ enum UVD { V10 = "deltaVidPrevtynBeta", } -// VaccineNameReverse +// VaccineNameMapping enum VNR { - "Vaxzevria" = "astraZeneca", - "Comirnaty" = "biontech", - "Jcovden" = "janssen", - "Spikevax" = "moderna", - "Nuvaxovid" = "novavax", - "Valneva" = "valneva", - "Comirnaty bivalent (Original/Omikron)" = "biontechBivalent", - "Spikevax bivalent (Original/Omikron)" = "modernaBivalent", - "Comirnaty-Kleinkinder" = "biontechInfant", - "Comirnaty Original/Omicron BA.1" = "biontechBivalent", - "Comirnaty Original/Omicron BA.4-5" = "biontechBivalent", - "Spikevax bivalent Original/Omicron BA.1" = "modernaBivalent", - "Spikevax bivalent Original/Omicron BA.4-5" = "modernaBivalent", - "VidPrevtyn Beta" = "vidPrevtynBeta", + "Vaxzevria" = UV.V1, + "Comirnaty" = UV.V2, + "Jcovden" = UV.V3, + "Spikevax" = UV.V4, + "Nuvaxovid" = UV.V5, + "Valneva" = UV.V6, + "Comirnaty bivalent (Original/Omikron)" = UV.V7, + "Spikevax bivalent (Original/Omikron)" = UV.V8, + "Comirnaty-Kleinkinder" = UV.V9, + "Comirnaty Original/Omicron BA.1" = UV.V7, + "Comirnaty Original/Omicron BA.4-5" = UV.V7, + "Spikevax bivalent Original/Omicron BA.1" = UV.V8, + "Spikevax bivalent Original/Omicron BA.4-5" = UV.V8, + "VidPrevtyn Beta" = UV.V10, + "Comirnaty Omicron XBB.1.5" = UV.V7 } // UsedAgeGroups From dd6eb3ac9469d22d965b5e29202139382d469df7 Mon Sep 17 00:00:00 2001 From: Peter Markewitz Date: Tue, 10 Oct 2023 07:31:15 +0000 Subject: [PATCH 2/4] fix linting --- src/data-requests/vaccination.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data-requests/vaccination.ts b/src/data-requests/vaccination.ts index 370d111f..b97d49d0 100644 --- a/src/data-requests/vaccination.ts +++ b/src/data-requests/vaccination.ts @@ -88,7 +88,7 @@ enum VNR { "Spikevax bivalent Original/Omicron BA.1" = UV.V8, "Spikevax bivalent Original/Omicron BA.4-5" = UV.V8, "VidPrevtyn Beta" = UV.V10, - "Comirnaty Omicron XBB.1.5" = UV.V7 + "Comirnaty Omicron XBB.1.5" = UV.V7, } // UsedAgeGroups From 750e5caf5bddfe459cebadedfa5df11e78c0f243 Mon Sep 17 00:00:00 2001 From: Peter Markewitz Date: Tue, 10 Oct 2023 10:06:09 +0000 Subject: [PATCH 3/4] fix lastUpdate --- src/data-requests/vaccination.ts | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/data-requests/vaccination.ts b/src/data-requests/vaccination.ts index b97d49d0..9343d9c4 100644 --- a/src/data-requests/vaccination.ts +++ b/src/data-requests/vaccination.ts @@ -601,23 +601,18 @@ export async function getVaccinationCoverage(): Promise< }); } ); - const apiUrlCommitsMain = new URL( - `https://api.github.com/repos/robert-koch-institut/COVID-19-Impfungen_in_Deutschland/commits/main` - ); - const apiResponse: { lastUpdate: Date; sha: string } = await GetApiCommit( - apiUrlCommitsMain.href, - apiUrlCommitsMain.pathname + // get last commit of Deutschland_Bundeslaender_COVID-19-Impfungen.csv + const apiDBUrl = new URL("https://api.github.com/repos/robert-koch-institut/COVID-19-Impfungen_in_Deutschland/commits?path=Deutschland_Bundeslaender_COVID-19-Impfungen.csv"); + const lastCommitData: {lastUpdate: Date, sha: string} = await GetApiCommit( + apiDBUrl.href, + apiDBUrl.pathname ).then((apiData) => { - const lastUpdate = new Date(apiData.commit.author.date); - const sha = apiData.sha; - return { lastUpdate, sha }; + return {lastUpdate: new Date (apiData[0].commit.author.date), sha: apiData[0].sha} }); - const lastUpdate = apiResponse.lastUpdate; - const sha = apiResponse.sha; - - // finde den letzten Datansatz bevor dem aktuellen + + // finde den letzten Datansatz vor dem aktuellen const apiUrlTreesSha = new URL( - `https://api.github.com/repos/robert-koch-institut/COVID-19-Impfungen_in_Deutschland/git/trees/${sha}` + `https://api.github.com/repos/robert-koch-institut/COVID-19-Impfungen_in_Deutschland/git/trees/${lastCommitData.sha}` ); const filesResponse = await GetApiTrees( apiUrlTreesSha.href, @@ -1165,7 +1160,7 @@ export async function getVaccinationCoverage(): Promise< return { data: coverage, - lastUpdate: lastUpdate, + lastUpdate: lastCommitData.lastUpdate, }; } From fc30758dfe90ad869baa3e5c72039497703d1fd7 Mon Sep 17 00:00:00 2001 From: Peter Markewitz Date: Tue, 10 Oct 2023 10:07:05 +0000 Subject: [PATCH 4/4] fix linting --- src/data-requests/vaccination.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/data-requests/vaccination.ts b/src/data-requests/vaccination.ts index 9343d9c4..20fa1a88 100644 --- a/src/data-requests/vaccination.ts +++ b/src/data-requests/vaccination.ts @@ -602,14 +602,19 @@ export async function getVaccinationCoverage(): Promise< } ); // get last commit of Deutschland_Bundeslaender_COVID-19-Impfungen.csv - const apiDBUrl = new URL("https://api.github.com/repos/robert-koch-institut/COVID-19-Impfungen_in_Deutschland/commits?path=Deutschland_Bundeslaender_COVID-19-Impfungen.csv"); - const lastCommitData: {lastUpdate: Date, sha: string} = await GetApiCommit( + const apiDBUrl = new URL( + "https://api.github.com/repos/robert-koch-institut/COVID-19-Impfungen_in_Deutschland/commits?path=Deutschland_Bundeslaender_COVID-19-Impfungen.csv" + ); + const lastCommitData: { lastUpdate: Date; sha: string } = await GetApiCommit( apiDBUrl.href, apiDBUrl.pathname ).then((apiData) => { - return {lastUpdate: new Date (apiData[0].commit.author.date), sha: apiData[0].sha} + return { + lastUpdate: new Date(apiData[0].commit.author.date), + sha: apiData[0].sha, + }; }); - + // finde den letzten Datansatz vor dem aktuellen const apiUrlTreesSha = new URL( `https://api.github.com/repos/robert-koch-institut/COVID-19-Impfungen_in_Deutschland/git/trees/${lastCommitData.sha}`