@smartkomm/plexus-cli 0.1.55 → 0.1.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 1ed5070d7cbff352d903acdca4edb9f6b05c7b72c0f3872a12ba45d89379f84e
1
+ e6ba1aa3ec616859e2f90fea8f92cb4bd5f5d1490176fbc4983bdfd72a3d8cf5
@@ -224,6 +224,7 @@ whole is the operator's (ask them; do not try).
224
224
  | [offer/upgrade-bundle.md](references/offer/upgrade-bundle.md) | Mandant | Upgrade a bundle exported in an older format, answering what it will not guess. |
225
225
  | [offer/wire-contract-generator.md](references/offer/wire-contract-generator.md) | Mandant + Plattform | Pin a contract generator or package, cockpit fields, export form fields, re-stamp formExports, test the new version. |
226
226
  | [offer/workflow-default-channels.md](references/offer/workflow-default-channels.md) | Mandant | Fixed team chat channels for every application of an offer. |
227
+ | [persons/import-persons-from-csv.md](references/persons/import-persons-from-csv.md) | Mandant | Import pupils, their guardians and class enrollments from a person list (CSV + mapping file). |
227
228
  | [persons/purge-deleted-person.md](references/persons/purge-deleted-person.md) | Plattform | Delete a soft-deleted person for good. |
228
229
  | [platform/rename-tenant.md](references/platform/rename-tenant.md) | Plattform | Change a tenant's slug and display name in place, then its accounts' addresses. |
229
230
  | [resolver/manage-contract-package.md](references/resolver/manage-contract-package.md) | Mandant + Plattform | Create, review and seal a contract package from one file by key. |
@@ -1,7 +1,7 @@
1
1
  # plexus-cli command reference
2
2
 
3
3
  Generated from the commands the CLI registers — do not edit; `plexus-cli <command> --help` prints the same.
4
- 287 commands. Every network command also takes `--env <local|staging|prod>`, `--tenant <slug>`,
4
+ 288 commands. Every network command also takes `--env <local|staging|prod>`, `--tenant <slug>`,
5
5
  `--json` (raw JSON instead of a table) and `--allow-prod` (required for a writing run against production).
6
6
 
