

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 를 사용하여 FHIR 리소스 검증 `$validate`
<a name="reference-fhir-operations-validate"></a>

AWS HealthLake 는 이제 FHIR 리소스에 대한 `$validate` 작업을 지원하므로 스토리지 작업을 수행하지 않고도 FHIR 사양에 따라 리소스를 검증하고 지정된 프로필 또는 기본 리소스 정의에 대한 적합성을 확인할 수 있습니다. 이 작업은 다음이 필요한 경우에 특히 유용합니다.
+ FHIR CMS 규정 준수 요구 사항 검증
+ 프로덕션에서 사용하기 전에 리소스 테스트
+ 사용자가 임상 데이터를 편집할 때 실시간 검증 피드백 제공
+ 잘못된 데이터 제출을 줄여 APIs 생성 및 업데이트

## 사용법
<a name="validate-usage"></a>

POST 메서드를 사용하여 FHIR 리소스에서 `$validate` 작업을 호출할 수 있습니다.

**지원되는 작업**  


```
POST [base]/[type]/[id]/$validate
POST [base]/[type]/$validate
```

## 지원되는 페이로드
<a name="validate-payloads"></a>

**파라미터 리소스**  


HealthLake는 다음 FHIR `$validate` 파라미터를 지원합니다.


| 파라미터 | Type | 필수 | 설명 | 
| --- | --- | --- | --- | 
| resource | Resource | 예 | 검증할 리소스 | 
| profile | canonical | 아니요 | 검증할 프로필의 정식 URL | 
| mode | code | 아니요 | 검증 모드: create또는 update | 

**쿼리 파라미터가 있는 다이렉트 리소스**  



| 파라미터 | Type | 필수 | 설명 | 
| --- | --- | --- | --- | 
| profile | canonical | 아니요 | 검증할 프로필의 정식 URL | 
| mode | code | 아니요 | 검증 모드: create또는 update | 

## 예제
<a name="validate-examples"></a>

**ID 및 파라미터 페이로드를 사용한 리소스에 대한 POST 요청**  


```
POST [base]/Patient/example-patient/$validate
Content-Type: application/fhir+json

{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "resource",
      "resource": {
        "resourceType": "Patient",
        "id": "example-patient",
        "name": [
          {
            "family": "Smith",
            "given": ["John"]
          }
        ],
        "gender": "male",
        "birthDate": "1990-01-01"
      }
    },
    {
      "name": "profile",
      "valueCanonical": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"
    },
    {
      "name": "mode",
      "valueString": "create"
    }
  ]
}
```

**리소스 유형 및 파라미터 페이로드에 대한 POST 요청**  


```
POST [base]/Patient/$validate
Content-Type: application/fhir+json

{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "resource",
      "resource": {
        "resourceType": "Patient",
        "name": [
          {
            "family": "Doe",
            "given": ["Jane"]
          }
        ],
        "gender": "female",
        "birthDate": "1985-05-15"
      }
    },
    {
      "name": "profile",
      "valueCanonical": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"
    },
    {
      "name": "mode",
      "valueString": "update"
    }
  ]
}
```

**ID 및 직접 리소스 페이로드가 있는 리소스에 대한 POST 요청**  


```
POST [base]/Patient/example-patient/$validate?profile={{http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient&mode=create}}
Content-Type: application/fhir+json

{
    "resourceType": "Patient",
    "id": "example-patient",
    "name": [
        {
        "family": "Smith",
        "given": ["John"]
        }
    ],
    "gender": "male",
    "birthDate": "1990-01-01"
}
```

**리소스 유형 및 직접 리소스 페이로드에 대한 POST 요청**  


```
POST [base]/Patient/$validate?profile={{http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient&mode=create}}
Content-Type: application/fhir+json

{
    "resourceType": "Patient",
    "id": "example-patient",
    "name": [
        {
        "family": "Smith",
        "given": ["John"]
        }
    ],
    "gender": "male",
    "birthDate": "1990-01-01"
}
```

**샘플 응답**  
작업은 검증 결과와 함께 OperationOutcome 리소스를 반환합니다.

```
{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "information",
      "code": "informational",
      "diagnostics": "Validation successful"
    }
  ]
}
```

**검증 오류가 있는 샘플 응답**  


```
{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "required",
      "details": {
        "text": "Missing required element"
      },
      "diagnostics": "Patient.identifier is required by the US Core Patient profile",
      "location": [
        "Patient.identifier"
      ]
    },
    {
      "severity": "warning",
      "code": "code-invalid",
      "details": {
        "text": "Invalid code value"
      },
      "diagnostics": "The provided gender code is not from the required value set",
      "location": [
        "Patient.gender"
      ]
    }
  ]
}
```

## 동작
<a name="validate-behavior"></a>

`$validate` 작업:

1. FHIR 사양 및 기본 리소스 정의를 기준으로 리소스를 검증합니다.

1. `profile` 파라미터가 제공될 때 지정된 프로필에 대한 적합성을 확인합니다.

1. 지정된 모드(`create` 또는 `update`)를 기반으로 검증합니다.

1. 오류, 경고 및 정보 메시지를 포함한 자세한 검증 결과를 반환합니다.

1. 스토리지 작업을 수행하지 않음 - 검증만 수행

1. 검증 문제가 있는지 여부에 관계없이 검증을 수행할 수 있을 때 HTTP 200 OK를 반환합니다.

## 검증 모드
<a name="validate-modes"></a>
+ **create**: 리소스를 생성 중인 것처럼 검증합니다(새 리소스).
+ **update**: 리소스가 업데이트되는 것처럼 확인합니다(기존 리소스).

## 오류 처리
<a name="validate-error-handling"></a>

작업은 다음을 반환합니다.
+ 200 OK: 검증이 성공적으로 수행되었습니다(검증 결과와 무관).
+ 400 잘못된 요청: 잘못된 요청 형식 또는 파라미터
+ 404 찾을 수 없음: 리소스 유형 또는 프로필을 찾을 수 없음

`$validate` 작업 사양에 대한 자세한 내용은 [FHIR R4 리소스 `$validate`](https://www.hl7.org/fhir/R4/operation-resource-validate.html) 설명서를 참조하세요.