사용자 동의 만들기 및 업데이트

이 페이지에서는 사용자 동의를 생성, 업데이트, 취소하는 방법을 설명합니다.

애플리케이션은 동의 아티팩트와 동의를 개별적으로 기록합니다. Consent Management API는 사용자의 동의와 관련된 민감한 정보를 ConsentArtifact로 저장합니다. ConsentArtifact에는 서명 타임스탬프, 서명의 이미지 또는 동의의 '증명' 역할을 하는 기타 문서가 포함될 수 있습니다.

Consent Management API는 민감하지 않은 동의 데이터를 Consent 객체로 저장합니다. Consent에는 비공개 사용자 ID, 사용자가 허용한 동의 정책, 동의 정책 상태가 포함됩니다.

동의 및 동의 아티팩트에는 고유한 리소스 경로가 있기 때문에 동의 아티팩트의 민감한 동의 데이터에 대한 액세스를 최소화하기 위해 독립적으로 권한을 설정할 수 있습니다.

동의 지원에는 동의가 만료되고 더 이상 유효하지 않은 경우에 구성할 수 있는 만료 기간을 지원합니다. 만료 기간은 특정 날짜 또는 기간(예: 1년)으로 설정할 수 있습니다.

동의 저장소를 만드는 동안 동의 저장소의 기본 만료 기간을 구성할 수 있습니다. 동의를 만드는 동안 동의의 만료 기간을 구성할 수 있습니다. 동의 생성 중에 설정된 만료 기간은 동의 저장소에 설정된 기본 기간을 재정의합니다.

동의는 ACTIVE 또는 DRAFT 상태로 만들 수 있습니다. ACTIVE 상태의 동의는 Consent Management API에서 액세스 결정을 내리는 데 사용됩니다. DRAFT 상태의 동의는 액세스 결정 요청에 지정된 경우 액세스 결정에만 사용됩니다. 동의를 업데이트하여 상태를 DRAFT에서 ACTIVE 또는 REJECTED로 변경할 수 있습니다.

사용자 동의를 기록하려면 projects.locations.datasets.consentStores.consentArtifacts.create 메서드를 사용하여 동의 아티팩트를 만든 다음 projects.locations.datasets.consentStores.consents.create 메서드를 사용하여 만든 동의에 동의 아티팩트를 연결합니다.

이 페이지의 샘플은 동의 저장소를 생성하고 동의 정책을 구성했다고 가정합니다.

동의 아티팩트에는 사용자 동의와 관련된 민감한 데이터가 저장됩니다. 동의 아티팩트에는 사용자의 연락처 정보, 서명 타임스탬프, 서명 또는 동의 '증명' 역할을 하는 기타 문서의 이미지가 포함될 수 있습니다.

동의 아티팩트를 만들려면 projects.locations.datasets.consentStores.consentArtifacts.create 메서드를 사용합니다. POST 요청을 수행하고 다음 정보를 요청에 지정합니다.

  • 부모 동의 저장소 이름
  • 동의를 제공한 사용자를 나타내는 고유한 비공개 사용자 ID.
  • 서명 이미지, 타임스탬프, 기타 메타데이터를 선택적으로 포함하는 사용자의 서명. 이 이미지는 Cloud Storage의 이미지 위치 또는 원시 바이트 문자열로 지정할 수 있습니다.
  • 선택적 보호자 또는 감시 서명
  • (선택사항) 서명 이미지, 모바일 동의 흐름의 화면을 캡처한 이미지, 서명된 PDF 문서와 같이 동의 '증명'을 보여주는 이미지 또는 문서. 이러한 이미지는 Cloud Storage의 위치 또는 원시 바이트의 문자열로 지정할 수 있습니다.
  • 사용자에게 표시된 동의 정보의 식별자
  • (선택사항) 사용자의 동의와 관련된 메타데이터
  • 액세스 토큰

다음 샘플은 curl을 사용하는 POST 요청을 보여줍니다.

curl -X POST \
    -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
    -H "Content-Type: application/consent+json; charset=utf-8" \
    --data "{
       'user_id': 'USER_ID',
       'user_signature' : {
         'user_id': 'USER_ID',
         'image': {
           'gcs_uri': 'gs://IMG_URI' },
         'signature_time': {
           'seconds': EPOCH_SECONDS },
      },
       'consent_content_screenshots': [
         { 'raw_bytes': 'BASE_64_IMAGE' }],
       'consent_content_version': 'v1',
       'metadata': {'client': 'mobile'}
    }" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts"