7
7
  - [Admission (offline)](#admission-offline) (1)
@@ -30,7 +30,7 @@ Generated from the commands the CLI registers — do not edit; `plexus-cli <comm
30
30
  - [Operations (offline)](#operations-offline) (1)
31
31
  - [Organisation (school token)](#organisation-school-token) (8)
32
32
  - [Persons (platform operator)](#persons-platform-operator) (1)
33
- - [Persons (school token)](#persons-school-token) (1)
33
+ - [Persons (school token)](#persons-school-token) (2)
34
34
  - [Platform (platform operator)](#platform-platform-operator) (6)
35
35
  - [Setup (platform operator)](#setup-platform-operator) (5)
36
36
  - [Signing (platform operator)](#signing-platform-operator) (5)
@@ -3040,6 +3040,19 @@ Hard-delete a person staff already deleted, with everything that belongs to it (
3040
3040
 
3041
3041
  ## Persons (school token)
3042
3042
 
3043
+ ### `persons import`
3044
+
3045
+ Bring persons in from a file: the row's person, related persons with their edges, the class enrollment — by stable key, plan unless --confirm.
3046
+
3047
+ - **Right:** school token — a module permission inside one school (the school's own administrator runs it)
3048
+ - **Effect:** plan by default — writes only with `--confirm` (and `--env`; on production also `--allow-prod`)
3049
+
3050
+ | Option | Description |
3051
+ |---|---|
3052
+ | `--file <value>` (required) | The person list (CSV, header row, the mapping's delimiter). |
3053
+ | `--mapping <value>` (required) | The mapping file (JSON): key column, fields and roles of the row's person and of each related block, edges, enrollment; every other column ignored with a reason. |
3054
+ | `--confirm` | Write (else the plan only). |
3055
+
3043
3056
  ### `persons list`
3044
3057
 
3045
3058
  Search persons in the active tenant
@@ -0,0 +1,105 @@
1
+ # Import pupils and their guardians from a person list
2
+
3
+ **When to use:** a school hands over its pupil list from its previous
4
+ administration system (CSV, one pupil per row, the guardians in column blocks
5
+ such as `VP1…`/`VP2…`, the class in its own columns) and the pupils, their
6
+ guardians, the relationship between them and each pupil's class should exist in
7
+ Plexus — with the school's own token, no platform step.
8
+
9
+ ## Prerequisites
10
+ - A token of the school's administrator: `stammdaten.parties.write` held
11
+ school-wide, and `administration.masterData.manage` when the file enrolls into
12
+ classes; `--allow-prod` on production.
13
+ - The school's config holds what the file fills: the roles (e.g. `student`,
14
+ `kontakt`), a field per imported column, the choice lists (an element's German
15
+ label or key is what a cell must hold, or the mapping's `values` translates
16
+ it), a relationship field on the pupil's role for the guardian edge, and a
17
+ default enrollment role (`tenant.defaultEnrolleeRoleKey`) when it enrolls.
18
+ - The classes exist: [Import a school's classes from a class list](../learning-groups/import-classes-from-csv.md)
19
+ — the person list names a class by the same unit, school year and class code.
20
+ - A **mapping file** (JSON):
21
+
22
+ ```json
23
+ {
24
+ "version": 1,
25
+ "delimiter": ";",
26
+ "sourceKey": "altsystem-schueler",
27
+ "person": {
28
+ "key": "schueler_nr",
29
+ "roles": ["student"],
30
+ "fields": {
31
+ "first_name": "vorname", "last_name": "nachname", "birthdate": "gebDatum",
32
+ "address": { "strasse": "adresse", "plz": "plz", "ort": "ort" },
33
+ "pupil_status": "aktivArt"
34
+ }
35
+ },
36
+ "related": [
37
+ {
38
+ "block": "VP1",
39
+ "presentWhen": ["VP1Vorname", "VP1Nachname"],
40
+ "roles": ["kontakt"],
41
+ "mergeOn": ["email", "first_name"],
42
+ "fields": { "first_name": "VP1Vorname", "last_name": "VP1Nachname", "email": "VP1Mail" },
43
+ "relationships": [{ "field": "rel_kinship", "edge": { "type": "IDBeziehungVP1", "custody": "VP1Custody" } }]
44
+ }
45
+ ],
46
+ "values": { "IDBeziehungVP1": { "2": "vater" } },
47
+ "enrollment": { "unit": "unit_key", "code": "klasse", "schoolYear": "2026-27", "startDate": "einstiegsdatum" },
48
+ "ignoredColumns": [{ "column": "payer_iban_0", "reason": "Payers come with the contracts." }]
49
+ }
50
+ ```
51
+
52
+ - `sourceKey` names the import: every person of the file is remembered under it
53
+ with its key, so the same file (or a later one with the same name) finds them
54
+ again. `person.key` is the column of the previous system's stable number.
55
+ - `fields` maps a field key to a column; an object field (address) maps its
56
+ property keys. Every person needs `first_name` and `last_name`.
57
+ - A related block is present on a row when any `presentWhen` column holds a
58
+ value. `edge` fills the relationship's properties from columns or constants
59
+ (`{ "value": true }`).
60
+
61
+ ## Steps
62
+ ```bash
63
+ # 1. The plan: every row read, every cell checked against the school's fields
64
+ # and lists, every class looked up — nothing written.
65
+ plexus-cli --env <env> --tenant <slug> persons import --file ./schueler.csv --mapping ./schueler.mapping.json
66
+
67
+ # 2. Write.
68
+ plexus-cli --env <env> --tenant <slug> persons import --file ./schueler.csv --mapping ./schueler.mapping.json --confirm
69
+ # production additionally: --allow-prod
70
+ ```
71
+
72
+ ## Verify
73
+ ```bash
74
+ # The same file again: every person "unchanged", every enrollment "unchanged", nothing created.
75
+ plexus-cli --env <env> --tenant <slug> persons import --file ./schueler.csv --mapping ./schueler.mapping.json
76
+ ```
77
+ In the app: Personen shows the pupils and their guardians with the relationship
78
+ on the pupil; Programme shows each class with its pupils.
79
+
80
+ ## Idempotency / gotchas
81
+ - **Identity is the file's key, never a name.** A pupil is found again by
82
+ `sourceKey` + key column. An unchanged row writes nothing; a row whose cells
83
+ differ from the import that created it is reported as `changed` and **not
84
+ written** — edits made in Plexus since are never overwritten. A person deleted
85
+ in Plexus is skipped (`deleted`).
86
+ - **A guardian is merged across rows only on `mergeOn`** (e.g. e-mail + first
87
+ name — a family address is often shared by both parents). Without every
88
+ `mergeOn` value the guardian belongs to that row alone: siblings whose
89
+ guardian has no e-mail get that guardian twice. Equal names or addresses
90
+ never link two families. Two blocks of one row are never one person.
91
+ - **Refused before anything is sent:** a column neither read nor in
92
+ `ignoredColumns`, a named column the file lacks, an empty or repeated key, a
93
+ block that names a person without first and last name, a date that is no
94
+ YYYY-MM-DD. **Refused by the server (in the plan too):** an unknown field or
95
+ role, a field none of the person's roles holds, a choice value no list element
96
+ has, a missing class, a school without a default enrollment role.
97
+ - The enrollment covers the class's school year, cut to the person's dates when
98
+ the mapping names them; next year's class list and file add the next
99
+ enrollment and keep this one.
100
+ - Large files are sent in small batches; a failure names how many rows were
101
+ written, and a re-run continues from there.
102
+
103
+ ## Related
104
+ - [Import a school's classes from a class list](../learning-groups/import-classes-from-csv.md)
105
+ - [Update a tenant's config](../config/update-tenant-config.md)