authoring-cli 0.1.0 → 0.1.2

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.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "authoring-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "CLI for SNOMED CT authoring against authoring-services",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {
7
- "authoring-cli": "./dist/index.js"
7
+ "authoring-cli": "dist/index.js"
8
8
  },
9
9
  "files": [
10
10
  "dist/index.js",
@@ -432,10 +432,106 @@ Unlike `update-gci-axiom` and `delete-gci-axiom`, **`add-gci-axiom` has no publi
432
432
  adds a brand-new axiom, so a released concept — or one whose existing axioms are all versioned —
433
433
  accepts a new GCI normally. "This concept is published" is a reason you can't *rewrite* its GCI,
434
434
  never a reason you can't *add* one. There's also no `--definition-status`: a GCI is a `SubClassOf`
435
- axiom by construction and has no primitive/fully-defined distinction.
435
+ axiom by construction and has no primitive/fully-defined distinction — but the concept receiving it
436
+ still must be, and remain, `PRIMITIVE`; see `references/gci-modeling.md`.
436
437
 
437
438
  Removing a GCI is still whole-axiom only — see the `update-gci-axiom` note under role groups above.
438
439
 
440
+ **Deciding *whether* and *how* to model with a GCI at all — for any concept type (disorder,
441
+ procedure, observable, ...), not just this command's mechanics — is its own judgment call.** See
442
+ `references/gci-modeling.md` for the formal reasoning behind why a GCI-bearing concept must stay
443
+ primitive, the checklist for when a GCI is the wrong tool (a tautology on an already-fully-defined
444
+ concept, a target already reached by stated parentage, a distinguishing condition that doesn't
445
+ actually discriminate), how to shape the antecedent (genus + nexus + defining attribute, and the
446
+ role-group partition that silently changes an axiom's meaning if got wrong), and how to derive the
447
+ axiom set from the terminology's own content rather than from theory alone.
448
+
449
+ ### Replacing a published axiom
450
+
451
+ `update-axiom` and `delete-axiom` both refuse outright once an axiom's own `effectiveTime` is set —
452
+ there is no in-place edit for a released axiom's content, by design (rewriting a versioned axiom's
453
+ relationships, or removing it wholesale, risks silently changing what already shipped). "Replace"
454
+ therefore means two separate calls, not one: add the new axiom, then retire the old one.
455
+
456
+ ```
457
+ authoring-cli add-axiom --id <SCTID> --relationships \
458
+ '[{"active":true,"groupId":0,"type":{"conceptId":"116680003"},"target":{"conceptId":"..."}},
459
+ {"active":true,"groupId":1,"type":{"conceptId":"363698007"},"target":{"conceptId":"..."}}]'
460
+
461
+ authoring-cli inactivate-axiom --id <SCTID> --axiom-id <oldAxiomId>
462
+ ```
463
+
464
+ Like `add-gci-axiom`, `add-axiom` has **no publication gate** — it appends a brand-new axiom, so a
465
+ released concept accepts it normally. `inactivate-axiom` also has no `effectiveTime` gate — setting
466
+ `active: false` on a released axiom's row is the normal RF2 retirement path, not an edit to its
467
+ content — but it does enforce that **at least one class axiom stays active**, so run `add-axiom`
468
+ first: the concept must never be left without a stated definition, even momentarily within the
469
+ same task.
470
+
471
+ The new axiom's `definitionStatus` defaults to `PRIMITIVE` regardless of what the axiom being
472
+ replaced was. If the axiom you're retiring was the concept's `FULLY_DEFINED` one and the new axiom
473
+ should take over that role, follow up with `set-definition-status --status FULLY_DEFINED
474
+ --axiom-index <N>` (index into `classAxioms` from a fresh `get-concept` — `add-axiom`'s own output
475
+ reports the server-assigned `axiomId` for the one you just added).
476
+
477
+ ### Collapsing an axiom to the standard authoring form
478
+
479
+ `transform-axiom --id <SCTID> [--axiom-id <axiomId>]` rewrites a class axiom to Is-a the proximal
480
+ primitive parent(s) plus every currently-inferred attribute — the shape editorial convention
481
+ expects a primitive concept's stated definition to take, letting the classifier re-derive the more
482
+ specific hierarchy instead of the axiom asserting it directly. It gets this shape from Snowstorm's
483
+ own `GET .../authoring-form` (the same proximal-primitive-parent substitution the classifier itself
484
+ uses), not a local reimplementation, then routes through exactly the mechanism above: `update-axiom`
485
+ in place if the axiom has never been versioned, or `add-axiom` (carrying over the old axiom's
486
+ `moduleId` and `definitionStatus`) followed by `inactivate-axiom` if it has.
487
+
488
+ The one silent trap: **the target concept must already be classified**. `authoring-form` reads the
489
+ concept's saved *inferred* relationships to do the substitution, not a live reasoner call — call it
490
+ on a concept that predates the last classification (e.g. one just created on the current task) and
491
+ it comes back with no parents and no attributes at all, which `transform-axiom` then refuses to
492
+ write as an axiom ("produced no relationships"). That error names the symptom, not the cause; if you
493
+ see it, `classify --wait` the task first, then retry. If the axiom already matches authoring form,
494
+ `transform-axiom` checks that before writing anything and reports `alreadyConformed: true` rather
495
+ than reaching Snowstorm at all — the naive version of this reached `add-axiom` and let it 400 with
496
+ "Active Concept should not have duplicate axioms" for a published axiom, which was a real but
497
+ needless error to make the caller decode.
498
+
499
+ **It also surfaces on its own**: `validate-concept` runs this same check alongside Snowstorm's
500
+ own save-time validation and folds a non-conformant result in as a synthetic `WARNING` naming the
501
+ axiom and pointing at `transform-axiom` — you don't have to think to run `check-authoring-form`
502
+ separately to notice it. Because `validate-review-concepts` calls `validate-concept` per concept,
503
+ that warning shows up there too, on every concept with pending changes on the task, not just the
504
+ ones you happen to check by hand. It's silent only when authoring form can't be determined at all
505
+ (not classified since the last stated edit, or more than one active class axiom) — same
506
+ "can't-tell, not conforming" distinction as the `skippedConcepts` bucket below.
507
+
508
+ **Finding which concepts need it**: `search-concepts` takes the same `--check-authoring-form`
509
+ [`--conformed`] pair as a filter — it runs the ordinary search to define scope, then checks every
510
+ result with the same axiom-selection and authoring-form lookup `transform-axiom` itself uses, so a
511
+ concept it reports as not conforming is exactly one `transform-axiom` would act on:
512
+
513
+ ```
514
+ authoring-cli search-concepts --ecl "<< 71388002 |Procedure|" --check-authoring-form
515
+ authoring-cli search-concepts --ecl "<< 71388002 |Procedure|" --check-authoring-form --conformed
516
+ ```
517
+
518
+ Default is the non-conforming bucket (the one worth acting on); add `--conformed` to see the ones
519
+ already fine instead. This costs two extra HTTP calls per search result (concept + authoring-form),
520
+ run sequentially, so keep `--limit` reasonable on a broad ECL. Concepts that can't be checked at all
521
+ — not classified since their last stated edit, or with more than one active class axiom — are
522
+ reported separately under `skippedConcepts`, not silently counted into either bucket.
523
+
524
+ `get-concepts-for-review` takes the same `--check-authoring-form [--conformed]` pair, scoped to the
525
+ task's pending-changes list instead of an ECL — useful right before ending a task, to catch a
526
+ stated edit that never got run through `transform-axiom`. Deleted-on-this-branch entries are
527
+ skipped the same way `validate-review-concepts` skips them (not checked, not counted).
528
+
529
+ For a single concept you already have in mind, `check-authoring-form --id <SCTID> [--axiom-id
530
+ <axiomId>]` is the same read-only check as a standalone command — same axiom-selection rule and
531
+ same errors as `transform-axiom`, but it never writes anything. It exits non-zero both when the
532
+ axiom doesn't conform and when it can't be checked at all, so it composes in a shell conditional
533
+ (`check-authoring-form --id <id> || transform-axiom --id <id>`).
534
+
439
535
  ## Redundant stated Is-a relationships
440
536
 
441
537
  Adding a new stated `Is a` (`116680003`) parent to a concept that already has a broader stated
@@ -456,12 +552,12 @@ more specific one. Resolve it immediately rather than leaving it as residue:
456
552
  <id> --axiom-id <axiomId> --relationship-index <N>` removes just that one relationship
457
553
  cleanly, in one call, **regardless of whether the axiom itself has been released** — prefer
458
554
  this over rewriting the whole axiom.
459
- - Else (that specific relationship has itself been versioned) → also try `update-axiom` if the
460
- *whole axiom* has never been versioned (rewrite the full list with the redundant parent
461
- dropped); if the axiom is genuinely versioned too, both commands fail with HTTP 409. Leave both
462
- stated parents in place and accept the warning — a released/versioned relationship shouldn't be
463
- force-edited; this is expected residue for CLI-only authoring, resolved by a human in the
464
- interactive editor at the next release cycle, not a bug to work around.
555
+ - Else (that specific relationship has itself been versioned) → try `update-axiom` if the *whole
556
+ axiom* has never been versioned (rewrite the full list with the redundant parent dropped). If
557
+ the axiom is genuinely versioned too, `update-axiom` 409s — fall back to "Replacing a published
558
+ axiom" above: `add-axiom` with the full relationship list minus the redundant parent, then
559
+ `inactivate-axiom` on the original. Don't leave both stated parents in place and file it as
560
+ expected residue — the warning is real and resolvable in one CLI session.
465
561
  3. Re-run `validate-concept --id <id>` to confirm the warning cleared.
466
562
 
467
563
  ## Deleting a concept
@@ -490,7 +586,7 @@ Two distinct kinds of reference, and the obvious query for each has a blind spot
490
586
 
491
587
  So run both, and then close the gap with an edit-based sweep: a concept that has never been
492
588
  released can only be referenced by something edited on the same branch, so every candidate appears
493
- in `review-concepts`. Fetch each ID from its `concepts` array with `get-concept` and scan
589
+ in `get-concepts-for-review`. Fetch each ID from its `concepts` array with `get-concept` and scan
494
590
  `classAxioms[].relationships[].target.conceptId` for your target. (If the concept has been promoted
495
591
  beyond the task branch, widen that sweep to the project branch — the task's own review list won't
496
592
  see a referrer edited on a sibling task.)
@@ -503,8 +599,11 @@ a reference you're looking straight at.
503
599
  - **Children must be re-parented, not orphaned.** Decide their new parent deliberately: usually the
504
600
  concept that supersedes the one being deleted, or failing that the deleted concept's own parent,
505
601
  so the child doesn't silently jump up the hierarchy. Retarget with `update-axiom`, rewriting the
506
- full relationship list with only that `Is a` target changed. Dropping the `Is a` outright is only
507
- right when the child has other parents that already place it correctly — check, don't assume.
602
+ full relationship list with only that `Is a` target changed — or, if the child's axiom is itself
603
+ versioned and `update-axiom` 409s, `add-axiom` with the corrected list followed by
604
+ `inactivate-axiom` on the original (see "Replacing a published axiom" above). Dropping the `Is a`
605
+ outright is only right when the child has other parents that already place it correctly — check,
606
+ don't assume.
508
607
  - **Attribute references** get retargeted the same way, onto whichever concept now carries the
509
608
  meaning.
510
609
  - **A retrofitted `Is a` added to an existing published concept** (the common case when the
@@ -527,10 +626,10 @@ skipped a step in check 1.
527
626
  - Re-validate with `validate-review-concepts`, which covers every concept with pending stated
528
627
  changes, including the ones you edited on the way to the delete.
529
628
  - Re-classify — deletions and axiom edits both change the stated form, so the inferred view is
530
- stale until you do. After the save, `review-concepts`'s `conceptsClassified` array shows which
629
+ stale until you do. After the save, `get-concepts-for-review`'s `conceptsClassified` array shows which
531
630
  concepts the classification actually rewrote, which is a useful confirmation that the re-parenting
532
631
  landed the way you intended.
533
- - The deleted concept keeps appearing in `review-concepts` indefinitely — the branch's traceability
632
+ - The deleted concept keeps appearing in `get-concepts-for-review` indefinitely — the branch's traceability
534
633
  log records that it changed, and that's permanent. It's reported as `"deleted": true`, and
535
634
  `validate-review-concepts` skips those entries, so this needs no handling on your part.
536
635
 
@@ -668,7 +767,7 @@ authoring-cli validate-review-concepts
668
767
 
669
768
  That's the end-of-session check: it validates every concept with pending *stated* changes and
670
769
  prints a per-concept result plus a tally, exiting non-zero if anything has issues. It reads the
671
- same list `review-concepts` puts in its `concepts` array, so it covers exactly what you edited —
770
+ same list `get-concepts-for-review` puts in its `concepts` array, so it covers exactly what you edited —
672
771
  and it handles the two things that make a hand-rolled loop over those IDs go wrong: it never
673
772
  touches the `conceptsClassified` bucket (concepts a *previous* classification's inferred-
674
773
  relationship side effects touched, not your edits), and it skips concepts deleted on this branch
@@ -680,6 +779,22 @@ The names are deliberately distinct: `validate-task` validates the entire task b
680
779
  job, like `classify`); `validate-concept` is a synchronous, read-only check of a single concept;
681
780
  `validate-review-concepts` runs that per-concept check across your pending edits.
682
781
 
782
+ ## Reviewing concepts against SNOMED CT terminology standards
783
+
784
+ ```
785
+ authoring-cli review-concepts
786
+ ```
787
+
788
+ Fetches the full concept representation — descriptions, relationships, axioms — for every concept
789
+ with pending stated changes on the task, in one call. Nothing here is a validation run: the command
790
+ performs no Snowstorm checks of its own and reports no pass/fail. Its only job is gathering the data
791
+ an editorial review needs, so that review doesn't cost a manual `get-concept` per concept.
792
+
793
+ The review itself — is the naming correct, is the semantic tag right, is the concept appropriately
794
+ primitive or sufficiently defined, is the modelling sound — is a judgment call against the SNOMED CT
795
+ Editorial Guide, not something any command can decide. See `references/review-concepts.md` for that
796
+ checklist.
797
+
683
798
  ## Large multi-session batches
684
799
 
685
800
  Generating many structurally-parallel concepts from a large source list (tens to thousands of
@@ -0,0 +1,386 @@
1
+ # Modelling with GCI axioms
2
+
3
+ General method for using `authoring-cli add-gci-axiom` to make one concept classify under another
4
+ without making the target concept fully defined — applicable to any semantic type (disorder,
5
+ procedure, observable, finding, and so on), not just disease aetiology. `SKILL.md`'s "Adding a GCI
6
+ axiom" section covers the command mechanics (direction of assertion, group handling, the
7
+ publication-gate difference from `update-gci-axiom`/`delete-gci-axiom`); this file covers the
8
+ modelling judgment around it — deciding whether a GCI is the right tool at all, and if so, what its
9
+ antecedent should say.
10
+
11
+ ## Contents
12
+
13
+ - [What a GCI is, and why it exists](#what-a-gci-is-and-why-it-exists)
14
+ - [The hard constraint: PRIMITIVE, and stays PRIMITIVE](#the-hard-constraint-primitive-and-stays-primitive)
15
+ - [Before authoring anything: is a GCI even the right tool?](#before-authoring-anything-is-a-gci-even-the-right-tool)
16
+ - [Confirming the concept's current state](#confirming-the-concepts-current-state)
17
+ - [The antecedent: genus, nexus, defining attribute](#the-antecedent-genus-nexus-defining-attribute)
18
+ - [Choosing the defining attribute for the domain](#choosing-the-defining-attribute-for-the-domain)
19
+ - [Deriving the axiom set from content, not just from theory](#deriving-the-axiom-set-from-content-not-just-from-theory)
20
+ - [The two-way test](#the-two-way-test)
21
+ - [Authoring, validating, classifying](#authoring-validating-classifying)
22
+ - [Reporting the outcome](#reporting-the-outcome)
23
+
24
+ ## What a GCI is, and why it exists
25
+
26
+ SNOMED CT has exactly two definition-status values, and the distinction is about necessary vs.
27
+ sufficient conditions, not about GCIs directly:
28
+
29
+ - **Defined (`FULLY_DEFINED`)** — the concept has conditions that are both necessary *and*
30
+ sufficient: one equivalent-classes axiom, `A ≡ C`. Formally that's two class-inclusion axioms at
31
+ once, `A ⊑ C` (C is necessary) and `C ⊑ A` (C is sufficient).
32
+ - **Primitive (`PRIMITIVE`)** — the concept's stated conditions are necessary but *not* sufficient.
33
+ Plenty of things satisfying the class axiom aren't this concept.
34
+
35
+ **A primitive concept can also carry conditions that are sufficient without being necessary — that
36
+ is what a GCI is.** Where the class axiom reads `TargetConcept ⊑ genus ⊓ nexus`, a GCI reads
37
+ `genus ⊓ nexus ⊓ extra-condition ⊑ TargetConcept` — the reverse direction, attached separately. It
38
+ lets something that satisfies the extra condition classify *under* the target concept without
39
+ asserting that everything under the target concept satisfies that condition.
40
+
41
+ **GCIs exist because SNOMED CT's logic profile (OWL 2 EL) has no primitive for true logical OR
42
+ inside a definition.** When a concept's real membership condition is genuinely a union of
43
+ alternatives — "reachable via cause 1, or cause 2, or context 3" — you can't write that as one
44
+ expression. Each GCI is one disjunct of that union, expressed as its own independent
45
+ sufficient-condition axiom, standing in for the missing OR. This is the same device used to model
46
+ "colorectal cancer = colon or rectum or both" (`781382000`), just with the disjuncts being different
47
+ originating conditions instead of different sites. Two things follow directly from this:
48
+
49
+ - **A GCI a concept "doesn't need yet" isn't overreach — a union with a missing disjunct is an
50
+ incomplete union.** This is why a canonical GCI is authored prospectively, even when nothing
51
+ currently in the terminology satisfies its antecedent.
52
+ - **A false capture on one GCI is fatal to that GCI alone, not to the others.** Each disjunct is
53
+ checked independently — narrowing or dropping one axiom because it over-matches says nothing about
54
+ whether a different axiom on the same concept is safe.
55
+
56
+ Contrast this with **conjunction**, which SNOMED CT expresses natively with role groups on a single
57
+ axiom — no GCI needed. If what you're modelling is really "one thing with two simultaneous
58
+ properties" rather than "one thing reachable by several alternative routes", it's an ordinary
59
+ axiom with multiple groups, not a GCI. Getting this distinction right is a judgment call about
60
+ which formal shape the real-world "and"/"or" actually denotes — see the SNOMED CT Editorial Guide's
61
+ `general-modeling/general-concept-inclusions-gcis.md` for the authoritative definition.
62
+
63
+ ## The hard constraint: PRIMITIVE, and stays PRIMITIVE
64
+
65
+ **A concept that carries a GCI must be, and must remain, `PRIMITIVE`.** A concept can't coherently
66
+ be both fully defined by its own class axiom *and* need an extra sufficient condition bolted on
67
+ without either the class axiom being incomplete or the GCI being redundant — decomposing what
68
+ should be one equivalent-classes axiom into a primitive class axiom plus a reverse-implication GCI
69
+ is a syntax anti-pattern, not an equivalent way of saying the same thing.
70
+
71
+ **Pre-flight, before every `add-gci-axiom` call: confirm `definitionStatus` is `PRIMITIVE`.** If the
72
+ target is `FULLY_DEFINED`, stop and check whether the GCI you're about to write is already entailed
73
+ by the existing equivalence (see the tautology check below) before assuming a GCI is even
74
+ applicable. A small number of released concepts are `FULLY_DEFINED` while still carrying a GCI
75
+ (e.g. `128092005 |Secondary autoimmune thrombocytopenia|`) — that combination is a legacy exception
76
+ in existing content, never a pattern to replicate in new authoring.
77
+
78
+ **Corollary for authoring a concept meant to fall under a GCI-bearing target: never state the
79
+ target as a parent by hand to force it to classify.** If the new concept's own definition already
80
+ satisfies one of the target's GCI antecedents, inference places it there automatically once
81
+ classification runs — provided the antecedent is genuinely satisfied. A hand-added stated parent is
82
+ redundant at best, and at worst it masks a real gap in the GCI's own coverage that a future reader
83
+ would otherwise have caught.
84
+
85
+ ## Before authoring anything: is a GCI even the right tool?
86
+
87
+ Run this checklist before writing any axiom. Each item that fires ends the question for that
88
+ concept — most candidates that look like GCI work turn out not to need one, and recognising that
89
+ early is a complete, useful outcome in itself, not a failure to find something to author.
90
+
91
+ 1. **Is the target `FULLY_DEFINED` with the distinguishing condition already inside the
92
+ definition?** Then the GCI would be a tautology: if `Target ≡ genus ⊓ nexus ⊓ ∃attr.Value`, then
93
+ `genus ⊓ nexus ⊓ ∃attr.Value ⊑ Target` is already one half of that equivalence and adds nothing.
94
+ This is the one check here that's *logically* necessary rather than empirical — trust it over any
95
+ other signal. Don't "generalise" such a definition into a broader GCI either: widening the
96
+ defining attribute's target to something looser reopens exactly the over-matching the tight
97
+ definition was written to avoid.
98
+ 2. **Is the distinguishing condition already stated as necessary on a `PRIMITIVE` version of the
99
+ target**, or is the target a plain specialisation of an already-more-specific parent that carries
100
+ its own qualifier (severity, site, morphology, clinical course) rather than a genuinely
101
+ independent condition? Either way, the necessary side already does the discriminating work a GCI
102
+ would duplicate.
103
+ 3. **Does the target already get its intended descendants through stated parentage instead?** Some
104
+ groupers are maintained entirely by hand — every intended member states `Is a <target>` directly,
105
+ sometimes via a mid-level sub-grouper, with zero GCIs. Check this *before* assuming an empty or
106
+ sparse inferred-descendant set means "unmodelled, needs a GCI": adding one here risks duplicating
107
+ existing structure and introducing a false capture the hand-placement was deliberately avoiding.
108
+ See the structural screen below for how to tell which design a candidate is already in.
109
+ 4. **Does the antecedent's discriminating condition actually discriminate**, or is it shared broadly
110
+ across both the population you want and the population you don't? A condition satisfied by
111
+ hundreds of concepts on both sides of the intended line can't separate them, and usually signals
112
+ that no axiom exists (or should) rather than that one is missing.
113
+ 5. **Does the genus you're about to build the antecedent on actually contain the content you're
114
+ trying to reach?** If `<<stated-genus AND <the-genus-the-content-actually-lives-in>` returns 0, no
115
+ antecedent built on that genus can ever reach that content — this is a re-parenting problem, not a
116
+ GCI problem, and needs flagging as such rather than papering over with a broader antecedent.
117
+ 6. **Is the qualifying word in the target's name even expressing the relationship you assume?**
118
+ Words like "secondary", "acquired", "iatrogenic", or "atypical" carry more than one sense
119
+ depending on the hierarchy — sometimes causal/aetiological (a GCI genuinely applies), sometimes
120
+ temporal or ordinal ("second in a sequence", not "caused by"), sometimes positional or
121
+ level-of-anatomy (e.g. an endocrine axis, where the modifier points at *where* the disease process
122
+ sits rather than *what caused* it — and a causal GCI there doesn't just over-reach, it inverts the
123
+ population). Read the class axiom's own parent and defining attributes before assuming the
124
+ aetiological reading; the concept's own stated genus and finding site usually give the real sense
125
+ away.
126
+ 7. **Otherwise**, the target is a genuine candidate — proceed to confirm its current state and then
127
+ design the antecedent.
128
+
129
+ ### The structural screen
130
+
131
+ Before sweeping content or reading literature, ask how the target concept already gets its intended
132
+ members, if it gets any at all:
133
+
134
+ ```
135
+ authoring-cli search-concepts --ecl "<<TARGET_ID>" --limit 1 # read .total, not the row count
136
+ ```
137
+
138
+ Then `get-concept` a couple of the hits and check whether they **state** `Is a <target>` in their
139
+ own class axiom, or arrive purely by inference.
140
+
141
+ - **Many descendants, all stated** → maintained by hand (checklist item 3). A GCI here is likely
142
+ redundant and risks a false capture the hand-placement avoided.
143
+ - **Zero descendants** → the classic "possibly unmodelled" symptom — worth investigating further,
144
+ but not yet evidence a GCI is missing (see the calibration caution below).
145
+ - **Descendants that arrive without stating the target** → check whether a *fully-defined
146
+ intermediate* between them and the target accounts for the arrival before crediting it to a GCI —
147
+ a fully-defined child concept that states the target classifies its own sub-branch on its own,
148
+ with the target itself carrying no GCI at all. Walk the stated parents upward before concluding a
149
+ GCI is responsible for an inferred-only arrival.
150
+
151
+ **Calibrate before trusting an empty result from any of this.** The inferred view can lag the axiom
152
+ set, particularly on the most recently authored content — a GCI can exist and currently classify
153
+ nothing, especially just after being added and before classification has run. Confirm at least one
154
+ genuine inference-only arrival under the target (or accept that the branch hasn't been classified
155
+ recently enough to show one) before reading a `0` result as "no GCI exists" rather than "no
156
+ information yet."
157
+
158
+ ## Confirming the concept's current state
159
+
160
+ Read the live axioms before assuming anything about what's already there — a candidate can already
161
+ be modelled and simply not annotated as such in whatever list surfaced it:
162
+
163
+ ```bash
164
+ authoring-cli get-concept --id <SCTID> | sed -n '/^{/,$p' | jq -r '
165
+ "\(.fsn.term) [\(.definitionStatus)] gci=\(.gciAxioms|length)",
166
+ (.classAxioms[] | "CLASS " + ([.relationships[]|select(.active)|"g\(.groupId):\(.type.pt.term)=\(.target.conceptId)|\(.target.fsn.term)"]|join(" | "))),
167
+ (.gciAxioms[] | "GCI " + ([.relationships[]|select(.active)|"g\(.groupId):\(.type.pt.term)=\(.target.conceptId)|\(.target.fsn.term)"]|join(" | ")))'
168
+ ```
169
+
170
+ `gci=0` means there's no existing GCI on this concept — but check the checklist above before
171
+ concluding one is *needed*; the common outcome across any grouper-style hierarchy is that most
172
+ candidates correctly get none. Anything else means you're reviewing existing axioms, which is a
173
+ different job from authoring new ones — say so rather than adding duplicates on top.
174
+
175
+ ## The antecedent: genus, nexus, defining attribute
176
+
177
+ Every GCI antecedent is built from the same three parts:
178
+
179
+ ```
180
+ g0 Is a = <the genus the target concept specialises>
181
+ gN <enough of the target's own nexus to stop the axiom over-matching> (sometimes none at all)
182
+ gM <one distinguishing attribute = one value>
183
+ ```
184
+
185
+ - **Genus.** Usually one concept — the thing the target *is a kind of* — and not necessarily every
186
+ parent the class axiom states, nor necessarily a stated parent at all. Prefer the **inferred**
187
+ genus, and prefer a genus that isn't itself a member of the same "grouper family" as the target
188
+ (using an already-specialised sibling as the genus just recreates the specialisation problem one
189
+ level down). When the class axiom states more than one parent and a single simpler genus doesn't
190
+ capture what's needed, copy the full stated parent list instead of guessing at one.
191
+ - **Nexus — exists to compensate for a vague genus.** When the genus is broad (e.g. a top-level
192
+ category like `Disease`, `Procedure`, or `Finding`), keep enough of the target's own class-axiom
193
+ nexus (site, morphology, component, method — whatever pins the concept down) to stop the antecedent
194
+ matching everything under that broad genus. When the genus is already a *specific* concept that
195
+ pins the entity down on its own, the nexus is usually redundant and gets dropped — even if the
196
+ class axiom carried an elaborate one.
197
+ - **Defining attribute.** The one condition that, combined with the genus and nexus, is sufficient
198
+ (not necessary) for membership. Exactly one per GCI axiom — a disease's "caused by X, or Y, or Z"
199
+ is several separate GCIs, not one axiom with several attributes.
200
+
201
+ The antecedent is **not** a mechanical copy of the class axiom in either direction — it can drop
202
+ groups the class axiom has, or add attributes the class axiom lacks, when the target's own real
203
+ definition calls for it. Read a live, already-signed-off exemplar in the same subhierarchy before
204
+ deciding what to keep or drop; conventions in any given area drift over time, and the most recently
205
+ released exemplar wins over anything written down in a reference file.
206
+
207
+ ### Role-group partition
208
+
209
+ The one rule here that's a hard constraint rather than a judgment call, because getting it wrong is
210
+ invisible — nothing rejects the save, and validation passes regardless:
211
+
212
+ - An attribute that describes **the same process/entity the nexus already describes** (e.g. a
213
+ causative agent or pathological process acting on the site+morphology the nexus already names)
214
+ goes **inside** the nexus's own role group.
215
+ - An attribute that relates the target to a **separate, independent entity** (e.g. "due to",
216
+ "after", "associated with" pointing at a different disease, event, or procedure) gets a **separate**
217
+ group of its own.
218
+
219
+ This partition was derived from **multi-attribute** nexuses (e.g. a site+morphology pair together).
220
+ When the nexus is a single lone attribute with nothing else, both the nexus attribute and the
221
+ defining attribute end up in separate groups instead — don't assume "inside the nexus group" extends
222
+ automatically to a single-attribute nexus; verify against a live exemplar.
223
+
224
+ Absolute group *numbers* carry no meaning on their own — only the partition does. Build the whole
225
+ antecedent for one GCI in a single `add-gci-axiom` call with explicit `groupId`s (see SKILL.md's
226
+ "Adding a GCI axiom" for the command itself and the direction-of-assertion caveat) rather than
227
+ composing it from several calls.
228
+
229
+ ## Choosing the defining attribute for the domain
230
+
231
+ There's no single attribute list that fits every semantic type — the right attribute is whatever
232
+ the domain models the distinguishing relationship with, and it should be looked up for the concept
233
+ type actually in front of you rather than assumed from a different domain's convention:
234
+
235
+ - **Disorders/clinical findings** — causal or associative attributes: `Due to` (asserts causation),
236
+ `After` (asserts only temporal sequence — a disease, procedure, or event that preceded this one,
237
+ without claiming it caused it), `Associated with` (weaker still — literature claims association,
238
+ not causation), `Causative agent` (a substance, organism, or physical force), `Pathological
239
+ process` (e.g. infectious, autoimmune). See the SNOMED CT Editorial Guide's
240
+ `domain-specific-modeling/clinical-finding-and-disorder/` for the full attribute range and MRCM
241
+ constraints.
242
+ - **Procedures** — the distinguishing condition is usually a method, device, or approach attribute
243
+ rather than a cause: `Method`, `Using device`, `Direct substance`, `Access`, or a site/laterality
244
+ attribute, depending on what actually varies between the members you want to catch and the ones
245
+ you don't. See `domain-specific-modeling/procedure/`.
246
+ - **Observable entities / findings defined by measurement** — `Component`, `Direct site`,
247
+ `Technique`, `Scale type`, or an `Interprets`/`Has interpretation` pair, when the distinguishing
248
+ condition is about *what* is measured or *how*, not about cause. See
249
+ `domain-specific-modeling/observable-entity/`.
250
+ - Whatever the attribute, **verify its target's SCTID and range live** with `get-concept` rather than
251
+ trusting a hardcoded list from memory or an old note — terminology content and MRCM ranges drift,
252
+ and a stale reference confidently points at the wrong concept.
253
+
254
+ **Choose the level of generality deliberately.** A broader target (e.g. a top-level category over a
255
+ narrow subtype) catches more, which is exactly the tradeoff the two-way test below is for: broad
256
+ enough to be worth authoring prospectively, narrow enough not to sweep in something that must stay
257
+ out. When a broad target would over-catch, narrow it rather than abandoning the axiom entirely —
258
+ that sequence (broad → would it capture something excluded? → narrow → only if nothing separates
259
+ them, drop it) is the single most commonly skipped step, and skipping it is what silently loses an
260
+ otherwise-correct axiom.
261
+
262
+ ## Deriving the axiom set from content, not just from theory
263
+
264
+ Reasoning top-down from what the domain literature or documentation says *should* be a valid
265
+ distinguishing condition is necessary but not sufficient — the terminology's actual content is the
266
+ more reliable source, and reading it first avoids two symmetric failure modes: predicting an axiom
267
+ that turns out to catch a false-positive population, and omitting an axiom that turns out to be
268
+ well attested once you look.
269
+
270
+ A GCI's antecedent has the form `genus ⊓ nexus ⊓ condition ⊑ Target`, so anything it could ever
271
+ classify must already be a subconcept of the genus. That makes the genus's own subconcepts the
272
+ exact candidate set to sweep — enumerate them and read which attributes they actually carry, rather
273
+ than guessing:
274
+
275
+ ```bash
276
+ G=<genus SCTID>
277
+ # Read .total, never the row count alone — --limit truncates `items` silently, and a
278
+ # returned-count that happens to equal your limit is a cap, not a total.
279
+ authoring-cli search-concepts --ecl "<$G:<candidate-attribute>=*" --limit 300
280
+ ```
281
+
282
+ `get-concept` each hit and read its **real axiom**, not its name — a name can mislead about which
283
+ attribute actually carries the cause or mechanism, and only the axiom tells you which candidate
284
+ attribute would actually catch it. ECL matches the **inferred** view, which is the right view: it's
285
+ what classification itself will match against, and it also surfaces concepts that reach the genus
286
+ through a fully-defined definition rather than a stated `Is a`, which a stated-only enumeration
287
+ would miss entirely.
288
+
289
+ Then, per candidate attribute:
290
+
291
+ - **ADD** it if genuinely-in-scope hits exist that no attribute in your current candidate set would
292
+ catch.
293
+ - **SUBTRACT** it if it would capture something that must be excluded (a form the target concept is
294
+ specifically *not* meant to reach) — decisive even against strong positive evidence for the same
295
+ attribute elsewhere.
296
+ - **NARROW** the target rather than dropping the attribute outright when hits are mixed — this is
297
+ usually possible and is the step most often skipped.
298
+ - **Don't let an empty sweep alone suppress an attribute the domain genuinely supports** — absence
299
+ of matching content today isn't evidence the condition doesn't apply; a GCI can be, and often
300
+ should be, authored prospectively. Conversely, don't let "some content exists" stand in as proof
301
+ the axiom is wanted — check the direction and nature of what it would catch.
302
+
303
+ **A single candidate concept isn't always enough to settle absence.** When the target itself has too
304
+ few descendants to sample (0 or 1), the same logic runs in reverse as a **negative test**: pick one
305
+ or several subconcepts of the genus that satisfy a candidate antecedent exactly — subsumed by the
306
+ genus, carrying every nexus attribute, causal/defining target verifiably under the candidate value —
307
+ and check `search-concepts --ecl "<<TARGET AND CANDIDATE"`. `0` means that axiom doesn't exist (once
308
+ you've first confirmed the target's inferred view is live at all, by finding some inference-only
309
+ arrival elsewhere — without that check a `0` here means "no information", not "no axiom"). Several
310
+ independent candidates tested this way, all absent, is as decisive as one, and more trustworthy than
311
+ a single thin sample.
312
+
313
+ ## The two-way test
314
+
315
+ Apply this **per candidate axiom, not per concept** — each GCI is checked independently, because
316
+ each is an independent disjunct:
317
+
318
+ 1. **Does it capture anything that must be excluded?** This half is decisive when authoring: a
319
+ single confirmed false capture disqualifies that specific axiom regardless of how much positive
320
+ evidence supports it. Narrow the target first; only drop the axiom if nothing narrows it enough.
321
+ 2. **Does it catch anything currently in the terminology?** Preferable, not required — a canonical,
322
+ well-attested condition is authored even prospectively, against a genus with zero matching
323
+ subconcepts today.
324
+
325
+ Settle what should and shouldn't fall inside the target's intended scope from the domain's own
326
+ documentation/literature *before* judging sweep hits — don't assume the best-known or most-cited
327
+ cause of something is automatically the one this particular target is meant to catch; it can just as
328
+ easily be the population the target exists to exclude. And watch for **reverse-direction hits**: a
329
+ sweep can surface concepts where the target's own subject is modelled as the *cause* or *component*
330
+ of something else, not the reverse — these inflate an apparent hit count without meaning anything
331
+ for this axiom.
332
+
333
+ ## Authoring, validating, classifying
334
+
335
+ See `SKILL.md`'s "Adding a GCI axiom" for the `add-gci-axiom` command itself — the direction of
336
+ assertion (the target concept ends up as the superclass, not the subclass), building the whole
337
+ relationship list including every group in one call, and reading the result back with `get-concept`
338
+ rather than trusting the echoed `axiomId` (Snowstorm can reassign ids across the array on save, so
339
+ consecutive calls may echo the same id while each having actually saved correctly).
340
+
341
+ After authoring:
342
+
343
+ ```
344
+ authoring-cli validate-concept --id <SCTID>
345
+ authoring-cli classify --wait
346
+ ```
347
+
348
+ Then confirm the classification did what was predicted, in **both** directions — this is the only
349
+ real evidence the axioms work, since validation checks conventions and says nothing about
350
+ subsumption:
351
+
352
+ ```
353
+ authoring-cli search-concepts --ecl "<<SCTID>" # did the intended concepts arrive?
354
+ authoring-cli get-concept --id <a concept you expected to be caught> # inferred Is a includes the target?
355
+ ```
356
+
357
+ A concept you predicted would be caught and wasn't is usually a group-partition mistake (see
358
+ above) or a case where the real content models the distinguishing condition with a different
359
+ attribute than assumed — go back and read that concept's own axiom again rather than loosening the
360
+ GCI's target until something sticks; a loosened target that happens to catch the concept you wanted
361
+ can just as easily catch something you didn't.
362
+
363
+ Where classification genuinely cannot complete on the environment you're working in, say so
364
+ explicitly rather than letting "validated clean" stand in for "verified" — subsumption stays
365
+ predicted rather than observed until classification actually runs, and that distinction belongs in
366
+ whatever you report.
367
+
368
+ ## Reporting the outcome
369
+
370
+ Whether the concept ends up with new axioms or not, state:
371
+
372
+ - The GCIs authored, each with its defining condition and, where the sweep found one, the content
373
+ it's expected to catch.
374
+ - Concepts or conditions deliberately left out, and why (already covered another way, a confirmed
375
+ false capture, out of scope for this target).
376
+ - False-capture checks actually performed, not just asserted.
377
+ - Validation and classification results — or an explicit statement that classification didn't
378
+ complete and subsumption is predicted rather than confirmed.
379
+ - Any modelling problem noticed along the way in a *different* concept (a genus that doesn't
380
+ contain the content it should, a defining attribute already present on a concept that
381
+ contradicts what's being modelled here) — flag it as separate work rather than silently fixing it
382
+ in the same pass.
383
+
384
+ A correctly-reasoned decision not to author anything is a complete result, not a failure to find
385
+ something — the majority of candidates in most grouper-style hierarchies turn out not to need a
386
+ GCI at all, and saying so with the reasoning attached is exactly as useful as a set of new axioms.