バリデーション
FRUCtoS サーバへの登録・更新を行う前に、基底仕様、及び指定されたプロファイルに対してリソースを検証します。
リソースが仕様に準拠していない場合は、処理を中断し、検証エラーの内容を含むレスポンスを返却します。
エラーメッセージ
検証結果がエラーの場合はエラーの内容を含む OperationOutcome リソースが返却されます。
(例)Bundle リソースの制約(bdl-8)に反していた場合
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "fatal",
"code": "invalid",
"details": {
"text": "Resource validation failed. Details: line:6, location:Bundle, message:bdl-8: fullUrl cannot be a version specific reference [fullUrl.contains('/_history/').not()], type:INVARIANT, level:ERROR"
},
"diagnostics": "Resource validation failed. Details: line:6, location:Bundle, message:bdl-8: fullUrl cannot be a version specific reference [fullUrl.contains('/_history/').not()], type:INVARIANT, level:ERROR"
}
]
}
検証実行中に予期しないエラーが発生し、検証を続行できなかった場合は以下のエラーメッセージを含む OperationOutcome リソースが返却されます。
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "fatal",
"code": "invalid",
"details": {
"text": "Resource validation failed."
},
"diagnostics": "Resource validation failed."
}
]
}
検証項目
FHIR 仕様に従って、以下の項目を検証します。
# | 検証項目 | 詳細 |
---|---|---|
1 | リソース構造の妥当性 | リソース内の全てのコンテンツが仕様で定義されており、余分な要素が出現していないことを検証する |
2 | 多重度 | 全ての要素の多重度が定義された多重度に反していないことを検証する |
3 | データ型 | 全ての要素の値が定義されたデータ型の仕様に準拠していることを検証する |
4 | バインディング | Coding / CodeableConcept 型で指定されたコードが有効であることを検証する ※外部 TerminologyService の利用設定を「 ON 」に設定している場合のみ |
5 | 制約 | 定義された制約に準拠していることを検証する |
6 | プロファイル | プロファイルで定義された仕様に準拠していることを検証する |
7 | Questionnaires | Questionnaire リソースに対して、QuestionnaireResponse リソースが有効であることを検証する |
8 | Bundle | Document, Message のリファレンス要素を検証する |
リソース構造の妥当性
仕様で定義されていない要素を含む場合はエラーを返却します。
(例)リソース内に不正な要素が存在する場合
- リクエストボディ
- Patient リソースに仕様で定義されていない
test
要素を指定
- Patient リソースに仕様で定義されていない
{
"resourceType": "Patient",
"id": "1",
"active": true,
"test": "example",
"gender": "male"
}
- レスポンスボディ
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "fatal",
"code": "invalid",
"details": {
"text": "Resource validation failed. Details: line:5, location:Patient, message:Unrecognised property '@test', type:STRUCTURE, level:ERROR"
},
"diagnostics": "Resource validation failed. Details: line:5, location:Patient, message:Unrecognised property '@test', type:STRUCTURE, level:ERROR"
}
]
}
多重度
多重度が仕様に準拠していない場合はエラーを返却します 。
(例)必須要素が存在しない場合
- リクエストボディ
- Observation リソースに
status
要素(1..1)を指定していない
- Observation リソースに
{
"resourceType": "Observation",
"id": "f001",
"identifier": [
{
"use": "official",
"system": "http://www.bmc.nl/zorgportal/identifiers/observations",
"value": "6323"
}
],
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "15074-8",
"display": "Glucose [Moles/volume] in Blood"
}
]
},
[etc]
}
- レスポンスボディ
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "fatal",
"code": "invalid",
"details": {
"text": "Resource validation failed. Details: line:1, location:Observation, message:Profile http://hl7.org/fhir/StructureDefinition/Observation, Element 'Observation.status': minimum required = 1, but only found 0, type:STRUCTURE, level:ERROR"
},
"diagnostics": "Resource validation failed. Details: line:1, location:Observation, message:Profile http://hl7.org/fhir/StructureDefinition/Observation, Element 'Observation.status': minimum required = 1, but only found 0, type:STRUCTURE, level:ERROR"
}
]
}
(例)複数指定不可の要素が1つ以上存在する場合
-
独自 Observation プロファイル
Observation.category
のmax
値を「 1 」と定義
-
リクエストボディ
- Observation リソースの
category
要素(1..1)を複数指定
- Observation リソースの
{
"resourceType": "Observation",
"id": "f005",
"meta": {
"profile": [
"http://jpfhir.jp/fhir/StructureDefinition/JP_Observation_LabResult"
]
},
"identifier": [
{
"use": "official",
"system": "http://www.bmc.nl/zorgportal/identifiers/observations",
"value": "6327"
}
],
"status": "final",
"category": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/observation-category",
"code": "laboratory",
"display": "Laboratory"
}
],
"text": "Laboratory"
},
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/observation-category",
"code": "vital-signs",
"display": "Vital Signs"
}
],
"text": "Vital Signs"
}
],
[etc]
}