Check-in Calendar and Log

in ,
Estimated Reading Time: 3 minutes

Over the course of 2020 and 2021, different countries and regions imposed various levels of restrictions on gatherings. In Canada, employers were required to have employees work from home where possible. I have been working from home since March 2020, and work for a small business that has managed to coordinate the small number of workers who have been in the office. But I wondered about the experience of people who needed to safely coordinate their presence in a workplace or worksite. Locations that require restricted occupancy may have difficulty tracking when people enter and leave a location.

The idea is the Check-In Calendar, a web application that allows a company to define multiple locations, track check-ins, and set certain restrictions on occupancy. The information can be viewed after the fact.

Assumptions

  • Low-contact interactions are ideal
  • The solution relies on a certain amount of trust between employers and their workforce.
  • Checking in requires deliberate action by whomever is going the check-in.

Development

The project has been developed using Laravel 8, a popular framework. PDF generation was handled with mPDF, which is a pretty basic PDF library that is good enough for printed output. Choosing a QR code library was more difficult but there were several decent options, some of them overlapping one another. I settled on endroid/qr-code, and it worked well enough.

Implemented Features

A basic but incomplete set of features have been implemented. Part of the initial goal was to build enough to test the concept well enough to demonstrate.

  • User registration
  • Organization setup
  • Create location
  • Generate PDF

Unimplemented Features

There are a few additional features needed to complete basic functionality. The first is ensuring the check-in and check-out process is smooth and works with minimal user intervention. The check-in process should also respect the occupancy limit, possibly in one of several ways. The second is the reporting and data export that should be available to the organization administrator. The third is scheduling and calendar integration. Calendar integration would provide basic integration with one or several calendar systems.

  • Toggle check-in and check-in
  • Enforcing or warning on check-in limits
  • Reporting and data export
  • Calendar display
  • Calendar integration

Demo and Source

I created a staging site to host a demo of the app. Registration is open to create organizations and locations. Checking in requires scanning a QR code or inputting the company code and location code manually.

https://checkincalendar.com/

The source code is available on GitHub. It’s an open source project.

https://github.com/revnoah/checkincalendar

QR Code

Generating a QR code with this library is pretty simple. I created a private function to handle this, setting a few functions.

    private function generateQrCode(string $url, int $size = 300) {
        $writer = new PngWriter();

        // Create QR code
        $qrCode = QrCode::create($url)
            ->setEncoding(new Encoding('UTF-8'))
            ->setErrorCorrectionLevel(new ErrorCorrectionLevelLow())
            ->setSize($size)
            ->setMargin(10)
            ->setRoundBlockSizeMode(new RoundBlockSizeModeMargin())
            ->setForegroundColor(new Color(0, 0, 0))
            ->setBackgroundColor(new Color(255, 255, 255));

        $result = $writer->write($qrCode);
        
        return $result;
    }   

PDF Output

Generating the PDF was pretty simple. There weren’t many elements I needed to add.

    public function pdf(Location $location)
    {
        $qrCode = $this->generateQrCode($location->url, 360);

        header("Content-Type: application/pdf");

        $mpdf = new Mpdf(['tempDir' => '/tmp/pdf']);
        $mpdf->SetTitle($location->name);
        $mpdf->SetSubject($location->description);

        $mpdf->WriteHTML('<h1 align="center">' . $location->name . '</h1>');
        $mpdf->WriteHTML('<p align="center">' . $location->description . '</p>');
        $mpdf->Image($qrCode->getDataUri(), 55, 60);
        $mpdf->WriteHTML('<p align="center">' . $location->code . '</p>');
        $mpdf->WriteHTML('<p align="center">' . $location->url . '</p>');

        $mpdf->Output();

        exit;
    }

Screenshots

Screenshot of locations within an organization

An organization has a title, code, description and locations

Screenshot of the add a location form
a user can create one or more locations
Screenshot of the checkin form and QR code
Each location has a secret code
Export of the printable PDF with QR code

A custom PDF can be generated for each location. The PDF would then be printed out and displayed in a convenient but reasonably secure location.