요청이 성공하면 서버는 다음 샘플과 비슷한 응답을 JSON 형식으로 반환합니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_RESOURCE_ID",
  "userId": "USER_ID",
  "userSignature": {
    "userId": "USER_ID",
    "signatureTime": "SIGNATURE_TIME"
  },
  "consentContentVersion": "v1",
  "metadata": {
    "client": "mobile"
  }
}

다음 샘플은 Windows PowerShell을 사용한 POST 요청을 보여줍니다.

$cred = gcloud auth application-default print-access-token
$headers = @{ Authorization = "Bearer $cred" }

Invoke-WebRequest `
  -Method Post `
  -Headers $headers `
  -ContentType: "application/consent+json; charset=utf-8" `
  -Body "{
       'user_id': 'USER_ID',
       'user_signature' : {
         'user_id': 'USER_ID',
         'image': {
           'gcs_uri': 'gs://IMG_URI' },
         'signature_time': {
           'seconds': EPOCH_SECONDS }
      },
       'consent_content_screenshots': [
         { 'raw_bytes': 'BASE_64_IMAGE' }],
       'consent_content_version': 'v1',
       'metadata': {'client': 'mobile'}
    }" `
  -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts" | Select-Object -Expand Content

요청이 성공하면 서버는 다음과 같은 JSON 형식의 응답을 반환합니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_RESOURCE_ID",
  "userId": "USER_ID",
  "userSignature": {
    "userId": "USER_ID",
    "signatureTime": "SIGNATURE_TIME"
  },
  "consentContentVersion": "v1",
  "metadata": {
    "client": "mobile"
  }
}

동의에는 비공개 사용자 ID, 사용자가 부여한 동의 정책, 동의 정책의 현재 유효성 여부 등 민감하지 않은 데이터가 저장됩니다.

데이터 세트를 만들려면 projects.locations.datasets.consentStores.consents.create 메서드를 사용합니다. POST 요청을 수행하고 다음 정보를 요청에 지정합니다.

  • 부모 동의 저장소 이름
  • 동의를 제공한 사용자를 나타내는 고유한 비공개 사용자 ID.
  • 최대 10개의 동의 정책으로 각각 RESOURCE 속성 값 집합 및 Common Expression Language(CEL)로 표현된 승인 규칙(이전에 만든 정의로 사용자의 인텐트를 설명). CEL에는 다음 제한사항이 적용됩니다.
    • 정책당 최대 10개의 논리 연산자를 정의할 수 있습니다.
    • AND (&&), OR (||) 및 IN 연산자만 사용할 수 있습니다.
  • 해당 동의 아티팩트의 REST 경로(동의 아티팩트 생성 시 반환됨)
  • 선택적 동의 상태는 DRAFT 또는 ACTIVE입니다. 상태를 지정하지 않으면 ACTIVE 상태로 동의가 생성됩니다.
  • 날짜 또는 기간으로 정의되는 동의의 선택적 만료 기간입니다. 이 값은 초 단위로 제공되고 s 문자로 서픽스가 붙어야 합니다. 86000s). 이 값은 동의 저장소에 구성된 만료 기간을 재정의합니다. 만료를 구성하지 않으면 리소스는 동의 저장소에서 기본 만료 기간을 상속합니다. 리소스 또는 저장소에 만료 기간이 지정되지 않은 경우 동의 리소스는 만료되지 않습니다.
  • 액세스 토큰

다음 샘플은 curl을 사용하는 POST 요청을 보여줍니다.

curl -X POST \
    -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
    -H "Content-Type: application/consent+json; charset=utf-8" \
    --data "{
       \"user_id\": \"USER_ID\",
       \"policies\": [{
         \"resource_attributes\": [{
           \"attribute_definition_id\": \"data_identifiable\",
           \"values\": [\"identifiable\"]
         }],
         \"authorization_rule\": {
           \"expression\": \"requester_identity == 'clinical-admin'\",
        }
       },
       {
         \"resource_attributes\": [{
           \"attribute_definition_id\": \"data_identifiable\",
           \"values\": [\"de-identified\"]
         }],
         \"authorization_rule\": {
           \"expression\": \"requester_identity in ['internal-researcher', 'external-researcher']\"
          }
       }],
       \"consent_artifact\": \"projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID\",
       \"ttl\": \"EXPIRATION_DURATION\"
    }" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents"

