fix: import localized topics and flattened Sessionize speakers
This commit is contained in:
1 parent
5c93d4a0cb
commit
648daa0794
6 files changed
+226
-88
No files matched your search
+25
-6
@@ -5,8 +5,9 @@ The **sidecar** is a small Node HTTP service that syncs an event's agenda from
|
||||
component that holds the **service-role key**, and it is driven entirely by the
|
||||
APPE Admin **Interfaces** menu — it runs **on demand only** (no scheduling).
|
||||
|
||||
- Code: [`apps/sidecar/`](../../apps/sidecar/) (single file:
|
||||
[`src/server.js`](../../apps/sidecar/src/server.js))
|
||||
- Code: [`apps/sidecar/`](../../apps/sidecar/), HTTP service in
|
||||
[`src/server.js`](../../apps/sidecar/src/server.js), pure Excel transform in
|
||||
[`src/transform-excel.js`](../../apps/sidecar/src/transform-excel.js)
|
||||
- Image: [`apps/sidecar/Dockerfile`](../../apps/sidecar/Dockerfile)
|
||||
(`node:20-alpine`; runtime dependencies **`xlsx`** (parse the Sessionize Excel
|
||||
export) and **`pdfkit`** (render the PDF report) — everything else is built-in
|
||||
@@ -34,9 +35,12 @@ speaker emails, so this path imports sessions + agenda but **skips speakers**
|
||||
> registered **staff** member as a speaker.
|
||||
|
||||
**B. Excel import** (`POST /import-excel`) — the admin uploads the Sessionize
|
||||
**"Sessions and speakers (advanced)"** `.xlsx` export (generated on the fly by
|
||||
any organizer with admin access to the event). The sidecar parses it (two sheets:
|
||||
*Accepted sessions* + *Accepted speakers*) and calls the
|
||||
`.xlsx` export (generated on the fly by any organizer with admin access to the
|
||||
event). Supported formats are the legacy **"Sessions and speakers (advanced)"**
|
||||
export (two sheets: *Accepted sessions* + *Accepted speakers*, with plural
|
||||
**Speaker Ids**) and the flattened **Accepted sessions and speakers** sheet
|
||||
(one session/speaker pair per row, with singular **Speaker Id**). The sidecar
|
||||
parses it and calls the
|
||||
`sync_sessionize_excel` RPC, which imports, in order: (1) speakers as contacts
|
||||
(matched by **email** — the Excel carries emails, so this is reliable), (2)
|
||||
sessions + agenda (slots typed `session` / `service_session` from the
|
||||
@@ -47,6 +51,21 @@ registration for every speaker** (create, or update `attendee`→`speaker`; neve
|
||||
overrides `staff`/`sponsor`). This is the path that creates the missing speaker
|
||||
contacts + registrations.
|
||||
|
||||
Excel rows are grouped by **Session Id** into one session with all distinct
|
||||
speaker emails; repeated speakers are emitted once by email. Separate session
|
||||
and speaker sheets take precedence over a combined sheet if both are present.
|
||||
Sessions without a title, ID, or scheduled time are skipped as before.
|
||||
|
||||
Topic classification uses the first nonempty value of **Themenfeld / Area of
|
||||
Topic**, **Area**, then **Topic**. Headers are trimmed and matched
|
||||
case-insensitively; unrelated category headers are not inferred. Values are
|
||||
trimmed but otherwise preserved as a single string, including comma-separated
|
||||
topics in their original order. **Level** remains an optional free-text value.
|
||||
For repeated session rows, the first row supplies session metadata; a later
|
||||
nonempty topic can fill an initially empty topic, and speaker links are merged.
|
||||
See [Excel transform tests](./tests.md#sessionize-excel-transform) for the
|
||||
database-free regression command.
|
||||
|
||||
Linking a speaker to a session fires the `session_speakers_speaker_promote`
|
||||
trigger, which promotes an existing registration to `speaker`.
|
||||
|
||||
@@ -104,7 +123,7 @@ transforms, calls the RPC, and returns the summary. The admin's "Sync" button an
|
||||
the Interfaces "Run sync" both call it and show the result inline.
|
||||
|
||||
`/import-excel` is **blocking** too: it reads the uploaded `.xlsx` (parsed with
|
||||
`xlsx`), transforms the two sheets into the `sync_sessionize_excel` payload, and
|
||||
`xlsx`), transforms either supported format into the `sync_sessionize_excel` payload, and
|
||||
calls that RPC. The admin's Interfaces **"Import Excel"** control posts the file
|
||||
here and shows the result inline.
|
||||
|
||||
|
||||
@@ -131,6 +131,26 @@ cross-event slot/dependent mismatches fail atomically instead of cascading
|
||||
foreign-event rows. This is local validation only; it does not write migration
|
||||
history or deploy anything.
|
||||
|
||||
## Sessionize Excel Transform
|
||||
|
||||
The sidecar's [Excel transform tests](../../apps/sidecar/tests/transform-excel.test.js)
|
||||
use Node's built-in test runner and the installed `xlsx` dependency. They
|
||||
generate synthetic workbooks in memory, without real personal data, server
|
||||
startup, HTTP calls, or database access:
|
||||
|
||||
```bash
|
||||
npm test --prefix apps/sidecar
|
||||
node --check apps/sidecar/src/transform-excel.js
|
||||
node --check apps/sidecar/src/server.js
|
||||
```
|
||||
|
||||
Coverage includes the localized topic header, trimmed/case-insensitive header
|
||||
matching, nonempty Area/Topic fallback, complete comma-separated topic strings,
|
||||
flattened multi-speaker session grouping, duplicate speaker IDs/emails, singular
|
||||
Speaker Id fallback, legacy two-sheet plural Speaker Ids, scheduled time and
|
||||
metadata preservation, service-session classification, and unscheduled-row
|
||||
filtering. See [supported Excel formats](./sidecar.md#what-it-does).
|
||||
|
||||
## Files
|
||||
|
||||
- [`supabase/tests/rpc_tests.sql`](../../supabase/tests/rpc_tests.sql) — the test
|
||||
|
||||
Reference in new issue
Block a user