zetkin / app.zetkin.org

Current-generation ("Gen 3") web interface for the Zetkin Platform.
https://app.dev.zetkin.org
24 stars 54 forks source link

Event sign-up sheet RFC #2120

Open lewisbelcher opened 2 months ago

lewisbelcher commented 2 months ago

Description

A user should be able to:

  1. Select events in the calendar and click a button to create an event sign-up sheet that can be printed and distributed at physical meetings
  2. Scan filled in sign-up sheets using desktop/mobile and have the relevant checked fields auto-filled in a page which can then be attributed with a user and the user will be enrolled in those events

Part 1 is useful as a standalone feature.

The intention for part 2 (scanning the sign-up sheets) is to encode selected event IDs in a QR code and include this in a corner of the sign-up sheet. This QR code can then be used to not only communicate which events are present on the page and in what order, but also to locate the document and, in turn, locate relevant checkboxes and identify whether they have been checked.

QR code creation

At the moment is assumed that only event IDs need to be encoded in the QR code, but this may be extended in the future.

What size QR code do we need?

Estimated issue size

I think this issue is large because it involves implementing new, non-trivial functionality (document creation, QR encoding, computer vision).

Prerequisites

All platform-related prerequisites are already met.

Requirements

Possible implementations

Entirely JS based

Webassembly

Webassembly could be explored as an alternative to JS.

Design specifications

TODO

Open questions

lewisbelcher commented 1 month ago

Extra questions / things to consider:

lewisbelcher commented 1 month ago

After some exploration, here is a script that should produce a QR for a list of 30 Uint64 IDs:

const pako = require('pako');
const QRCode = require('qrcode');

// Some example IDs:
const arr = new BigUint64Array([1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n, 10n, 11n, 12n, 13n, 14n, 15n, 16n, 17n, 18n, 19n, 20n, 21n, 22n, 23n, 83383n, 123n, 9999n, 18446744073709551613n, 111n, 123n, 678n]);

// Compress these IDs using pako:
const compressed = pako.deflate(arr.buffer);

// Test decompressing to check that the ouput is the same:
const uncompressed = pako.inflate(compressed);
const uncompressed_arr = new BigUint64Array(uncompressed.buffer);

// Create a QR code:
QRCode.toFile(
  'qr-code.png',
  [{data: compressed.buffer, mode: 'byte' }],
  { version: 7 },
  function (err, url) {
    console.log(url)
})
lewisbelcher commented 1 month ago

Extra questions / things to consider:

* How do we deal with multi-day events? They have the same ID across multiple days. At the moment we'll need to just assume attendance to one day implies attendance to all days

* Event clusters in general and multi-shift events? How can we adjust for these?
johanbook commented 1 month ago

Example of QR code generated in Zetkin calendar

screenshot_2024-09-29_09-09-1727595523