요청이 성공하면 서버가 다음 샘플과 비슷한 응답을 반환합니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID",
  "userId": "USER_ID",
  "policies": [
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "identifiable"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity == 'clinical-admin'"
      }
    },
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "de-identified"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity in ['internal-researcher', 'external-researcher']"
      }
    }
  ],
  "consentArtifact": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID",
  "state": "CONSENT_STATE",
  "stateChangeTime": "STATE_CHANGE_TIME",
  "expireTime": "EXPIRE_TIME"
}

다음 샘플은 Windows PowerShell을 사용한 POST 요청을 보여줍니다.

$cred = gcloud auth application-default print-access-token
$headers = @{ Authorization = "Bearer $cred" }

Invoke-WebRequest `
  -Method Post `
  -Headers $headers `
  -ContentType: "application/consent+json; charset=utf-8" `
  -Body "{
       'user_id': 'USER_ID',
       'policies': [{
         'resource_attributes': [{
           'attribute_definition_id': 'data_identifiable',
           'values': ['identifiable']
         }],
         'authorization_rule': {
           'expression': 'requester_identity == \'clinical-admin\'',
        }
       },{
         'resource_attributes': [{
           'attribute_definition_id': 'data_identifiable',
           'values': ['de-identified']
         }],
         'authorization_rule': {
           'expression': 'requester_identity in [\'internal-researcher\', \'external-researcher\']'
          }
       }],
       'consent_artifact': 'projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID',
       'ttl': 'EXPIRATION_DURATION'
    }" `
  -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents" | Select-Object -Expand Content

요청이 성공하면 서버가 다음 샘플과 비슷한 응답을 반환합니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID",
  "userId": "USER_ID",
  "policies": [
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "identifiable"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity == 'clinical-admin'"
      }
    },
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "de-identified"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity in ['internal-researcher', 'external-researcher']"
      }
    }
  ],
  "consentArtifact": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID",
  "state": "CONSENT_STATE",
  "stateChangeTime": "STATE_CHANGE_TIME",
  "expireTime": "EXPIRE_TIME"
}

다음 샘플은 동의를 얻는 방법을 보여줍니다. 자세한 내용은 projects.locations.datasets.consentStores.consents.get를 참조하세요.

동의를 얻으려면 GET 요청을 수행하고 요청에 다음 정보를 지정합니다.

  • 상위 데이터 세트의 이름
  • 동의 저장소 이름
  • 동의 이름
  • 액세스 토큰

다음 샘플은 curl을 사용하는 GET 요청을 보여줍니다.

curl -X GET \
     -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
     "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID"

요청이 성공하면 서버가 JSON 형식으로 응답을 반환합니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID",
  "userId": "USER_ID",
  "policies": [
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "identifiable"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity == 'clinical-admin'"
      }
    },
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "de-identified"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity in ['internal-researcher', 'external-researcher']"
      }
    }
  ],
  "consentArtifact": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID",
  "state": "CONSENT_STATE",
  "stateChangeTime": "STATE_CHANGE_TIME",
  "revisionCreateTime": "REVISION_CREATE_TIME",
  "expireTime": "EXPIRE_TIME"
}

다음 샘플은 Windows PowerShell을 사용한 GET 요청을 보여줍니다.

$cred = gcloud auth application-default print-access-token
$headers = @{ Authorization = "Bearer $cred" }

