authoring-cli 0.1.0

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.
@@ -0,0 +1,104 @@
1
+ # Large multi-session batch authoring
2
+
3
+ Generalized from a real ~1,400-row batch (turning "finger"-specific SNOMED CT concepts into
4
+ parallel "digit of hand" concepts via the substitution pattern in `SKILL.md`'s "Generating a
5
+ concept structurally parallel to an existing one"). The domain specifics don't matter here — what
6
+ matters is the shape of the methodology, which applies to any authoring-cli task where you're
7
+ mechanically processing a large source list across many sessions: bulk site substitutions,
8
+ laterality generalizations, bulk description edits, anything where the same recipe applies to
9
+ hundreds or thousands of rows one at a time.
10
+
11
+ ## Why this needs its own methodology
12
+
13
+ A batch this size can't be done in one sitting, can't be re-derived from memory each session, and
14
+ shouldn't be attempted all-at-once without verification — three problems a plain TODO list doesn't
15
+ solve:
16
+
17
+ - **Resumability.** Without a persistent record of what's been done, a new session (or the same
18
+ session much later) either re-does work or loses track of where it left off.
19
+ - **Triage needs to survive across sessions.** Some rows are excluded, some are blocked on a
20
+ prerequisite, some need a human judgment call — that reasoning shouldn't be re-derived every time
21
+ the same row comes up again.
22
+ - **Unverified volume is risky.** Creating 200 concepts and validating/classifying none of them
23
+ yet means any systemic mistake (a wrong parent, a bad substitution) is now replicated 200 times
24
+ before anyone notices.
25
+
26
+ ## The tracker file
27
+
28
+ Keep one tracker file (TSV or CSV both work fine) alongside the source list, with at minimum:
29
+
30
+ ```
31
+ id label status new_concept_id notes
32
+ ```
33
+
34
+ Seed it from the source list with every row `UNPROCESSED` before doing anything else, if it doesn't
35
+ already exist. A reasonable status vocabulary — adapt the `SKIPPED_*` reasons to the actual task:
36
+
37
+ - `UNPROCESSED` — not yet looked at (the default).
38
+ - `DONE` — fully processed: created, retrofitted if needed, validated, and classified.
39
+ - `SKIPPED_SCOPE` — excluded by a mechanical scope filter (not a candidate for this task at all).
40
+ - `SKIPPED_BLOCKED` — depends on something that doesn't exist yet (e.g. a prerequisite concept
41
+ that itself needs to be minted first) — out of scope for a mechanical pass.
42
+ - `SKIPPED_ALREADY_COVERED` — the target already exists (check both active *and* inactive results
43
+ when searching — a superseded/inactive version doesn't mean the meaning isn't already covered by
44
+ an actively-used sibling).
45
+ - `SKIPPED_TRIAGE` — needs a human judgment call (see the compound-word/idiom/cardinality caveats
46
+ in `SKILL.md`'s substitution-pattern section) — don't guess through these mechanically.
47
+
48
+ Update the tracker for every ID touched at the end of *every* session, not just when a batch
49
+ finishes — this is what lets the next session (or a different session) resume cleanly instead of
50
+ rediscovering the same dead ends.
51
+
52
+ ## Scope-filter mechanically, first
53
+
54
+ Most source lists mix genuine candidates with rows that don't need processing at all (already
55
+ too-specific, already covered by an existing generalization, non-substantive/idiomatic uses of the
56
+ term, wrong semantic category). Write a small filter script (grep/`jq`, not a general-purpose
57
+ scripting language — see below) that excludes the mechanical cases, and batch-mark everything it
58
+ drops with the appropriate `SKIPPED_*` status rather than hand-triaging each excluded row
59
+ individually. Save manual judgment for the smaller set of rows the mechanical filter can't decide.
60
+
61
+ ## Batch size discipline
62
+
63
+ Process a comfortable batch per session — small enough to fully validate and classify before
64
+ moving on (10-20 concepts is a reasonable default), not "as many as possible in one pass." Creating
65
+ first and validating later means any systemic error compounds before you catch it; validating each
66
+ batch before starting the next one catches it after one batch's worth of damage, not the whole run's.
67
+
68
+ ## Live verification over static mappings
69
+
70
+ If the batch's substitution logic depends on knowing "concept A is the correct generalization of
71
+ concept B," don't build a static lookup table and trust it for the whole run — terminology content
72
+ changes, and a stale table will confidently substitute in a superseded or wrong concept. Look it up
73
+ live via `search-concepts` with an exact match check each time (see `SKILL.md`'s substitution
74
+ pattern), even if that means repeating the same lookup across many rows that happen to share a
75
+ value. If repeated re-lookups genuinely become a bottleneck at scale, that's a reasonable time to
76
+ introduce a cache — but validate the cache against live search periodically rather than treating it
77
+ as permanently authoritative.
78
+
79
+ ## Scripting against authoring-cli's JSON output
80
+
81
+ Shell scripts that automate scope-filtering or candidate discovery should parse `authoring-cli`'s
82
+ JSON output with `jq`, not a general-purpose scripting language — it keeps the script a single
83
+ dependency-free file and makes the intent legible at a glance:
84
+
85
+ ```bash
86
+ json=$(authoring-cli get-concept --id "$id" --project "$PROJ" --task "$TASK" 2>/dev/null)
87
+ defstatus=$(echo "$json" | jq -r '.definitionStatus')
88
+ sites=$(echo "$json" | jq -r '
89
+ [.classAxioms[]?.relationships[]? | select(.typeId=="363698007")]
90
+ | .[] | [.target.fsn.term, .destinationId, .groupId] | @tsv
91
+ ')
92
+ ```
93
+
94
+ Such a script should only ever *find candidates* — it shouldn't decide fitness for creation on its
95
+ own. Keep the compound-word/idiom/cardinality judgment calls (see `SKILL.md`) as an explicit manual
96
+ step after the script narrows the field, not folded into the script's filtering logic.
97
+
98
+ ## Closing out a session
99
+
100
+ Report, and record in the tracker: how many created, how many skipped and why (grouped by
101
+ `SKIPPED_*` reason), any redundant-Is-a warnings found and resolved, and anything intentionally
102
+ left in place for human cleanup (e.g. a genuinely versioned axiom that can't be edited via the CLI
103
+ — see `SKILL.md`'s redundant-Is-a section). This is what makes "continue the batch" a safe thing to
104
+ ask for in a future session without re-deriving any of this context.