diff --git a/src/data-requests/vaccination.ts b/src/data-requests/vaccination.ts index cb11cc1a..20fa1a88 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 @@ -600,23 +601,23 @@ export async function getVaccinationCoverage(): Promise< }); } ); - const apiUrlCommitsMain = new URL( - `https://api.github.com/repos/robert-koch-institut/COVID-19-Impfungen_in_Deutschland/commits/main` + // 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 apiResponse: { lastUpdate: Date; sha: string } = await GetApiCommit( - apiUrlCommitsMain.href, - apiUrlCommitsMain.pathname + 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, @@ -1164,7 +1165,7 @@ export async function getVaccinationCoverage(): Promise< return { data: coverage, - lastUpdate: lastUpdate, + lastUpdate: lastCommitData.lastUpdate, }; }