Invoke-RestMethod `
  -Method Get `
  -Headers $headers `
  -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID" | ConvertTo-Json

요청이 성공하면 서버가 JSON 형식으로 응답을 반환합니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID",
  "userId": "USER_ID",
  "policies": [
    {
      "resourceAttributes": "",
      "authorizationRule": "@{expression=requester_identity == 'clinical-admin'}"
    },
    {
      "resourceAttributes": "",
      "authorizationRule": "@{expression=requester_identity in ['internal-researcher', 'external-researcher']}"
    }
  ],
  "consentArtifact": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID",
  "state": "CONSENT_STATE",
  "stateChangeTime": "STATE_CHANGE_TIME",
  "revisionCreateTime": "REVISION_CREATE_TIME",
  "expireTime": "EXPIRE_TIME"
}

다음 샘플은 동의 저장소에 동의를 나열하는 방법을 보여줍니다.

동의 저장소에 동의 목록을 나열하려면 projects.locations.datasets.consentStores.consents.list 메서드를 사용합니다.

동의 저장소에 동의 목록을 나열하려면 GET 요청을 실행하고 다음 정보를 지정합니다.

  • 부모 동의 저장소 이름
  • 사용자 ID, 상태, 생성 시간, 동의 아티팩트를 기반으로 동의를 검색하는 선택적 검색 필터
  • 액세스 토큰

다음 샘플은 curl을 사용하는 GET 요청을 보여줍니다.

curl -X GET \
     -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
     "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents"

요청이 성공하면 서버가 JSON 형식으로 응답을 반환합니다.

{
  "consents": [
    {
      "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID",
      "userId": "USER_ID",
      "policies": [
        {
          "resourceAttributes": [
            {
              "attributeDefinitionId": "data_identifiable",
              "values": [
                "identifiable"
              ]
            }
          ],
          "authorizationRule": {
            "expression": "requester_identity == 'clinical-admin'"
          }
        },
        {
          "resourceAttributes": [
            {
              "attributeDefinitionId": "data_identifiable",
              "values": [
                "de-identified"
              ]
            }
          ],
          "authorizationRule": {
            "expression": "requester_identity in ['internal-researcher', 'external-researcher']"
          }
        }
      ],
      "consentArtifact": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID",
      "state": "CONSENT_STATE",
      "stateChangeTime": "STATE_CHANGE_TIME",
      "revisionCreateTime": "REVISION_CREATE_TIME",
      "expireTime": "EXPIRE_TIME"
    },
    {
      ...
    }
  ]
}

동의 저장소에 동의 목록을 나열하려면 GET 요청을 실행하고 다음 정보를 지정합니다.

  • 상위 데이터 세트의 이름
  • 사용자 ID, 상태, 생성 시간, 동의 아티팩트를 기반으로 동의를 검색하는 선택적 검색 필터
  • 액세스 토큰

다음 샘플은 Windows PowerShell을 사용한 GET 요청을 보여줍니다.

$cred = gcloud auth application-default print-access-token
$headers = @{ Authorization = "Bearer $cred" }

Invoke-WebRequest `
  -Method Get `
  -Headers $headers `
  -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents" | Select-Object -Expand Content

요청이 성공하면 서버가 JSON 형식으로 응답을 반환합니다.

{
  "consents": [
    {
      "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID",
      "userId": "USER_ID",
      "policies": [
        {
          "resourceAttributes": [
            {
              "attributeDefinitionId": "data_identifiable",
              "values": [
                "identifiable"
              ]
            }
          ],
          "authorizationRule": {
            "expression": "requester_identity == 'clinical-admin'"
          }
        },
        {
          "resourceAttributes": [
            {
              "attributeDefinitionId": "data_identifiable",
              "values": [
                "de-identified"
              ]
            }
          ],
          "authorizationRule": {
            "expression": "requester_identity in ['internal-researcher', 'external-researcher']"
          }
        }
      ],
      "consentArtifact": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID",
      "state": "CONSENT_STATE",
      "stateChangeTime": "STATE_CHANGE_TIME",
      "revisionCreateTime": "REVISION_CREATE_TIME",
      "expireTime": "EXPIRE_TIME"
    },
    {
      ...
    }
  ]
}

또한 projects.locations.datasets.consentStores.consents.listRevisions 메서드를 사용하여 특정 동의의 수정 목록을 나열할 수도 있습니다.

동의 업데이트

시간이 경과함에 따라 동의 상태를 업데이트해야 할 수도 있습니다. 이렇게 하려면 동의 상태를 변경하면 됩니다. 상태를 업데이트하고 변경할 때마다 동의의 새로운 버전이 생성됩니다. @{revision_id}를 동의의 리소스 이름에 추가하여 이전 버전에 액세스할 수 있습니다.

