Commit 15906f39 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Add extractor for Impfzentren Bayern

Extract an event from a vaccination appointement confirmation.

The first shot isn't really tested since I only have mails for the
second shot
parent 59f1aba1
Pipeline #66966 passed with stages
in 12 minutes and 29 seconds
......@@ -58,6 +58,8 @@
<file>hotels.com.js</file>
<file>iberia.json</file>
<file>iberia.js</file>
<file>impfzentrum_bayern.json</file>
<file>impfzentrum_bayern.js</file>
<file>indico.json</file>
<file>indico.js</file>
<file>indigo.json</file>
......
/*
SPDX-FileCopyrightText: 2021 Nicolas Fella <nicolas.fella@gmx.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function main(content) {
var res = JsonLd.newEventReservation();
var splitted = content.split("\n")
var name = splitted[0].slice(0, -1)
res.reservationFor.name = name
var firstShot = splitted[4].match(/Erste Impfung: (.*) Uhr/)
var secondShot = splitted[4].match(/Zweite Impfung: (.*) Uhr/)
var theDate
if (firstShot) {
theDate = firstShot[1]
} else {
theDate = secondShot[1]
}
const address = JsonLd.newObject("PostalAddress")
address.addressCountry = "DE"
address.addressLocality = splitted[11].split(" ")[1]
address.addressRegion = "Bayern"
address.postalCode = splitted[11].split(" ")[0]
address.streetAddress = splitted[10]
res.reservationFor.location.address = address
res.reservationFor.startDate = JsonLd.toDateTime(theDate, "dd.MM.yyyy hh:mm", "de")
return res
}
{
"filter": [
{
"field": "From",
"match": "BayIMCO@impfzentren.bayern",
"mimeType": "message/rfc822",
"scope": "Ancestors"
}
],
"function": "main",
"mimeType": "text/plain",
"script": "impfzentrum_bayern.js"
}
Markdown is supported
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