DormSoup / dormsoup-daemon

Parse the emails and add them to database
MIT License
1 stars 0 forks source link

Some events don't have tags #2

Open lad6558 opened 3 weeks ago

lad6558 commented 3 weeks ago

For some reason, some events do not have tags. There must be something unreliable about our new parsing pipeline.

image
lad6558 commented 1 day ago

This is reproduced by forwarding an email to the daemon. There is a line in emailToEvents.ts that throws an error if the event we are supposed to tag is not found:

      // Fetching the event that should've been created if event(s) were extracted to add tags
      const event = await prisma.event.findFirst({
        where: {
          fromEmailId: email.messageId
        }
      });
      if (event === null) {
        console.error("Event from email was not found in the database. Exiting...");
        return;
      }
Oct 02 22:53:44 dormdigest npm[1443107]: Got email, subject: "Fw: [AMPHIBZ] ERGATHON" sending to processNewEmail.
Oct 02 22:53:44 dormdigest npm[1443107]: Subject Fw: [AMPHIBZ] ERGATHON uid -214425796
Oct 02 22:53:46 dormdigest npm[1443107]: Found events in email: Fw: [AMPHIBZ] ERGATHON
Oct 02 22:53:46 dormdigest npm[1443107]: Event  {
Oct 02 22:53:46 dormdigest npm[1443107]:   title: '[AMPHIBZ] Ergathon',
Oct 02 22:53:46 dormdigest npm[1443107]:   dateTime: 2024-10-04T10:00:00.000Z,
Oct 02 22:53:46 dormdigest npm[1443107]:   location: 'Kresge Patio',
Oct 02 22:53:46 dormdigest npm[1443107]:   organizer: 'Amphibious Achievement',
Oct 02 22:53:46 dormdigest npm[1443107]:   duration: 360
Oct 02 22:53:46 dormdigest npm[1443107]: }  inserted
Oct 02 22:53:46 dormdigest npm[1443107]: E
Oct 02 22:53:46 dormdigest npm[1443107]:  New email was of type: dormspam-with-event
Oct 02 22:53:46 dormdigest npm[1443107]: Email was successfully processed and event(s) were extracted. Adding tags...
Oct 02 22:53:46 dormdigest npm[1443107]: Event from email was not found in the database. Exiting...