동의 업데이트

활성 또는 초안 동의의 userId, policies, consentArtifact, revokeConsentArtifact 필드를 업데이트하려면 projects.locations.datasets.consentStores.consents.patch 메서드를 사용합니다. 새 버전은 변경사항으로 커밋되고 현재 상태로 설정됩니다.

동의를 업데이트하려면 PATCH 요청을 수행하고 요청에 다음 정보를 지정합니다.

  • 업데이트할 동의의 REST 경로
  • 업데이트할 필드
  • 업데이트 마스크
  • 액세스 토큰

다음 샘플은 동의 아티팩트를 업데이트하는 curl을 사용하는 PATCH 요청을 보여줍니다.

curl -X PATCH \
    -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
    -H "Content-Type: application/consent+json; charset=utf-8" \
    --data "{
       \"consentArtifact\": \"projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID\"
       }" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID?updateMask=consentArtifact"

요청이 성공하면 서버는 다음 샘플과 비슷한 응답을 JSON 형식으로 반환합니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID",
  "userId": "USER_ID",
  "policies": [
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "identifiable"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity == 'clinical-admin'"
      }
    },
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "de-identified"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity in ['internal-researcher', 'external-researcher']"
      }
    }
  ],
  "consentArtifact": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID",
  "state": "ACTIVE",
  "stateChangeTime": "STATE_CHANGE_TIME",
  "revisionCreateTime": "REVISION_CREATE_TIME",
  "expireTime": "EXPIRE_TIME"
}

다음 샘플은 동의 아티팩트를 업데이트하는 Windows PowerShell을 사용하는 PATCH 요청을 보여줍니다.

$cred = gcloud auth application-default print-access-token
$headers = @{ Authorization = "Bearer $cred" }

Invoke-WebRequest `
  -Method Patch `
  -Headers $headers `
  -ContentType: "application/consent+json; charset=utf-8" `
  -Body "{
       'consentArtifact': 'projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID'
    }" `
  -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID?updateMask=consentArtifact" | Select-Object -Expand Content

요청이 성공하면 서버는 다음 샘플과 비슷한 응답을 JSON 형식으로 반환합니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID",
  "userId": "USER_ID",
  "policies": [
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "identifiable"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity == 'clinical-admin'"
      }
    },
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "de-identified"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity in ['internal-researcher', 'external-researcher']"
      }
    }
  ],
  "consentArtifact": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID",
  "state": "ACTIVE",
  "stateChangeTime": "STATE_CHANGE_TIME",
  "revisionCreateTime": "REVISION_CREATE_TIME",
  "expireTime": "EXPIRE_TIME"
}

동의 활성화

사용자가 동의한 후 동의 상태를 DRAFT에서 ACTIVE로 변경하려면 projects.locations.datasets.consentStores.consents.activateConsent 메서드를 사용합니다. 새 버전은 ACTIVE 상태로 커밋됩니다. 동의 상태가 ACTIVE인 경우 액세스 결정 요청에 동의가 포함됩니다.

동의를 활성화하려면 POST 요청을 수행하고 요청에 다음 정보를 지정합니다.

  • 활성화할 동의의 REST 경로
  • 동의가 활성화된 이유를 문서화하기 위한 선택적 아티팩트의 REST 경로
  • 액세스 토큰

다음 샘플은 curl을 사용하는 POST 요청을 보여줍니다.

curl -X POST \
    -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
    -H "Content-Type: application/consent+json; charset=utf-8" \
    --data "{
       'consent_artifact': 'projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/userConsentArtifacts/CONSENT_ARTIFACT_RESOURCE_ID' \
       }" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID:activate"

요청이 성공하면 서버는 다음 샘플과 비슷한 응답을 JSON 형식으로 반환합니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID",
  "userId": "USER_ID",
  "policies": [
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "identifiable"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity == 'clinical-admin'"
      }
    },
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "de-identified"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity in ['internal-researcher', 'external-researcher']"
      }
    }
  ],
  "consentArtifact": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID",
  "state": "ACTIVE",
  "stateChangeTime": "STATE_CHANGE_TIME",
  "expireTime": "EXPIRE_TIME"
}

