openehr-rails 0.8.0 → 0.9.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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
  3. data/.rubocop_todo.yml +2 -2
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.md +101 -0
  6. data/CLAUDE.md +100 -1
  7. data/docs/backlog.md +5 -4
  8. data/docs/design/0.9.0-plan.md +284 -0
  9. data/docs/design/multi-leaf-non-observation-plan.md +8 -0
  10. data/docs/reports/0.9.0-log.md +165 -0
  11. data/docs/reports/referral-upstream-log.md +59 -0
  12. data/lib/generators/openehr/scaffold/scaffold_generator.rb +2 -0
  13. data/lib/openehr_rails/opt/field_extractor.rb +77 -24
  14. data/lib/openehr_rails/opt/parser.rb +2 -63
  15. data/lib/openehr_rails/rm/composition_committer.rb +5 -5
  16. data/lib/openehr_rails/rm/graph_builder.rb +13 -1
  17. data/lib/openehr_rails/rm/rm_object_builder.rb +3 -1
  18. data/lib/openehr_rails/storable/shape_guard.rb +71 -0
  19. data/lib/openehr_rails/storable.rb +3 -0
  20. data/lib/openehr_rails/version.rb +1 -1
  21. data/openehr-rails.gemspec +1 -1
  22. data/spec/generators/openehr/scaffold/opt_scaffold_generator_spec.rb +75 -0
  23. data/spec/openehr_rails/fhir_instruction_skip_spec.rb +41 -0
  24. data/spec/openehr_rails/opt/field_extractor_embedded_archetype_spec.rb +1 -1
  25. data/spec/openehr_rails/opt/field_extractor_embedded_root_spec.rb +136 -0
  26. data/spec/openehr_rails/opt/field_extractor_instruction_spec.rb +123 -0
  27. data/spec/openehr_rails/opt/field_extractor_min_occurrences_spec.rb +43 -0
  28. data/spec/openehr_rails/opt/parser_repeated_root_bindings_spec.rb +33 -0
  29. data/spec/openehr_rails/opt/parser_term_bindings_spec.rb +2 -1
  30. data/spec/openehr_rails/rm/composition_committer_context_spec.rb +118 -0
  31. data/spec/openehr_rails/storable_shape_guard_spec.rb +127 -0
  32. data/spec/templates/bmi_calculation_repeated_root.opt +2244 -0
  33. data/spec/templates/jp_referral.opt +5554 -0
  34. metadata +15 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a30bd4a561f8193c0603c1e43e1873e1c8835d2e7c418b95c429ac6e2b397e83
4
- data.tar.gz: 180145cf2e294cc68ae84ddc35b147e07e6fb52f99062d14f8df3cb0e306108e
3
+ metadata.gz: 7cf3e47b16df6a577e52ade10ed4dfe9ccaecb6b5d3250831aa29bb17bf48b9c
4
+ data.tar.gz: 1de3151b7a663f9ccdc3cc5289d311937bbfb2e001f79d4d155dc82dcadfbe49
5
5
  SHA512:
6
- metadata.gz: 46b84468c263139208e522562831d103cd43d8d3c865aa274fe7cf6db7ebe486fa67329b4e175564a9fc0f94d0a0a4454d679f3d42735ac4c7214b739fa7ba3a
7
- data.tar.gz: dc189063ef16d43253287e9fed472bdc7d69b0b0c72fb5f393f772cf9adbe596ebd24b6dbea57514435c3a6afe8cdba048fd4b1c3c2e73e39b4a17315ad03b6d
6
+ metadata.gz: f78dbe2aa02f4209312b59182edcb9720cb7395cc518a1187463ebdc55d21ac464a35238e6dd8d4caa85325450b2ec9f71298d1eeca9c9866e408eea9b35fa1b
7
+ data.tar.gz: 12693cb3515233a9ad1c7e999bd5b9349587f59b983d47900f99167daa71247cb28a2b4c5ae09d85359fd2675717e6f65579f3f2fe1d186e49d1fbc9bc1d80c4
@@ -13,7 +13,7 @@ assignees: ''
13
13
  ## Environment
14
14
 
15
15
  - `openehr-rails` version: <!-- e.g. 0.4.1 -->
16
- - `openehr` version: <!-- e.g. ~> 2.3 -->
16
+ - `openehr` version: <!-- e.g. 2.5.0 -->
17
17
  - Rails version: <!-- e.g. 8.1 -->
18
18
  - Ruby version: <!-- e.g. 3.3, 3.4, 4.0 -->
19
19
  - If the report involves an OPT/ADL file: the generating tool and its
data/.rubocop_todo.yml CHANGED
@@ -160,7 +160,7 @@ Metrics/BlockLength:
160
160
  # Offense count: 6
161
161
  # Configuration parameters: CountComments, CountAsOne.
162
162
  Metrics/ClassLength:
163
- Max: 210
163
+ Max: 211
164
164
 
165
165
  # Offense count: 15
166
166
  # Configuration parameters: AllowedMethods, AllowedPatterns.
@@ -175,7 +175,7 @@ Metrics/MethodLength:
175
175
  # Offense count: 1
176
176
  # Configuration parameters: CountComments, CountAsOne.
177
177
  Metrics/ModuleLength:
178
- Max: 181
178
+ Max: 182
179
179
 
180
180
  # Offense count: 2
