Repository navigation
Description
The goal
A regional manager can bring all of a region's classes into the atlas in one step, from a spreadsheet, instead of entering them one by one.
Why it matters
Onboarding a new region means typing in dozens of classes by hand. That is slow, it introduces mistakes, and it delays the launch of every new region.
What success looks like
- A manager who looks after a region sees an Import button on their own country, state or city — and not on a region someone else looks after.
- They download a template, fill it in and upload it, and their region's classes appear as drafts they publish from the import's own page.
- Before any class goes on the map they see what happened: how many classes were added as drafts, which rows were skipped, and why.
- Every imported class appears in the town its row names. A row whose address cannot be found is reported, never placed somewhere approximate.
- A file with some bad rows still imports the good ones, and the manager keeps a list of exactly which rows were skipped and why.
- Importing the same file twice adds nothing the second time.
- If an upload stops half way, the manager can pick it up where it left off, and no class is created twice.
- Classes with nobody named to look after them are marked as unconfirmed when the manager publishes them.
- A manager who looks after a region sees Import whichever language they are working in.
- Paid permanent lookups are switched on for the account the live site uses, so we are allowed to keep the location data the import stores. (Ardnived checks this on the Mapbox account, 2026-11-18.)
Not included
- Ongoing syncing with an outside system. This is a one-time import.
- Editing rows on the review screen. A manager corrects the spreadsheet and uploads it again.
- Undoing a whole import in one step. A wrongly imported class is removed on its own.
- Importing photos for a class or a venue.
- Reorganising a region's places after the import — moving or merging them.
- Building out a region's towns from the file. A row whose town has no place in the atlas yet is skipped; the manager creates that town from the import's own page and uploads the skipped rows again.
- Correcting the location data stored before this goal existed. New lookups are kept the way we are allowed to keep them; the older entries are rewritten the next time a region is refreshed.
- Keeping large regions fast in the widget once hundreds of classes exist. That belongs to The whole atlas loads, and keeps loading as it grows #256.
- Replacing a matching class from the file. A duplicate row is skipped. (Dropped at close, 2026-11-18.)
- Emailing a region's other managers when an import adds classes there. Only the person who uploaded is emailed. (Dropped at close, 2026-11-18.)
Decisions
- Should classes imported with nobody named to look after them still be published? → Yes, published and marked as unconfirmed, with the notice on the class page only (Ardnived, 2026-09-21)
- Should the import set up accounts for the coordinators named in the spreadsheet? → Yes. Whether to invite them is a choice the manager makes per import, and a coordinator who is invited gets one email covering everything they were given, not one per class (Ardnived, 2026-10-06)
- How large a file must we support? → Up to 500 classes at a time. A bigger region is imported in more than one file (Ardnived, 2026-09-21)
- How do we earn the right to keep the places the import looks up? → Turn on paid permanent lookups on the account we already use. It needs a card on file or a contract, and costs more than temporary lookups. (Ardnived, 2026-10-21)
- May an import replace a class that is already in the atlas? → Not built, and dropped at close: a duplicate row is skipped. (Ardnived, 2026-11-18; was: the manager may choose to replace, but only classes nobody else looks after, 2026-10-21)
- Should a region's own managers be told when an import adds classes to their region? → Not built, and dropped at close: only the uploader is emailed. (Ardnived, 2026-11-18; was: yes, they get an email summary, 2026-10-21)
- The import adds every class as an unpublished draft that the manager publishes one by one. Is that what we want? → Yes, keep the drafts; the success lines are reworded to match. (Ardnived, 2026-11-18)
- Should a manager who looks after a region in one language be able to import in the other languages too? → Yes, every language. "We don't operate the Atlas on a per-language basis, none of the collections are generally localized." Already true: Atlas roles are derived from region ownership and held in every locale (feat(access): derive Atlas roles from region and event ownership SahajCloud#1068). (Ardnived, 2026-11-18)
Open questions
None.
Notes
Built as sydevs/SahajCloud#907 and shipped in sydevs/SahajCloud PR #912. The first attempt, sydevs/SahajCloud#828 and its PR #874, was abandoned unmerged. The right to keep the places an import looks up was settled in sydevs/SahajCloud#893, shipped in sydevs/SahajCloud PR #1150.
Related: #256. The atlas side of this goal, marking unconfirmed classes, shipped in #220.
Technical notes
TL;DR
- Built and merged: the import is
src/plugins/eventImport/(SahajCloud#907, PR feat(events): CSV class import as a Payload collection driven by jobs SahajCloud#912) — CSV → one draft class per row → a review page the volunteer publishes from. The storage right is SahajCloud#893, PR fix(mapbox): move every stored geocode to Geocoding v6 permanent SahajCloud#1150. - Risky: nothing here proves the live Mapbox account carries paid permanent geocoding. Without it every row returns refused and no import works.
- Closed 2026-11-18: the lines now describe drafts, which is what shipped; replace and the region-manager email were dropped.
Each success line against what is on main
| Line | State | Evidence |
|---|---|---|
| 1 Import where they manage, nowhere else | met | Regions.ts:128 edit menu, :361 Events-tab label; useImportClassesTarget.ts hides venues, unsaved regions and anyone without imports: create; targetRegion.ts picker and validator take the owned subtree only; importCollection.ts inEditableRegion scopes read and delete |
| 2 template → upload → on the map | extra step | public/event-import-template.csv, linked by TemplateLink.tsx; eventData.ts:71 writes _status: 'draft', so the volunteer publishes |
| 3 see it before anything is saved | changed | no pre-save pass: task.ts creates, then finish.ts writes results and ImportResultsTable.tsx lists created / duplicate / error with reasons |
| 4 right town, never approximate | met | prepare.ts prepareRow makes a geocode miss a row error; placeRow skips a town with no city region and names it |
| 5 good rows land, skipped list kept | met | results carries reasons and the row as uploaded; ImportResultsTable.tsx:170 downloads them as a CSV |
| 6 same file twice adds nothing | met | refuseDuplicateClass.ts counts drafts, and date + startTime are required columns, so every imported row has the schedule identity the check needs |
| 7 may replace a class nobody owns | no code | prepare.ts placeRow always skips a twin; nothing in the plugin updates an existing event |
| 8 region's managers emailed | no code | summaryEmail.ts sends one mail to the uploader; digests are unscheduled (SendDigests.ts:91) |
| 9 interrupted upload, no double class | met by re-upload | finish.ts failLostImports fails a lost run, drafts stay, the duplicate rule skips them next time |
| 10 unowned class published, unconfirmed | marked only | newEventDefaults sets verificationStage: 'unverified'; eventData.ts:71 overrides _status to draft |
| 11 Import in any language | met | imports: create is events: create in the request's locale (requireManagerPermission.ts), but atlas-region-manager is a derived role held in every configured locale (SahajCloud#1068, docs/rules/access.md "Roles nobody assigns") |
| 12 permanent lookups on the live account | code only | geocoder.ts:197 sends permanent: 'true' on every stored lookup; the account entitlement is not readable here |
Where the code sits
| Piece | Module |
|---|---|
| Collection, access, upload parse, job queue | src/plugins/eventImport/importCollection.ts |
| The job | src/plugins/eventImport/task.ts, prepare.ts, regions.ts |
| Row → class | src/plugins/eventImport/eventData.ts, csv/ |
| Outcome, status, uploader mail | finish.ts, results.ts, summaryEmail.ts |
| Review page | src/components/admin/EventImport/, JobStageView |
| Duplicate rule | src/collections/Events/hooks/refuseDuplicateClass.ts |
Caps: 500 rows, geocode concurrency 4, 30-day retention, 15-minute stall (constants.ts). The CSV is parsed at upload and never stored.
Plans that were replaced, and residual risks
- SahajCloud#828 and PR feat(events): bulk-import events into a region from CSV SahajCloud#874 were abandoned on 2026-10-10, not merged. SahajCloud#907 replaced them, and what shipped also dropped #907's own region-tree proposal: a town with no city region is skipped, and the review page offers to create that city.
- The Search Box
/retrieveround-trip this goal once carried is gone — SahajCloud#893 moved every stored lookup to Geocoding v6 and no reader resolves a stored id. src/plugins/login/invitations.tsenqueueis still a read-modify-write with no lock. The import creates rows one at a time in their own transactions and builds the manager roster once, so only two imports running at once could race it.- Lens split from the 2026-10-08 review: one lens urged moving this goal to SahajCloud, two urged keeping it here. Keeping holds — the milestone is here.
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
sydevs-bot commentedon Oct 8, 2026
🤖 no session running
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.
sydevs-bot commentedon Oct 8, 2026
⚠ Unchecked, and it gates the merge. sydevs/SahajCloud#874 writes a Geocoding v6 id onto
Events.address.mapboxId, whichAddressSearchFieldresolves through Search Box/retrieve. If a v6 id does not retrieve, every imported address stops resolving in the admin. sydevs/SahajCloud#893 asks this ofRegionsonly. No Mapbox token here to settle it.For that PR's reviewer. sydevs/SahajCloud#828's criteria say duplicates are "always skipped" and "no existing event is modified"; the branch ships skip/import/overwrite. Q2 settles which; the ticket needs rewriting either way. Phases 6b/6c also left five known holes unticketed, believing a routine may not file —
start-runsays a run with nobody to ask files them.Risk.
login/invitations.tsenqueues with a non-atomic read-modify-write, documented safe because "the admin assigns one thing at a time". A bulk import is not that.Lens split. One lens urged moving this goal to SahajCloud; two urged keeping it. Keeping holds — the milestone is here.
🤖 Written by the sydevs autonomous loop — see what this is
sydevs-bot commentedon Oct 8, 2026
This goal is already built — it needs three answers, not a plan. The work is sydevs/SahajCloud#828, code-complete in sydevs/SahajCloud#874 and awaiting your review.
I rewrote the success criteria so each is checkable in a browser, added five exclusions, recorded three decisions you had already made, and raised three questions.
What I need from you, in
## Open questions:Reply
@sydevs-bot revise 1C 2B 3A, or in your own words.Once nothing is open,
@sydevs-bot implementplans implementation tickets — but here that would plan work the PR already contains. Reviewing it is the shorter path.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Ardnived commentedon Oct 21, 2026
Answered in the terminal by @Ardnived:
sydevs-bot commentedon Nov 14, 2026
Shipped, with seven lines still open. The import is live on
main. sydevs/SahajCloud#907 built it (PR #912), and sydevs/SahajCloud#893 settled our right to keep the places it looks up (PR #1150). I attached #907 to this goal. The first attempt, #828, was abandoned unmerged.Five of the twelve success lines are met, and I ticked those. Missing:
Three lines say an import publishes. The code creates drafts the manager then publishes. Question 1 settles that. Question 2 settles whether Import follows the languages a manager was given.
Answer in
## Open questions:@sydevs-bot revise 1A 2A. Then@sydevs-bot implementplans what is missing.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Ardnived commentedon Nov 18, 2026
Answered in the terminal by @Ardnived:
main: Atlas roles are derived from region ownership and held in every locale (feat(access): derive Atlas roles from region and event ownership SahajCloud#1068).## Not included.Closing as completed with the Sahaj Atlas launch milestone.