다음 샘플은 Windows PowerShell을 사용한 POST 요청을 보여줍니다.

$cred = gcloud auth application-default print-access-token
$headers = @{ Authorization = "Bearer $cred" }

Invoke-WebRequest `
  -Method Post `
  -Headers $headers `
  -ContentType: "application/consent+json; charset=utf-8" `
  -Body "{
       'consent_artifact': '/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/userConsentArtifacts/CONSENT_ARTIFACT_ID'
    }" `
  -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID:activate" | Select-Object -Expand Content

요청이 성공하면 서버는 다음 샘플과 비슷한 응답을 JSON 형식으로 반환합니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID",
  "userId": "USER_ID",
  "policies": [
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "identifiable"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity == 'clinical-admin'"
      }
    },
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "de-identified"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity in ['internal-researcher', 'external-researcher']"
      }
    }
  ],
  "consentArtifact": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID",
  "state": "ACTIVE",
  "stateChangeTime": "STATE_CHANGE_TIME",
  "expireTime": "EXPIRE_TIME"
}

동의 취소 및 거부

사용자가 동의를 허용하지 않는 경우와 같이 동의 상태를 DRAFT에서 REJECTED로 변경하려면 projects.locations.datasets.consentStores.consents.reject 메서드를 사용합니다. 동의 상태가 REJECTED인 경우 동의는 액세스 결정 요청에 포함되지 않습니다.

사용자가 이전에 부여된 동의의 삭제를 요청하는 경우와 같이 동의 상태를 ACTIVE에서 REVOKED로 변경하려면 projects.locations.datasets.consentStores.consents.revoke 메서드를 사용합니다. 새 버전은 REVOKED 상태로 커밋됩니다. 상태가 REVOKED인 동의는 액세스 결정 요청에 포함되지 않습니다. 동의가 취소된 이유를 문서화하기 위해 동의와 관련된 선택적 아티팩트를 만들 수 있습니다. 동의를 취소해도 동의는 삭제되지 않습니다.

동의를 취소하려면 POST 요청을 수행하고 요청에 다음 정보를 지정합니다.

  • 취소할 동의의 REST 경로
  • 동의가 취소된 이유를 문서화하기 위한 선택적 아티팩트의 REST 경로
  • 액세스 토큰

다음 샘플은 curl을 사용하는 POST 요청을 보여줍니다.

curl -X POST \
    -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
    -H "Content-Type: application/consent+json; charset=utf-8" \
    --data "{}" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID:revoke"

요청이 성공하면 서버는 다음 샘플과 비슷한 응답을 JSON 형식으로 반환합니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID",
  "userId": "USER_ID",
  "policies": [
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "identifiable"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity == 'clinical-admin'"
      }
    },
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "de-identified"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity in ['internal-researcher', 'external-researcher']"
      }
    }
  ],
  "consentArtifact": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID",
  "state": "REVOKED",
  "stateChangeTime": "STATE_CHANGE_TIME",
  "expireTime": "EXPIRE_TIME"
}

다음 샘플은 Windows PowerShell을 사용한 POST 요청을 보여줍니다.

$cred = gcloud auth application-default print-access-token
$headers = @{ Authorization = "Bearer $cred" }

Invoke-WebRequest `
  -Method Post `
  -Headers $headers `
  -ContentType: "application/consent+json; charset=utf-8" `
  -Body "{}" `
  -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID:revoke" | Select-Object -Expand Content

요청이 성공하면 서버는 다음 샘플과 비슷한 응답을 JSON 형식으로 반환합니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consents/CONSENT_ID",
  "userId": "USER_ID",
  "policies": [
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "identifiable"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity == 'clinical-admin'"
      }
    },
    {
      "resourceAttributes": [
        {
          "attributeDefinitionId": "data_identifiable",
          "values": [
            "de-identified"
          ]
        }
      ],
      "authorizationRule": {
        "expression": "requester_identity in ['internal-researcher', 'external-researcher']"
      }
    }
  ],
  "consentArtifact": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/consentStores/CONSENT_STORE_ID/consentArtifacts/CONSENT_ARTIFACT_ID",
  "state": "REVOKED",
  "stateChangeTime": "STATE_CHANGE_TIME",
  "expireTime": "EXPIRE_TIME"
}