スキルOfficialdevelopment
📋idmp-attribute
- プラグイン
- idmp-plugin
- ソース
- GitHub で見る ↗
説明
IDMP属性スキル(医薬品情報の属性を扱う機能) 定義と値の読み取り、履歴の確認、式の評価、名前の予約、テストデータの安全な書き込みを行うためのスキルです。
原文を表示
IDMP attribute skill for reading definitions and values, checking history, evaluating expressions, reserving names, and safely writing test data.
ユースケース
- ✓医薬品情報の属性を定義・値を読み取る
- ✓属性の履歴を確認するとき
- ✓属性に関する式を評価するとき
- ✓属性の名前を予約するとき
- ✓テストデータを安全に書き込むとき
本文(日本語訳)
attribute(属性)
まず../idmp-shared/SKILL.mdを読んでください。
書き込み操作の前に: 🛑 破壊的操作の確認プロトコルに従ってください。読み取り専用コマンドはここで読み取り専用のままですが、削除・書き込み・更新の処理には、共有の承認ゲートが必要です。
推奨ショートカット
| ショートカット | 目的 |
|---|---|
+list |
値または履歴の操作を始める前に、属性の定義を読む。 |
+get |
ある属性の現在の値を読む。 |
+data |
複数の現在の値を1つのリクエストで読む。 |
+history |
ある属性の履歴データを読む。 |
推奨資料
製品スタイルのワークフロー
attributesで定義を読む。- 必要な場合のみ、
data-getまたはdata-postで現在の値を読む。 - 属性を作成する前に、
--ack-riskなしでnew-nameを実行する。 - 計算式(フォーミュラ)または式を保存する前に、
attribute evaluate-expression createを実行する。 - メトリック(数値測定値)に基づいた属性に制御された試験入力が必要な場合のみ、
write-dataを使う。
最初に解決すべき不足した情報
| 情報 | 属性の作成または書き込みの前に解決が必要な理由 |
|---|---|
| 所有元素 | 名前の確保、属性の作成、定義と値の再読み込みを行うには、最終的なelementIdが必要です。 |
| 候補となる属性名 | attribute attributes new-nameは、所有元素が確定した後でのみ機能します。 |
| 属性タイプ計画 | 属性のvalueType(値の種類)と、その属性がメタデータのみ、計算式に基づくもの、またはメトリックに基づいた書き込み可能な参照かを決める必要があります。 |
| 書き込み先 | write-dataを新規に作成した属性ではなく、既存のTDengine(時系列データベース)メトリック参照に向けるかを判断します。 |
| 検証とクリーンアップの対象 | 作成の成功を証明する方法、書き込まれたデータを再読み込みする方法、最後に削除する必要がある一時的な属性を決めます。 |
制限された実際の動作
attribute attributes new-nameは所有元素のスコープのみが必要ですが、attributes-postは確保済みの最終的な名前と実際のvalueTypeを使う必要があります。- 計算式プレビューコマンドの系統は
attribute evaluate-expression createであり、スキーマパスはattribute.evaluate-expression.createです。古い推測値であるattribute.attributes.evaluate-expressionパスは間違っています。 - 古いチェックでは推測値の
attribute.attributes.evaluate-expressionパスが記載されている場合があります。実際のリクエストにはidmp-cli attribute evaluate-expression create --dry-run --ack-risk --paramsを使ってください。 attribute evaluate-expression createには、最低限dataReferenceTypeとexpressionを含むリクエスト本文が必要です。実運用での安全な開始は{"dataReferenceType":"Formula","expression":"..."}です。attributeIdとuomIdはオプションの文脈ヘルパーであり、計算式テキストの代替ではありません。- 新規に作成された汎用属性は、自動的にはTDengineメトリック参照ではありません。対象属性が書き込み可能なメトリックストレージに基づいていない限り、
attribute write-data createはetda390037エラーで失敗することがあります。 - 厳密な実運用検証では、
attribute historydata listは周囲のデフォルト値に頼るのではなく、明示的なstartとendの範囲を使うべきです。 - 属性の作成は、
attributesの再読み込みで新しい定義が同じ所有元素の下に表示されるまで、完了しません。 - テンプレートから派生した属性は、汎用的なスクラッチオブジェクトではありません。属性がまだ
attrTempIdを持つ場合、汎用のattribute elements attributes-deleteパスはバックアップのテンプレートが存在するため、削除を拒否することが予想されます。 - 一時的なプローブ属性(試験用属性)は、
write-data検証で異なる既存のメトリック基盤属性を使った場合でも、ワークフロー後に削除すべきです。
完了の証拠
- 作成は、
attribute elements attributes --paramsで新しい定義が同じ所有元素の下で再読み込みされた時のみ完了します。 - 値のプローブ(試験)は、
data-get、data-post、または範囲指定されたhistorydata listが意図した属性データを返すときのみ完了します。 - 書き込みのプローブは、対象がメトリック基盤であることが判明し、再読み込みがCLI成功行ではなく挿入行を反映したときのみ完了します。
主要コマンド
idmp-cli schema attribute.elements.attributes
idmp-cli attribute elements attributes --params '{"elementId":1}'
idmp-cli schema attribute.attributes.new-name
# new-nameは読み取り専用(名前を確保)。--ack-riskは不要です
idmp-cli attribute attributes new-name --params '{"elementId":1}'
idmp-cli schema attribute.elements.attributes-post
idmp-cli attribute elements attributes-post --ack-risk --params '{"elementId":1}' --data '{"name":"probe-attribute","valueType":"Double"}'
idmp-cli schema attribute.evaluate-expression.create
idmp-cli attribute evaluate-expression create --params '{"elementId":1}' --data '{...}' --dry-run --ack-risk
idmp-cli schema attribute.attributes.data-get
idmp-cli attribute attributes data-get --params '{"elementId":1,"attributeId":2}'
idmp-cli schema attribute.historydata.list
idmp-cli attribute historydata list --params '{"elementId":1,"attributeId":2,"current":1,"size":20,"start":1704067200000,"end":1704153600000}'
例外と失敗への対応
attributesで属性が返されない場合、古いノートやスクリプトからIDを推測しないでください。- 定義は存在するが現在の値が空の場合、製品のエラーと判断する前に履歴を確認してください。
new-nameが別の候補を返す場合は、元の名前を無理に使わず、確保済みの値を使ってください。- 計算式の評価が失敗した場合、最初に壊れた式を保存するのではなく、計算式を修正してから作成または更新してください。
- テスト書き込みが
etda390037などのエラーで拒否された場合、新規に作成した属性が書き込み可能だと仮定せず、判明済みのメトリック基盤属性に切り替えてください。 - 属性テンプレートから来た属性のため削除が失敗した場合、これをスコープの境界として扱い、汎用要素属性削除パスの再試行を続けないでください。
- プレビューが意図したペイロードと異なる場合、スキーマとパーミッション(アクセス権限)が正しくなるまで読み取り専用のままにしてください。
検証シナリオ
idmp-cli schema attribute.elements.attributesとidmp-cli attribute elements attributes --params '{"elementId":1}'で属性定義を読む。idmp-cli attribute attributes new-name --params '{"elementId":1}'で作成安全な名前を確保する。idmp-cli attribute attributes data-get --params '{"elementId":1,"attributeId":2}'で1つの実運用値を読む。idmp-cli attribute attributes new-name --params '{"elementId":1}'の後、プローブ属性を作成する。次にidmp-cli attribute elements attributes-post --ack-risk --params '{"elementId":1}' --data '{"name":"probe-attribute","valueType":"Double"}'で作成パスを検証する。idmp-cli attribute historydata list --params '{"elementId":1,"attributeId":2,"current":1,"size":20,"start":1704067200000,"end":1704153600000}'で履歴ページングを確認してから、対象属性が書き込み可能なメトリック参照であることが確認でき、かつidmp-cli attribute evaluate-expression create --params '{"elementId":1}' --data '{"dataReferenceType":"Formula","expression":"AVG(${attributes['"'"'Current'"'"']})"}' --dry-run --ack-riskが既に成功した後、idmp-cli attribute write-data create --dry-run --ack-risk --params '{"elementId":1}' --data '{"probe":"example"}'のみを使う。
原文(English)を表示
attribute
Read ../idmp-shared/SKILL.md first.
Before any write: Follow the 🛑 Destructive op confirmation protocol. Read-only commands stay read-only here, but delete / write / patch flows still require the shared yes-gate.
Recommended shortcuts
| Shortcut | Purpose |
|---|---|
+list |
Read attribute definitions before value or history work. |
+get |
Read one attribute's current value. |
+data |
Read multiple current values in one request. |
+history |
Read historical data for one attribute. |
Recommended references
Product-style workflow
- Read definitions with
attributes. - Read current values with
data-getordata-postonly when needed. - Run
new-namewithout--ack-riskbefore creating an attribute. - Run
attribute evaluate-expression createbefore saving a formula or expression. - Use
write-dataonly when you need controlled test input on a metric-backed attribute.
Missing context to resolve first
| Context | Why it must be resolved before create or write |
|---|---|
| Owner element | You need the final elementId before you can reserve names, create the attribute, or reread definitions and values. |
| Candidate attribute name | attribute attributes new-name only works after the owner is fixed. |
| Attribute type plan | You need the intended valueType and whether the attribute is only metadata, expression-backed, or a metric-backed writable reference. |
| Write target | Decide whether write-data should target an existing TDengine metric reference rather than the newly created attribute. |
| Verification and cleanup target | Decide how you will prove create success, how you will reread written data, and which temporary attribute must be deleted at the end. |
Constrained live behaviors
attribute attributes new-nameonly needs the owner scope, butattributes-postmust use the final reserved name and a realvalueType.- The expression-preview command family is
attribute evaluate-expression create, and the schema path isattribute.evaluate-expression.create; the older guessedattribute.attributes.evaluate-expressionpath is wrong. - Older checks may still mention the guessed
attribute.attributes.evaluate-expressionpath; useidmp-cli attribute evaluate-expression create --dry-run --ack-risk --paramsfor the real request. attribute evaluate-expression createneeds a request body with at leastdataReferenceTypeandexpression. The live-safe starter is{"dataReferenceType":"Formula","expression":"..."};attributeIdanduomIdare optional context helpers, not substitutes for the formula text.- A newly created generic attribute is not automatically a TDengine metric reference.
attribute write-data createcan fail withetda390037unless the target attribute is backed by writable metric storage. - In strict live validation,
attribute historydata listshould use explicitstartandendbounds instead of relying on ambient defaults. - Attribute create is not complete until
attributesreread shows the new definition. - Template-derived attributes are not generic scratch objects. If an attribute still has
attrTempId, the genericattribute elements attributes-deletepath is expected to reject the delete while the backing template exists. - Temporary probe attributes should be deleted after the workflow, even when write-data validation used a different existing metric-backed attribute.
Evidence of completion
- A create is only complete when
attribute elements attributes --paramsrereads the new definition under the same owner. - A value probe is only complete when
data-get,data-post, or boundedhistorydata listreturns the intended attribute data. - A write probe is only complete when the target is known to be metric-backed and the reread reflects the inserted row, not just the CLI success line.
Key commands
idmp-cli schema attribute.elements.attributes
idmp-cli attribute elements attributes --params '{"elementId":1}'
idmp-cli schema attribute.attributes.new-name
# new-name is read-only (reserves a name); no --ack-risk required
idmp-cli attribute attributes new-name --params '{"elementId":1}'
idmp-cli schema attribute.elements.attributes-post
idmp-cli attribute elements attributes-post --ack-risk --params '{"elementId":1}' --data '{"name":"probe-attribute","valueType":"Double"}'
idmp-cli schema attribute.evaluate-expression.create
idmp-cli attribute evaluate-expression create --params '{"elementId":1}' --data '{...}' --dry-run --ack-risk
idmp-cli schema attribute.attributes.data-get
idmp-cli attribute attributes data-get --params '{"elementId":1,"attributeId":2}'
idmp-cli schema attribute.historydata.list
idmp-cli attribute historydata list --params '{"elementId":1,"attributeId":2,"current":1,"size":20,"start":1704067200000,"end":1704153600000}'
Exception and failure handling
- If an attribute is not returned by
attributes, do not guess the ID from older notes or scripts. - If the definition exists but the current value is empty, check history before treating it as a product failure.
- If
new-namereturns a different candidate, use the reserved value instead of forcing the original name. - If expression evaluation fails, fix the formula before create or update; do not save a broken expression first.
- If test writes are rejected with errors such as
etda390037, switch to a known metric-backed attribute; do not assume the newly created attribute is writable. - If delete fails because the attribute came from an attribute template, treat that as a scope boundary; do not keep retrying the generic element-attribute delete path.
- If the preview differs from the intended payload, stay read-only until the schema and permissions are correct.
Validation scenarios
- Read attribute definitions with
idmp-cli schema attribute.elements.attributesandidmp-cli attribute elements attributes --params '{"elementId":1}'. - Reserve a create-safe name with
idmp-cli attribute attributes new-name --params '{"elementId":1}'. - Read one live value with
idmp-cli attribute attributes data-get --params '{"elementId":1,"attributeId":2}'. - Create a probe attribute only after
idmp-cli attribute attributes new-name --params '{"elementId":1}', then verify the create path withidmp-cli attribute elements attributes-post --ack-risk --params '{"elementId":1}' --data '{"name":"probe-attribute","valueType":"Double"}'. - Check history paging with
idmp-cli attribute historydata list --params '{"elementId":1,"attributeId":2,"current":1,"size":20,"start":1704067200000,"end":1704153600000}', then useidmp-cli attribute write-data create --dry-run --ack-risk --params '{"elementId":1}' --data '{"probe":"example"}'only after confirming the target attribute is a writable metric reference andidmp-cli attribute evaluate-expression create --params '{"elementId":1}' --data '{"dataReferenceType":"Formula","expression":"AVG(${attributes['"'"'Current'"'"']})"}' --dry-run --ack-riskalready succeeded.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。