181
181
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 4.0.7
1
+ 4.0.10
data/CHANGELOG.md CHANGED
@@ -7,6 +7,107 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.9.0] - 2026-11-24
11
+
12
+ > **Upgrade note.** Four things change for an existing host app.
13
+ > (1) Requires `openehr` `~> 2.5` (was `~> 2.3, >= 2.3.1`): a host app locked to
14
+ > openehr 2.4.x must update it together with this gem.
15
+ > (2) `FieldExtractor` output: a field under an embedded archetype root now has the
16
+ > root written `[archetype_id]` in its `path` and is named after its own archetype
17
+ > (`laboratory_test_analyte_at0001`, was `laboratory_test_result_at0001_2`); entries
18
+ > with `protocol` leaves and every `INSTRUCTION` extract more fields than before. A
19
+ > generated model keeps the `FIELD_MAP` it was generated with, so nothing moves until
20
+ > you re-scaffold; re-scaffolding such a template adds and renames columns. Code that
21
+ > reads `FieldExtractor#fields` at runtime sees the new paths and names immediately.
22
+ > (3) `Storable` now raises `OpenehrRails::Storable::UnsupportedTemplateShape` on save,
23
+ > and saves nothing, when a record holds a value for a field it cannot assemble into a
24
+ > valid composition (an entry nested in a `SECTION`, a field under an embedded root, an
25
+ > `INSTRUCTION`). Such saves used to succeed and store a malformed `rm_composition`.
26
+ > (4) FHIR `component` slice names follow the renamed fields.
27
+ > Also: a composition committed from canonical JSON **with** a `context` now answers
28
+ > `c/context/...` AQL paths with `unsupported path attribute` (as every
29
+ > `Storable`-saved composition already did) instead of a row holding `nil`; see Known
30
+ > limitations.
31
+
32
+ ### Added
33
+ - `FieldExtractor` descends `activities`, `description` and `protocol`, so an
34
+ `INSTRUCTION` entry has fields for the ELEMENTs under
35
+ `activities[...]/description[...]` and `protocol[...]`, including the embedded
36
+ CLUSTER roots there at any depth (a referral's `service_request`: 0 fields before,
37
+ 20 now). `ACTION.description` and every entry type's `protocol` come with the same
38
+ change. `narrative`, `timing` and `action_archetype_id` are not ELEMENTs and yield
39
+ no field (#47, anlage upstream 17).
40
+ - Fields carry `root_path` (path of the nearest embedded root, else of the entry) and
41
+ `instance_index` (0-based document-order ordinal among the template's fields sharing
42
+ the same `path`), so `[path, instance_index]` identifies a field even when the same
43
+ archetype is embedded twice side by side (a referral's requester / receiver
44
+ organisation) or an entry archetype repeats. Root names and name-predicate paths
45
+ wait for per-root terms upstream (openehr-ruby#58) (#57).
46
+ - DV_QUANTITY fields carry `units_list`, every unit the OPT allows in OPT order;
47
+ `units` stays the first one (#57).
48
+ - Fields carry `min_occurrences`, the ELEMENT's own occurrences lower bound (0 when
49
+ unconstrained). `required` keeps its meaning ("entry mandatory and element
50
+ mandatory"), so under an optional entry a 1..1 element is
51
+ `required: false, min_occurrences: 1`: mandatory if the entry is written at all.
52
+ Generated validations are unchanged; validating that conditional requirement is
53
+ #65 (#58, anlage upstream 20).
54
+
55
+ ### Changed
56
+ - `FieldExtractor` writes an embedded archetype root in a field's `path` by its
57
+ archetype id instead of its at-code, and names fields under such a root after their
58
+ own archetype: `<own concept>_<label slug, else at-code>` (never the bare concept).
59
+ For `lab_result_report_reduced.opt`: `.../items[at0010]/items[at0001]/value` becomes
60
+ `.../items[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1]/items[at0001]/value`.
61
+ Paths now match RM data paths and AQL. Fields owned by the entry itself, and
62
+ templates without embedded roots, are unchanged (#57, anlage upstream 22).
63
+ - A template whose entries carry `protocol` leaves extracts more fields: e.g.
64
+ `problem_list.opt` gains `problem_diagnosis_at0070` (最終更新日, under
65
+ `protocol[at0032]`). The FHIR profile for `problem_diagnosis` is unchanged: at0070
66
+ has no row in `TypeMap::ENTRY_ELEMENT_MAPS` and is left out (#47).
67
+ - The FHIR generators report an `INSTRUCTION` that has leaves through `#skipped` as
68
+ "N leaves ... no row in `TypeMap::ENTRY_ELEMENT_MAPS`" instead of "no leaves";
69
+ still no `ServiceRequest` profile is emitted (mapping rows: #35) (#47).
70
+ - `openehr:scaffold` prints a warning listing the fields the generated model cannot
71
+ save yet (#60).
72
+ - Requires `openehr` `~> 2.5`. `OpenehrRails::Opt::Parser` no longer reads OPT
73
+ `term_bindings` itself: openehr 2.5.0 does (openehr-ruby#31), and the interim bypass
74
+ is removed (#59).
75
+
76
+ ### Fixed
77
+ - `OpenehrRails::Storable` no longer writes a malformed composition for the template
78
+ shapes it cannot assemble: saving a value for a field of an entry nested in a
79
+ `SECTION`, of an embedded archetype root or of an `INSTRUCTION` raises
80
+ `UnsupportedTemplateShape`, naming the shape, the fields and the tracking issue
81
+ (#62, #61, #69), and saves nothing. Records that leave those fields empty, and
82
+ models of templates without these shapes, save exactly as before. Models generated
83
+ before 0.9.0 are covered too (#60).
84
+ - An OPT embedding the same archetype more than once no longer yields each term
85
+ binding once per occurrence: `code_bindings` holds one entry per binding, so the
86
+ FHIR `code.coding` slices are not duplicated. Two behaviours follow upstream and
87
+ differ from the removed bypass: a binding item without a `terminology_id` is no
88
+ longer completed from the `term_bindings` element's `terminology` attribute, and
89
+ when roots of the same archetype carry *different* bindings the last root wins
90
+ instead of their union (#59).
91
+ - `CompositionCommitter` / `GraphBuilder` persist a canonical composition's
92
+ `context.start_time` (into `context_start_time`) and `context.setting` (into the
93
+ already-existing `setting_code` / `setting_value` columns); they were dropped unless
94
+ the caller passed `context_start_time:`. An explicit `context_start_time:` still
95
+ wins. `RmObjectBuilder` rebuilds the stored setting instead of always `other`
96
+ (#46, proposals 1-2; anlage upstream 16).
97
+
98
+ ### Known limitations
99
+ - `Storable` cannot yet write entries nested in a `SECTION` (#62), fields under an
100
+ embedded archetype root (#61) or `INSTRUCTION` entries (#69); it refuses them as
101
+ described above. Committing a canonical composition through
102
+ `Rm::CompositionCommitter` is unaffected.
103
+ - `SELECT c/context/start_time/value` (and `c/context/setting/...`) is not answerable
104
+ yet: the openehr AQL path evaluator (2.5.0 included) cannot navigate `EVENT_CONTEXT`
105
+ and raises `unsupported path attribute "start_time"` as soon as a composition has a
106
+ context. The values are stored and rebuilt by `to_rm`; querying them waits for an
107
+ openehr release.
108
+ - `context.other_context` is not persisted, and `CanonicalSerializer` does not emit
109
+ `context` yet (#46 stays open for both).
110
+
10
111
  ## [0.8.0] - 2026-10-12
11
112
 
12
113
  > **Upgrade note.** A stored Composition holding a `SECTION` or an `INSTRUCTION`
data/CLAUDE.md CHANGED
@@ -43,7 +43,9 @@ diff, then commits, recording the implementer in a commit message trailer (e.g.
43
43
  ## Release convention
44
44
 
45
45
  Before tagging, make the final semver determination from the actual content of
46
- `[Unreleased]`, not from a pre-assigned version number. If the instructed version number
46
+ the release (the `changelog.d/` fragments consolidated into `CHANGELOG.md` at the
47
+ inventory, checked against `git diff <last tag>..master` - see 全開の進め方 below),
48
+ not from a pre-assigned version number. If the instructed version number
47
49
  contradicts the actual content, stop instead of tagging and ask for re-arbitration.
48
50
 
49
51
  **Publish only the CI artifact itself.** `gem push` takes the `.gem` downloaded
@@ -160,6 +162,103 @@ authorized for the task at hand. A matching line is planned for `anlage`'s own
160
162
  `CLAUDE.md` in a later batch - not yet added there as of this entry. Update
161
163
  2026-09-04: added there as 絶対規律 item 9.)
162
164
 
165
+ ## 裁定台帳(2026-11-20 導入)
166
+
167
+ - 統括の裁定の正典は `/home/skoba/src/anlage-ops/rulings.md`
168
+ (非公開リポジトリ `skoba/anlage-ops`)。チャットに貼られた本文は写しで、
169
+ 食い違ったら台帳が正
170
+ - 「裁定 R-… を読んで着手」と言われたら、最初に
171
+ `git -C /home/skoba/src/anlage-ops pull --ff-only` を実行し、
172
+ 台帳の該当行と本文を読む。読めなければ、着手せずに例外報告
173
+ - 着手したら、台帳の自分宛ての行の状態を 発行 → 着手 に書き換え、
174
+ anlage-ops に commit・push する(日付と、あれば最初の push SHA)。
175
+ anlage-ops に書いてよいのはこの 1 行だけ。ほかの行、本文、
176
+ ほかのファイルは変えない。これは越境ゲートの例外として認められている
177
+ - 完了に進めるのは統括か人間。セッションは「完了申請(SHA、CI run)」まで書いてよい
178
+ - 報告とコミットメッセージには裁定 ID を書く(例: `Refs R-20261120-1`)
179
+ - anlage-ops の内容(裁定の本文、ロードマップ)を、このリポジトリのコード、
180
+ Issue、PR、文書に写さない。参照は裁定 ID で行う
181
+
182
+ ## 依存の方針(2026-11-24 導入。裁定 R-20261124-2)
183
+
184
+ 要点だけを書く。正典は裁定台帳の R-20261124-2。
185
+
186
+ - 依存は最新のリリース版に追従する。`openehr-rails.gemspec` の下限と、手元・CI が
187
+ 解決する版を、理由なく古いままにしない
188
+ - 版を固定する、または上限を付けるときは、理由と解除の条件を、その行のコメントと
189
+ Issue の両方に残す
190
+ - 依存の不具合は上流で直す。このリポジトリに置く迂回はつなぎで、撤去の条件を
191
+ コードのコメントに書く(実例: `lib/openehr_rails/opt/parser.rb` にあった
192
+ `populate_term_bindings!`。openehr-ruby#31 が openehr 2.5.0 に入ったので、
193
+ 下限の引き上げと同じ PR で撤去した〔#59〕)
194
+ - 未リリースのコードには、上流に修正があり、リリースを待てないときだけ依存する。
195
+ SHA で固定し、リリースが出たら RubyGems の版に戻す
196
+ - 上流の Issue・PR への投稿は人間が行う。セッションは再現手順と文面の案を用意する
197
+ - 依存の更新は 1 件ずつ、CI の合否で決める。マージは人間
198
+
199
+ ## 作業ツリー規律(2026-11-24 導入。裁定 R-20261124-6)
200
+
201
+ anlage の `CLAUDE.md`「作業ツリー規律」と同旨。根拠と採らなかった案は、anlage の
202
+ `docs/design/session-isolation-plan.md`(承認済み、R-20261123-1)。
203
+
204
+ - 1 セッション = 1 リポジトリ。起動ディレクトリがこのリポジトリでなければ、
205
+ また宛先が別リポジトリの依頼なら、着手せずに止まる
206
+ - セッションの冒頭で `git fetch` と `git status --short` を実行する。
207
+ 未コミット物があれば、作業の前に一覧を報告の先頭に書く
208
+ - 実装は必ず git worktree で行う。置き場所は
209
+ `/home/skoba/src/openehr-rails-worktrees/<slug>`(1 ブランチ = 1 worktree)。
210
+ `/tmp` には作らない。本体の作業ツリーは `master` のまま動かさず、
211
+ docs のみの直接 push と fetch にだけ使う
212
+ - 着手時に同じ slug の worktree が既にあれば、止まって例外報告する
213
+ (worktree のパス、ブランチ、未コミット物の一覧を書く)。ログの記載だけを根拠に
214
+ 再開しない。例外は、裁定または人間の指示がその slug の再開を名指ししているときだけ
215
+ - セッションの終わりに作業ツリーを空にする。途中の作業は `wip/<slug>` ブランチに
216
+ コミットして push する(draft PR でよい)
217
+ - 未コミット物を捨てるのは削除にあたり、ゲート対象
218
+ - コミットはパスを明示して add する(`-A` と `.` を使わない)
219
+ - 合否はクリーンな checkout(CI)で決める。並行負荷のある手元の結果を合否に使わない
220
+ - `master` への直接 push が non-fast-forward で拒否されたら、fetch して rebase する。
221
+ force はしない
222
+ - 越境(読み取り)は、絶対パスと `git -C` で相手リポジトリの本体ツリーを読む
223
+ (`log`・`show`・`grep`・ファイルの閲覧)。報告に対象リポジトリと SHA を書く。
224
+ 相手のツリーでは `checkout`・`pull`・`bundle`・`rspec` を実行しない。
225
+ 依存する gem の挙動は、自分の worktree で解決された版に対して確かめる。
226
+ 未リリースのコミットの挙動は、gem 側に Issue を立てて頼む。`Gemfile` を
227
+ 相手のツリーへの path 指定に書き換えたものをコミットしない
228
+ - Codex の納品先は、当該 Issue の worktree。本体ツリーには納品させない。
229
+ 起動の直前に `pwd` を出力して worktree であることを確かめる。
230
+ `codex exec resume --last` は使わない。毎回あたらしく起動し、受け渡しは
231
+ commit 済みの計画書で行う(上の「Repository-context-dependent commands…」の
232
+ `codex exec resume` の扱いは、この項が上書きする)
233
+
234
+ ## 全開の進め方(2026-11-24 導入。裁定 R-20261124-8)
235
+
236
+ 要点だけを書く。正典は裁定台帳の R-20261124-8。これより前の記述と食い違うときは、この節が優先する。
237
+
238
+ - **止まらずに進める範囲**: 承認済みの計画書と、このリポジトリ宛ての作業列にある項目。
239
+ 計画書が要る項目は、計画書を push してそのまま実装に進む(確認は事後)
240
+ - **必ず止まってゲート報告を出す範囲**: 計画書に無い挙動の変更と公開 API の変更。
241
+ gem の追加と未リリースのコードへの依存。データの移行と削除、開発機の設定の変更。
242
+ 臨床の判断と人間の入力を待つもの。タグと publish。ほかのリポジトリへの書き込み
243
+ (台帳の自分宛ての行は除く)
244
+ - **セッションが自分でマージしてよい PR**: 自分で開いた、docs のみの PR と、
245
+ 止まらずに進める範囲の実装の PR。条件は、head の CI がすべて green、競合なし、
246
+ 1 Issue = 1 PR。マージのあと `master` の CI を確かめ、赤なら次に進まず例外報告。
247
+ `master` では force-push と履歴の書き換えをしない
248
+ - **人間がマージする PR**: 依存を変えるもの(`Gemfile`、gemspec、lock)、版番号を
249
+ 変えるもの、CI のワークフローを変えるもの、ファイルの削除が主な中身のもの、
250
+ 必ず止まる範囲に当たったもの。権限でマージが止められたら、回避せずに報告する
251
+ - **変更履歴は断片ファイル**: PR では `CHANGELOG.md` に触らない。
252
+ `changelog.d/<Issue 番号>-<slug>.md` を 1 PR につき 1 つ足し、変更履歴の文と
253
+ semver の判定・理由を書く。棚卸しで断片を `CHANGELOG.md` にまとめ、断片を消す
254
+ (タグの時点で `changelog.d/` に断片が残っていないこと)
255
+ - **公開はできた順**: 公開できる中身が `master` にそろったら棚卸しに進む。
256
+ 手順は Release convention のとおりで、変えない
257
+ - **報告**: ゲート・バンドル・例外の報告は `docs/reports/` に push し、台帳の自分宛ての
258
+ 行に PR 番号と SHA を書き足す。次の裁定を待たずに、作業列の次の項目に進む
259
+ - **変えないもの**: TDD(Red の出力を報告に載せる)、合否は CI、実測と推論の区別、
260
+ 越境は読み取りだけ、publish は CI artifact だけで `gem push` は人間
261
+
163
262
  ## Project Overview
164
263
 
165
264
  This is `openehr-rails`, a Rails engine gem that turns an openEHR Operational Template (`.opt`, ADL2/XML) into a working Rails resource in one command: `rails generate openehr:scaffold path/to/template.opt --fhir` emits a model, migration, controller, views, i18n locale, and (with `--fhir`) HL7 FHIR R5 `StructureDefinition` profiles. Generated models persist both as typed columns (for forms/search) and as full openEHR RM data (canonical JSON + a typed node graph with immutable-append versioning), and are queryable via a growing AQL surface. A mountable admin engine (`/openehr`) provides template upload/management, runtime scaffolding, and a FHIR R5 facade. Legacy ADL-archetype-only generators (model/controller/migration/helper/assets/i18n/template/template_model, based on `Openehr::Generators::ArchetypedBase`) have been removed — OPT is the only supported input format for scaffolding.
data/docs/backlog.md CHANGED
@@ -74,16 +74,17 @@ that verification is deferred to the next real release (>= 0.5.0), not simulated
74
74
 
75
75
  ## Release automation
76
76
 
77
- - **`release.yml` records no sha256 of the built `.gem`** (found at the 0.7.0
77
+ - **Done (2026-10-12, `1410274` via PR #51; first run at `v0.8.0`, run 38258179628,
78
+ `docs/reports/referral-upstream-log.md` R7 -- printed value == artifact ==
79
+ local rebuild).** Original entry kept for the rationale:
80
+ **`release.yml` records no sha256 of the built `.gem`** (found at the 0.7.0
78
81
  release, 2026-09-10, `docs/reports/fsh-generator-log.md` R14). The only digest in
79
82
  the run log is `actions/upload-artifact`'s "SHA256 digest of uploaded artifact",
80
83
  which hashes the uploaded archive, not the gem file, so `CLAUDE.md`'s "compare
81
84
  against the value recorded for that run" cannot be followed literally; the
82
85
  tag-rebuild cross-check is what pins the bytes today. Add a "Record sha256" step
83
86
  after `rake build` (`sha256sum pkg/*.gem`), as openehr-ruby's `release.yml` has.
84
- CI-only change; needs a PR, no Issue. **In PR #51 as `1410274` (2026-10-12,
85
- `docs/reports/referral-upstream-log.md` R5)**; first run that prints it will be
86
- the `v0.8.0` tag's.
87
+ CI-only change; needs a PR, no Issue.
87
88
  - **The tag-rebuild cross-check compares `data.tar.gz`, not the whole `.gem`**
88
89
  (0.7.1, 2026-09-25, `docs/reports/referral-upstream-log.md` R2). A `.gem` embeds
89
90
  `rubygems_version` in `metadata.gz`, so a rebuild on a different ruby/rubygems
@@ -0,0 +1,284 @@
1
+ # 0.9.0 の計画(ゲート報告)
2
+
3
+ 裁定 ID: R-20261124-6(依頼 1)。状態: **承認済み(R-20261124-7)**。回答は 9 節。Issue は項目ごとに分かれる(2 節)。
4
+
5
+ - 基準点: openehr-rails master `c8a6841`(版 0.8.0、`openehr-rails.gemspec:31` は `openehr ~> 2.3, >= 2.3.1`、手元の解決は openehr 2.4.3)
6
+ - 読んだ他リポジトリ(読み取りのみ。相手のツリーでは何も実行していない):
7
+ - anlage 本体ツリー `86720a5`: `docs/upstream-candidates.md`、`app/models/template.rb`、`spec/fixtures/opt/jp_referral.opt`(v0.2、`d48d2f2`)、`spec/fixtures/pathcards/jp_referral.golden.json`
8
+ - anlage `origin/docs/m2-plan` `e6f9c64`(`docs/design/m2-plan.md`)、`origin/docs/openehr-2.5.0-adoption-plan`(`docs/design/openehr-2.5.0-adoption-plan.md`)
9
+ - openehr-ruby 本体ツリー `ec07936`: `docs/design/round2-2.5.0-plan.md`(3.3・3.4・3.6・3.7 節、5 節)
10
+ - 「実測」はこのリポジトリのツリーで、解決済みの openehr 2.4.3 に対して実行または grep したもの。
11
+ 「試作」は scratch のスクリプトで `FieldExtractor` を一時的に差し替えた出力で、リポジトリには入れていない。
12
+ 「推論」は根拠を添える。「未確認」は読むだけでは決まらないもの
13
+ - openehr 2.5.0 の未リリースのコミット(#31・#43)は、このリポジトリでは実行していない
14
+
15
+ ## 1. いまの状態(実測)
16
+
17
+ | 対象 | 結果 |
18
+ |---|---|
19
+ | `jp_referral.opt` v0.2 の `FieldExtractor` | 5 entry・6 field。`INSTRUCTION.service_request` は 0 field(`field_extractor.rb:49` の `DESCENDABLE_ATTRIBUTES` に `activities`・`description`・`protocol` が無い) |
20
+ | 同、`clinical_synopsis` ×2 | path が同一。name は `clinical_synopsis` と `clinical_synopsis_2`(`uniquify` の連番) |
21
+ | `lab_result_report_reduced.opt` の埋め込み CLUSTER | path は `…/items[at0010]/items[at0001]/value`(ルートの node_id で書く)。name は `laboratory_test_result_at0001_2`(宿主の concept と連番) |
22
+ | `bmi_calculation.opt` の units | `body_mass_index` は `"kg/m2"` だけ(`field_extractor.rb:198` の `list&.first`) |
23
+ | `required` | 上の 3 テンプレートの全 field が false(entry が 0..1。`field_extractor.rb:174`) |
24
+ | term_bindings の件数 | `bmi_calculation.opt` は 4 件、1 コードあたり最大 1 件。同じアーキタイプを複数回埋め込み、かつ `term_bindings` を持つ fixture は、このリポジトリに無い |
25
+ | 制約ノードの `.path` の利用 | `lib/` に 0 件(grep。`rm_object_builder.rb:19` の `node.path` は保存済み RM ノードの列) |
26
+ | `Opt::Parser#parse` | `parser.rb:20` が `Nokogiri::XML::Document.parse(source)` を引数なしで呼ぶ |
27
+ | 再構築した Composition | `rm_object_builder.rb:74-94` は `archetype_details` を渡さない(保存側の `template_id` 列は `graph_builder.rb:30` で入る) |
28
+ | CI の解決 | `Gemfile.lock` は追跡外。CI は毎回あたらしく解決するので、openehr 2.5.0 は公開された時点で master の CI に入る |
29
+
30
+ **新たに見つけたもの(未起票。`Storable` の書き込み経路)。** `FIELD_MAP` を持つ仮のホストクラスに `Storable` を
31
+ include し、全 field に値を入れて `rm_content` を出した(scratch。ActiveRecord の実モデルでは確かめていない)。
32
+
33
+ - S1: 埋め込み CLUSTER 配下の field が、別の entry に分かれる。`lab_result_report_reduced.opt` で、
34
+ 2 つめの「entry」が `_type: OBSERVATION`・`archetype_node_id: openEHR-EHR-CLUSTER.laboratory_test_analyte.v1` になった
35
+ (`storable.rb:139` が `field[:archetype_id]` で entry をまとめるため。field の `archetype_id` は 0.4.1 から自ルートを指す)
36
+ - S2: SECTION 配下の entry が壊れた形になる。`jp_referral.opt` で、SECTION は出ず、entry の直下に
37
+ `items[<entry の archetype_id>]`(型なし)が入り、`clinical_synopsis` ×2 は 1 つにまとまった
38
+ (`storable.rb:155` は先頭の 1 セグメントだけを entry とみなす)
39
+
40
+ anlage は `Storable` を使わない(自前の `Opt::CompositionBuilder` と `CompositionCommitter`)ので、M2 の妨げにはならない。
41
+ scaffold したモデルの保存には効く。扱いは 7 節の問い 4。
42
+
43
+ ## 2. 範囲と順序の案
44
+
45
+ ### 2.1 突き合わせ
46
+
47
+ | anlage の項 | このリポジトリの Issue | 判定 | 0.9.0 |
48
+ |---|---|---|---|
49
+ | 17 INSTRUCTION の走査 | #47(open) | enhancement | **入れる(最優先)** |
50
+ | 22 埋め込みルートの path・name・units | 無い(新規に起票) | path と name は挙動変更、`units_list` は追加 | **入れる(最優先)** |
51
+ | 20 `required` | 無い(新規に起票) | `min_occurrences` の追加と `required` の意味の変更 | 入れる |
52
+ | 16 context の永続化 | #46(open) | bug(提案 1・2)。提案 3(`other_context`)は設計が要る | 1・2 だけ入れる |
53
+ | 23 FHIR の profile id の衝突 | #55(open) | enhancement(既定を変えるかは問い 5) | 時間があれば。無ければ 0.9.1 |
54
+ | 21 DV_DATE_TIME の部分精度 | 無い(新規に起票) | 列の追加(install の migration テンプレート)と openehr-ruby#59 が要る | **入れない** |
55
+ | 25 `template_id` の射影 | 無い | 下の 2.2 | **入れない** |
56
+ | — | #48(DV_TEXT → `code only string`) | bug。17 が入ると jp_referral で顕在化する範囲は変わらない(v0.2 の at0002 は DV_CODED_TEXT、実測) | 時間があれば。無ければ 0.9.1 |
57
+ | — | #35・#36・#37(Reserve) | 写像表の行。前提は実 fixture と臨床の判断 | **入れない**(Reserve のまま) |
58
+ | — | S1・S2(`Storable`) | bug | 問い 4 |
59
+
60
+ 19 項(`rm_type_alternatives`)は 0.8.0 で解消済み(#52、`field_extractor.rb:167`)。
61
+
62
+ ### 2.2 25 項(`template_id`)はどちらの gem で直すか
63
+
64
+ **両方に要り、AQL から見える変化は openehr-ruby の側で決まる。**
65
+
66
+ - openehr-ruby: `c/archetype_details/template_id/value` の path 評価。`path_evaluator.rb:23` の
67
+ `ALLOWED_TERMINAL_HOPS`(2.4.3 は `magnitude`・`name`・`value`)にも `path_attributes` にも `archetype_details` が無い。
68
+ 上流の計画 3.6 節は、これを 2.5.0 に入れず 2.6.0 の設計(型ごとの表)に回している
69
+ - openehr-rails: 評価器が辿れるようになっても、`RmObjectBuilder` が組む Composition に `archetype_details` が無い(1 節)。
70
+ `template_id` 列から `Archetyped` を組んで渡す変更が要る。これは `to_rm.archetype_details.template_id` で spec にできる
71
+ - 案: rails 側は Issue を起票し、上流の 2.6.0 の設計が出てから同じ版で入れる(0.9.0 には入れない)。
72
+ 先に入れても AQL では引けないので、下流の迂回(`c/name/value`)は外せない
73
+
74
+ ### 2.3 順序(1 Issue = 1 ブランチ = 1 PR、worktree は `/home/skoba/src/openehr-rails-worktrees/<slug>`)
75
+
76
+ | 順 | 項目 | 重なる行 |
77
+ |---|---|---|
78
+ | 1 | #47(17) | `field_extractor.rb:128-155`(`collect_elements`) |
79
+ | 2 | 22 | 同じ `collect_elements` と `build_field`・`field_name`。#47 のあとに切る |
80
+ | 3 | 20 | `build_field` の `required` の 1 行。22 のあとに切る |
81
+ | 4 | #46 の 1・2 | `rm/` だけ。1〜3 と並行できる |
82
+ | 5 | openehr 2.5.0 の受け入れ(下限と迂回の撤去) | `gemspec`・`opt/parser.rb`。2.5.0 の公開を待つ |
83
+ | 6 | #55、#48 | `fhir/`。並行できる |
84
+
85
+ ## 3. openehr 2.5.0 の受け入れ
86
+
87
+ ### 3.1 下限を上げるか
88
+
89
+ **案: 上げる(`'~> 2.5'`)。** 迂回(`populate_term_bindings!`)を消すと、2.5.0 より前の openehr では
90
+ `term_bindings` が nil に戻り、`code_bindings` が空になる。迂回の撤去と下限の引き上げは同じ PR にする。
91
+
92
+ - 下流: anlage は openehr を先に 2.5.0 へ上げる 2 段の計画なので、0.9.0 の下限と衝突しない
93
+ - 2.5.0 の公開が遅れた場合: この項目だけを 0.9.1 に回せる。迂回は nil ガード(`parser.rb:60`)で
94
+ 2.5.0 でも no-op になる(推論: コードの形から)ので、0.9.0 は下限 `~> 2.3` のまま出せる
95
+
96
+ ### 3.2 #31(term_bindings の迂回の撤去)
97
+
98
+ - 件数の差を固定している spec は**無い**(実測)。`parser_term_bindings_spec.rb` は `.first` と、
99
+ ファイル経由と生 XML 経由の一致だけを見る。`field_extractor_binding_spec.rb:29`・`:38` は配列の一致を見るが、
100
+ fixture の埋め込みはアーキタイプごとに 1 回で、重複が起きない
101
+ - 差そのものは実在する(推論: `parser.rb:78` の `<<` は、同じ archetype_id の `term_bindings` を出現のたびに積む)。
102
+ 重複した `code_bindings` は FHIR の `code.coding` の slice を二重に出すはずなので、撤去は不具合の解消にもなる
103
+ - Red から始める spec: 「同じアーキタイプを 2 回埋め込んだ OPT で、`code_bindings` が束縛 1 件につき 1 件」
104
+ (2.4.3 の解決では Red、2.5.0 に上げて迂回を消すと Green)。fixture は `bmi_calculation.opt` からの reduced を 1 件足す
105
+ - regression pin: 既存の 2 spec が、迂回を消したあとも通る
106
+ - 触るファイル: `openehr-rails.gemspec`、`lib/openehr_rails/opt/parser.rb:24`・`:43-102`、spec、fixture 1 件、`CHANGELOG.md`
107
+
108
+ ### 3.3 #43(制約ノードの path に `[archetype_id]`)
109
+
110
+ - `FieldExtractor` と `FshGenerator`・`ProfileGenerator` は制約ノードの `.path` を読まない(実測、0 件)。
111
+ path は `field_extractor.rb:87`・`:135-140` で自前に連結している。**#43 だけでは出力は変わらない見込み(推論)**
112
+ - spec と fixture: `.path` を期待値にしている spec は無い(grep)。fixture は変えない
113
+ - 確かめ方: 2.5.0 が公開されたあとの最初の CI(1 節のとおり自動で 2.5.0 を解決する)を canary にする。
114
+ 公開の前に master を動かさない日があれば、公開の当日に CI を 1 回再実行する
115
+ - 22 が入ると、`FieldExtractor` の path は上流の `.path` と同じ `[archetype_id]` 形にそろう。
116
+ 自前の連結をやめて `.path` に寄せる変更は、0.9.0 に入れない
117
+
118
+ ### 3.4 openehr-ruby#36(STRICT 既定化)
119
+
120
+ 番号の注意: このリポジトリの #36 は別件(診断確度の ConceptMap)。ここでいう #36 は openehr-ruby の Issue。
121
+
122
+ - 0.9.0 には入れない。`Opt::Parser#parse` は自前で Nokogiri を呼ぶ(1 節)ので、上流の既定を変えても
123
+ このリポジトリの経路には届かない。届かせるには、rails 側で同じ ParseOptions を渡す変更と、
124
+ STRICT で落ちる fixture の有無の確認が要る(未確認)
125
+ - Issue への記録は越境の書き込みになる。文面の案を下に置く(投稿するのは人間、または認可を受けたセッション。問い 6)
126
+
127
+ > openehr-rails overrides `OPTParser#parse` (`lib/openehr_rails/opt/parser.rb:14-39` at `c8a6841`) and calls
128
+ > `Nokogiri::XML::Document.parse(source)` itself, with no options. Changing the default ParseOptions in
129
+ > `OPTParser` therefore does not reach OPTs parsed through openehr-rails (uploads, the template registry,
130
+ > the FHIR profile repository). To make STRICT effective there, either expose the options as a constant or
131
+ > a hook the subclass can reuse, or move the "path or raw XML" handling upstream so the override can go.
132
+ > Not planned for openehr-rails 0.9.0.
133
+
134
+ ## 4. 下流(anlage)が期待値を決めるための例
135
+
136
+ 以下は jp_referral v0.2 に対する**試作**の出力。path は anlage の golden(26 枚)と 26 件すべて一致した
137
+ (INSTRUCTION の 20 件と、既存の 6 件)。name は 2 節の 22 の案によるもので、問い 2 で変わりうる。
138
+
139
+ 共通の前置き: `/content[openEHR-EHR-SECTION.referral_details.v0]/items[openEHR-EHR-INSTRUCTION.service_request.v1]` を `…` と書く。
140
+
141
+ ### 4.1 17 項のあと: INSTRUCTION の field
142
+
143
+ | name | path | rm_type | archetype_id |
144
+ |---|---|---|---|
145
+ | `service_request_at0121` | `…/activities[at0001]/description[at0009]/items[at0121]/value` | DV_TEXT | INSTRUCTION.service_request.v1 |
146
+ | `service_request_at0062` | `…/activities[at0001]/description[at0009]/items[at0062]/value` | DV_TEXT | 同上 |
147
+ | `service_request_at0150` | `…/activities[at0001]/description[at0009]/items[at0150]/value` | DV_TEXT | 同上 |
148
+ | `service_request_at0010` | `…/protocol[at0008]/items[at0010]/value` | DV_TEXT | 同上 |
149
+ | `service_request_at0011` | `…/protocol[at0008]/items[at0011]/value` | DV_TEXT | 同上 |
150
+
151
+ - entry は従来どおり 1 つ(`rm_type: "INSTRUCTION"`)。field は entry の `fields` に文書順で並ぶ(20 件)
152
+ - entry 自身の field の name は従来の規則のまま(宿主の concept。ラベルが非 ASCII なら at コード)
153
+ - ACTIVITY と ITEM_TREE は field にならない。path のセグメントとして現れるだけ
154
+ - `narrative`・`action_archetype_id`・`timing` は ELEMENT ではないので field にならない。0.9.0 でも出さない
155
+ - `OBSERVATION` などの `protocol` と、`ACTION.description` の ELEMENT も同じ変更で出るようになる
156
+ (既存 fixture 4 件に該当が無いことは、実装時に一覧で確かめる)
157
+
158
+ ### 4.2 22 項のあと: 埋め込みルートの field
159
+
160
+ protocol 配下(1 段目と 2 段目)。`O` は `openEHR-EHR-CLUSTER.organisation.v1`:
161
+
162
+ | name(案) | path | archetype_id |
163
+ |---|---|---|
164
+ | `organisation_at0001` | `…/protocol[at0008]/items[O]/items[at0001]/value` | CLUSTER.organisation.v1 |
165
+ | `address_at0001` | `…/protocol[at0008]/items[O]/items[openEHR-EHR-CLUSTER.address.v1]/items[at0001]/value` | CLUSTER.address.v1 |
166
+ | `electronic_communication_at0002` | `…/protocol[at0008]/items[O]/items[openEHR-EHR-CLUSTER.electronic_communication.v1]/items[at0002]/value` | CLUSTER.electronic_communication.v1 |
167
+ | `person_at0001` | `…/protocol[at0008]/items[O]/items[openEHR-EHR-CLUSTER.person.v1]/items[at0001]/value` | CLUSTER.person.v1 |
168
+ | `organisation_at0001_2` | `…/protocol[at0008]/items[O]/items[at0001]/value`(2 つめのルート。**1 行目と同じ path**) | CLUSTER.organisation.v1 |
169
+ | `organisation_at0001_3` | `…/protocol[at0008]/items[O]/items[O]/items[at0001]/value` | CLUSTER.organisation.v1 |
170
+ | `person_at0001_2` | `…/protocol[at0008]/items[O]/items[O]/items[openEHR-EHR-CLUSTER.person.v1]/items[at0001]/value` | CLUSTER.person.v1 |
171
+
172
+ 既存 fixture での変化(`lab_result_report_reduced.opt`):
173
+
174
+ | | いま(0.8.0) | 22 項のあと |
175
+ |---|---|---|
176
+ | path | `…/data[at0004]/items[at0010]/items[at0001]/value` | `…/data[at0004]/items[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1]/items[at0001]/value` |
177
+ | name | `laboratory_test_result_at0001_2` | `laboratory_test_analyte_at0001` |
178
+
179
+ 規則の案:
180
+
181
+ - **path**: 埋め込みルート(`archetype_id` を持つ子)のセグメントは `[archetype_id]`。それ以外は従来どおり `[node_id]`
182
+ - **name**: 埋め込みルート配下の field は、常に `<自アーキタイプの concept>_<ラベルの ASCII slug、無ければ at コード>`。
183
+ 要素が 1 つでも concept だけには縮めない(テンプレートに要素を足したときに列名が変わらないようにする)。
184
+ entry 自身の field は従来の規則のまま。重複は従来どおり文書順の連番(`_2`、`_3`)
185
+ - **追加のキー**: `units_list`(全 list item の units、OPT 出現順。`units` は先頭のままで変えない)
186
+ - **同じ path に複数のルートがあるとき**(organisation ×2、clinical_synopsis ×2): path は同じになる。
187
+ 区別には追加のキーを 2 つ載せる案(問い 3): `root_path`(最も近い埋め込みルート、または entry の path)と
188
+ `instance_index`(同じ path を持つ field のうち文書順で何番目か、0 始まり)。`(path, instance_index)` が一意になる。
189
+ ルート名(「紹介先医療機関」など)と name 述語つきの path は、ルートごとの term が要る(openehr-ruby#58)。
190
+ 自前の XML 再解析で補うことはしない(依存の方針)。#58 が入った版のあとに別の Issue で足す
191
+
192
+ ## 5. 項目ごとの詳細
193
+
194
+ 種別は CLAUDE.md の 3 つ(bug/enhancement/pin)。fixture の扱いは問い 1。
195
+
196
+ | 項目 | Issue | Red から始める spec の見出し | 触るファイル | anlage で撤去できる迂回(読み取りによる) |
197
+ |---|---|---|---|---|
198
+ | 17 | #47 | 「INSTRUCTION の entry が、activities/description と protocol の ELEMENT を field に持つ」「protocol 配下の埋め込み CLUSTER を 2 段目まで辿る」「既存 fixture 4 件の field 集合は変わらない」(pin)「`openehr:scaffold` が新しい field の列を作る」「0 leaf の skip-and-report は、field を持つようになった INSTRUCTION を skip のまま報告する(写像表に行が無いため)」(pin) | `lib/openehr_rails/opt/field_extractor.rb`、`spec/openehr_rails/opt/`、`spec/generators/openehr/scaffold/`、fixture 1 件、`CHANGELOG.md` | 迂回は無い。`web_template` の INSTRUCTION が 0 field → 20 field になり、M2 の D・E の対象ができる |
199
+ | 22 | 新規 | 「埋め込みルート配下の field の path が `[archetype_id]` で書かれる」「name が自アーキタイプの concept で始まる」「`units_list` が全 units を OPT 出現順に持つ」「`units` は従来どおり先頭」(pin)「埋め込みの無いテンプレートの path と name は変わらない」(pin) | `field_extractor.rb`(`collect_elements`・`build_field`・`field_name`・`quantity_constraints`)、`spec/openehr_rails/opt/field_extractor_embedded_archetype_spec.rb`、FHIR の golden(name が slice 名に出る場合。実装時に確認)、`CHANGELOG.md`(Upgrade note) | `app/models/template.rb` の `rewrite_embedded_field` と `by_gem_path` による path の訂正、`Opt::ElementConstraints` の `units_list`。`root_label` は残る(#58 待ち) |
200
+ | 20 | 新規 | 「0..1 の entry 配下の 1..1 の要素が `required: true`、`min_occurrences: 1`」「0..1 の要素は false」「entry の `required` は従来どおり entry 自身の下限」(pin)「scaffold の `validates presence` が、要素の下限で付く」 | `field_extractor.rb:174`、`spec/openehr_rails/opt/`、`spec/generators/openehr/scaffold/`、`CHANGELOG.md`(Upgrade note: 生成される validation が増える) | `Opt::ElementConstraints` の `min_occurrences` と、`template.rb:154` の `required` の上書き |
201
+ | 16 | #46(1・2) | 「`context.start_time` と `context.setting` を持つ canonical をコミットすると、`SELECT c/context/start_time/value` が値を返す」「`to_rm.context.setting` が保存したコードを返す」「kwarg の `context_start_time:` が与えられたら、そちらが優先」(pin)「`CanonicalSerializer` の往復に `context` が入る」 | `lib/openehr_rails/rm/composition_committer.rb`、`graph_builder.rb`、`rm_object_builder.rb:97-104`、`canonical_serializer.rb`、`spec/openehr_rails/rm/` | `Opt::RmCompositionCommitter` が `context_start_time:` を渡す必要がなくなる(anlage は canonical に `context` を入れるだけでよい)。`other_context` は対象外 |
202
+ | 2.5.0 | 新規 | 3.2 節 | 3.2 節 | 無い |
203
+ | 23 | #55 | 「同じアーキタイプを使う 2 テンプレートの profile id が衝突しない」「JSON と FSH が同じ id を出す」「id は 64 文字以内で `[A-Za-z0-9\-\.]` だけ」 | `lib/openehr_rails/fhir/profile_generator.rb:203`、`fsh_generator.rb:203`(1 つの表に寄せる)、`profile_repository.rb`、spec、golden FSH | `fhir/profiles_controller.rb:24-29` の先勝ち |
204
+ | — | #48 | Issue の AC のとおり | `lib/openehr_rails/fhir/type_map.rb`、両 generator、`docs/design/multi-leaf-non-observation-plan.md` | 無い |
205
+
206
+ 補足:
207
+
208
+ - **17 と写像表**: INSTRUCTION が field を持つと、`ServiceRequest` は「葉が 2 つ以上で写像表に行なし」になり、
209
+ 0.7.0 からの skip-and-report に載る(推論: `unsupported_profile_error.rb` の規則から)。プロファイルは出ない。行を足すのは #35
210
+ - **22 と保存済みデータ**: `FieldExtractor` の出力は生成時に `FIELD_MAP` へ固定されるので、既存の scaffold は変わらない。
211
+ 再 scaffold すると列名と path が変わる。Upgrade note に書く
212
+ - **20 の `required` の意味の変更**: いまは「entry が必須 かつ 要素が必須」。案は「要素自身の下限 ≥ 1」。
213
+ 0..1 の entry を持つテンプレートを scaffold し直すと `validates presence` が増え、entry を書かない保存が通らなくなる。
214
+ これを避けるには `required` を据え置いて `min_occurrences` だけを足す手がある(問い 2 に含める)
215
+
216
+ ## 6. 公開を待たずに着手できる項目と、日付の案
217
+
218
+ | 区分 | 項目 |
219
+ |---|---|
220
+ | openehr 2.5.0 の公開を待たない | #47(17)、22、20、#46 の 1・2、#55、#48、Issue の起票 |
221
+ | 2.5.0 の公開を待つ | 下限の引き上げと #31 の迂回の撤去、#43 の canary |
222
+ | 0.9.0 に入れない | 21、25、#46 の 3、#35〜#37、openehr-ruby#36 に対応する変更、`.path` への寄せ、name 述語つきの path(#58 待ち) |
223
+
224
+ | 日付 | 内容 |
225
+ |---|---|
226
+ | 11/24(火) | このゲート報告 |
227
+ | 承認の日 | Issue の起票(22、20、2.5.0 の受け入れ、21、25、S1・S2) |
228
+ | 〜11/26(木) | #47(17) |
229
+ | 〜11/27(金) | 22 |
230
+ | 〜11/28(土) | 20、#46 の 1・2 |
231
+ | 11/30(月) | openehr 2.5.0 の公開(上流の予定)。CI の canary |
232
+ | 12/1(火) | 下限の引き上げと迂回の撤去 |
233
+ | 12/2(水) | #55、#48(入る場合)。予備 |
234
+ | 12/3(木) | 棚卸し: `git diff v0.8.0..master` の実内容で semver を確定。`Release 0.9.0` → タグ `v0.9.0` → Release run の artifact と sha256 の照合 |
235
+ | 12/4(金) | `gem push`(人間)。公開 checksum の照合 |
236
+ | 12/5(土) | 期限。予備 |
237
+
238
+ - 日付は「その日までにマージされていれば次へ進める」という意味。マージは人間
239
+ - **切り方**: 12/2 の終わりに master に入っていないものは 0.9.1 に回す。優先は 17 → 22 → 20 → 16 → 2.5.0 の受け入れ → 23 → #48。
240
+ 17 と 22 が 12/2 に入っていなければ、タグを遅らせるか 17 だけで出すかを再裁定に上げる
241
+ - semver の見込みは minor(0.x)。根拠は 17(出力が増える)と 22(path と name が変わる)。最終判定は 12/3 の実内容で行う
242
+
243
+ ## 7. 裁定を求める点
244
+
245
+ 1. **INSTRUCTION を持つ fixture。** このリポジトリに無い。案: `skoba/openehr-templates-jp` の `jp_referral.opt` v0.2 を
246
+ real として入れる(anlage の fixture と同じコミットを出所に書く)。入れてよいか(公開リポジトリへの収載は人間の判断)。
247
+ 不可なら、それからの reduced を作る。#47 と 22 の spec、#37 の前提がこれで決まる
248
+ 2. **name と `required` の規則**(4.2 節、5 節の補足)。(a) 埋め込みルート配下の name を「常に `<自 concept>_<slug または at コード>`」とする案でよいか。
249
+ (b) `required` を「要素自身の下限」に変えるか、据え置いて `min_occurrences` だけを足すか。案は (b) も変える
250
+ 3. **同じ path の複数ルートの区別。** `root_path` と `instance_index` を追加のキーとして 0.9.0 に入れるか。
251
+ 入れなければ、anlage は「path と出現順」の対応を自前で持ち続ける
252
+ 4. **`Storable` の書き込み経路(S1・S2)。** 17 が入ると、INSTRUCTION を持つテンプレートの scaffold が列を持つようになり、
253
+ 保存すると壊れた Composition を作りうる(SECTION 配下と埋め込み CLUSTER は 0.8.0 でも同じ)。
254
+ 案: 0.9.0 では bug として起票し、CHANGELOG の Known limitations に書く。修正は 0.9.1。0.9.0 に入れるなら 22 のあとに 2 日ぶん延びる
255
+ 5. **#55 の既定。** テンプレートで修飾した id を既定にするか(既存の id が変わる)、オプションにするか。
256
+ 案: 既定にする(0.x の minor。Upgrade note に書く)。id の形は `openehr-<template_id の slug>-<アーキタイプの slug>` を 64 文字に収める
257
+ 6. **Issue の起票と、openehr-ruby#36 への記録。** (a) 承認を待たずに、このリポジトリへ Issue 7 件(6 節)を起票してよいか。
258
+ (b) 3.4 節の文面を openehr-ruby#36 に投稿するのは誰か
259
+ 7. **下限 `'~> 2.5'`**(3.1 節)でよいか
260
+
261
+ ## 8. gem 側(openehr-ruby)に頼む問い
262
+
263
+ 1. #58 は 2.5.0 に入るか。入るなら、name 述語つきの path とルート名を 0.9.1 で扱える
264
+ 2. 2.5.0 で `OPTParser` が入れる `term_bindings` は、`OpenehrRails::Opt::Parser#parse`(上書きした `parse`。`definition` を呼ぶ)の経路でも入るか。
265
+ 入らなければ、迂回を消すと `code_bindings` が空になる(3.2 節の spec が Red のまま残るので検出はできる)
266
+
267
+ ## 9. ゲートへの回答(R-20261124-7)と、本書からの変更点
268
+
269
+ 回答の本文は裁定台帳にある。ここには、本書の案から変わった点だけを書く。
270
+
271
+ - 問い 1: `jp_referral.opt` v0.2 を real の fixture として入れる。v0.2 に固定する
272
+ - 問い 2: (a) は案のとおり。(b) は案と異なり、**`required` の意味は変えない**。`min_occurrences` だけを追加のキーとして載せる。
273
+ 5 節の 20 の行のうち、`required: true` になるという見出しと、scaffold の `validates presence` が増えるという見出しは採らない。
274
+ 条件つきの必須(entry を書くなら必須)を validation でどう表すかは、別の Issue にする(0.9.0 の外)
275
+ - 問い 3: `root_path` と `instance_index` を、22 と同じ PR で 0.9.0 に入れる
276
+ - 問い 4: S1・S2 は bug として起票し、修正は 0.9.1。**0.9.0 には歯止めを入れる**(17 のあと、別の Issue と PR):
277
+ 正しく組めない形を含むテンプレートでは、`Storable` が壊れた `rm_content` を出さず、理由を添えて止まる
278
+ - 問い 5: 案のとおり(テンプレートで修飾した id を既定にする)。間に合わなければ 0.9.1
279
+ - 問い 6: Issue は起票する。openehr-ruby#36 への記録は、このセッションは行わない
280
+ - 問い 7: 案のとおり。着手の条件は openehr 2.5.0 の公開
281
+ - 公開の時期: 6 節の日付は採らない。17 と 22(問い 3 のキーを含む)が master に入った時点で棚卸しに進み、
282
+ そのとき master にある項目で 0.9.0 を出す。残りは 0.9.1
283
+ - 進め方: R-20261124-8 による(CLAUDE.md「全開の進め方」)。変更履歴は `changelog.d/` の断片に書く
284
+
@@ -228,6 +228,14 @@ deliberately *not* emitted is in 8.2.
228
228
  current behaviour.** The ruling scopes this fix to `problem_diagnosis`; the
229
229
  `INSTRUCTION`→`ServiceRequest` case (`request-referral`, arriving with
230
230
  referral v2) is reserved as its own Issue rather than generalised here.
231
+ - **`at0070` 最終更新日 (`protocol[at0032]`, `DV_DATE_TIME`) has no row and is left
232
+ out of the profile.** Added 2026-11-24 with #47: `FieldExtractor` now descends
233
+ `protocol`, so this leaf reaches the generators for the first time (8.1's "all
234
+ five leaves land" was written when only `data` was descended). Both generators
235
+ skip a leaf that has no row, so the emitted profile is unchanged. Whether it
236
+ should map anywhere (the nearest candidate, `Condition.meta.lastUpdated`, is
237
+ resource metadata rather than a clinical element) is undecided; it is recorded
238
+ here as an omission, not as a judgment that it is unmappable.
231
239
 
232
240
  ## 8.3 Where the table lives
233
241