En esta página se explica cómo desidentificar datos sensibles en recursos FHIR mediante la API Cloud Healthcare en los siguientes niveles:
- A nivel del conjunto de datos mediante
datasets.deidentify
- A nivel de almacén FHIR mediante
fhirStores.deidentify
En esta página también se explica cómo aplicar filtros al desidentificar datos a nivel de almacén FHIR.
Descripción general de la desidentificación
Desidentificación a nivel de conjunto de datos
Para desidentificar datos FHIR a nivel del conjunto de datos, llama a la operación datasets.deidentify
. La llamada a la API de anonimización tiene los siguientes componentes:
- El conjunto de datos de origen: un conjunto de datos con almacenes FHIR que contienen uno o más recursos, los cuales, a su vez, incluyen datos sensibles.
- El conjunto de datos de destino: la desidentificación no afecta al conjunto de datos original ni a sus datos, sino que las copias desidentificadas de los datos originales se escriben en un nuevo conjunto de datos, denominado conjunto de datos de destino.
- Qué desidentificar: parámetros de configuración que especifican cómo procesar el conjunto de datos. Puedes configurar estos parámetros especificándolos en un objeto
FhirConfig
oTextConfig
dentro del objetoDeidentifyConfig
y pasándolo de una de estas dos formas:- Definir el campo
config
del cuerpo de la solicitud - Almacenándolo en Cloud Storage en formato JSON y especificando la ubicación del archivo en el segmento mediante el campo
gcsConfigUri
del cuerpo de la solicitud
- Definir el campo
La mayoría de los ejemplos de esta guía muestran cómo desidentificar datos FHIR a nivel de conjunto de datos.
Desidentificación a nivel de almacén FHIR
Desidentificar datos FHIR a nivel de almacén FHIR te permite tener más control sobre qué datos FHIR se desidentifican.
Para desidentificar datos FHIR en un almacén FHIR, llama al método fhirStores.deidentify
. La llamada a la API de desidentificación consta de los siguientes componentes:
- El almacén FHIR de origen: un almacén FHIR que contiene uno o más recursos con datos sensibles.
- El almacén FHIR de destino: la desidentificación no afecta al almacén FHIR original ni a sus datos. sino que las copias desidentificadas de los datos originales se escriben en el almacén FHIR de destino. La tienda FHIR de destino ya debe existir.
- Qué desidentificar: parámetros de configuración que especifican cómo procesar el almacén FHIR. Puedes configurar estos parámetros especificándolos en un objeto
FhirConfig
oTextConfig
dentro del objetoDeidentifyConfig
y pasándolo de una de estas dos formas:- Definir el campo
config
del cuerpo de la solicitud - Almacenándolo en Cloud Storage en formato JSON y especificando la ubicación del archivo en el segmento mediante el campo
gcsConfigUri
del cuerpo de la solicitud
- Definir el campo
Para ver un ejemplo de cómo desidentificar datos FHIR a nivel de almacén FHIR, consulta Desidentificar datos a nivel de almacén FHIR.
Filtros
Puedes desidentificar un subconjunto de datos de un almacén FHIR especificando una lista de IDs de recursos FHIR en la solicitud fhirStores.deidentify
. Para ver un ejemplo, consulta Desidentificar un subconjunto de un almacén FHIR.
Recurso FHIR de ejemplo usado en esta guía
En los ejemplos de esta guía se usa un recurso Patient (DSTU2, STU3 y R4) en un almacén FHIR. El recurso Patient tiene las propiedades que se muestran en el siguiente ejemplo. El servidor genera el valor id
. Si crea el recurso Patient en su propio almacén FHIR, el valor id
devuelto será diferente del valor que se muestra en el recurso Patient de ejemplo.
{
"address": [
{
"city": "Anycity",
"district": "Anydistrict",
"line": [
"123 Main Street"
],
"period": {
"start": "1990-12-05"
},
"postalCode": "12345",
"state": "CA",
"text": "123 Main Street Anycity, Anydistrict, CA 12345",
"type": "both",
"use": "home"
}
],
"birthDate": "1980-12-05",
"gender": "female",
"id": "r77433dd-dkeuc-633743nfd-383nfdsjds732",
"name": [
{
"family": "Smith",
"given": [
"Darcy"
],
"use": "official"
}
],
"resourceType": "Patient",
"text": {
"status": "generated",
"div": "<div><p><b>Patient</b></p><p><b>Name</b>: Smith, Darcy</p><p><b>DateOfBirth</b>: 1980-12-05</p><p><b>Gender</b>: Female</p></div>"
}
}
Desidentificación de datos FHIR predeterminada
Puedes desidentificar datos FHIR mediante un método "predeterminado" que oculta la información médica protegida (IMP) habitual de los recursos de un almacén FHIR. El método predeterminado oculta la siguiente información:
- infoTypes especificados en los infoTypes de FHIR predeterminados
- Rutas especificadas en el perfil de desidentificación de FHIR predeterminado
En los siguientes ejemplos se muestra cómo desidentificar el recurso Patient mediante el método predeterminado de FHIR. Si usas el método predeterminado, utiliza un FhirConfig
vacío dentro del objeto DeidentifyConfig
.
curl
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': {} } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify"
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID"
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/fhir+json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732"
{ "address": [ { "city": "", "district": "", "line": [ "" ], "period": { "start": "1990-12-05" }, "postalCode": "", "state": "CA", "text": "", "type": "both", "use": "home" } ], "birthDate": "1981-02-24", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMA" }, "name": [ { "family": "", "given": [ "" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: [PERSON_NAME][PERSON_NAME][PERSON_NAME]</p><p><b>DateOfBirth</b>: 1981-02-24</p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
PowerShell
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': {} } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify" | Select-Object -Expand Content
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" | Select-Object -Expand Content
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_NUMBER", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-RestMethod ` -Method Get ` -Headers $headers ` -ContentType: "application/fhir+json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732" | ConvertTo-Json
{ "address": [ { "city": "", "district": "", "line": [ "" ], "period": { "start": "1990-12-05" }, "postalCode": "", "state": "CA", "text": "", "type": "both", "use": "home" } ], "birthDate": "1981-02-24", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMA" }, "name": [ { "family": "", "given": [ "" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: [PERSON_NAME][PERSON_NAME][PERSON_NAME]</p><p><b>DateOfBirth</b>: 1981-02-24</p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
Verás que se han transformado los siguientes valores para desidentificar el recurso:
- Se ha proporcionado un nuevo valor en el campo
birthDate
mediante una técnica de desplazamiento de fechas con una diferencia de 100 días. - El valor de
address.city
se ha ocultado. - El valor de
address.district
se ha ocultado. - El valor de
address.line
se ha ocultado. - El valor de
address.postalCode
se ha ocultado. - El valor de
address.text
se ha ocultado. - El valor de
name.family
se ha ocultado. - El valor de
name.given
se ha ocultado. - El texto libre del campo
text.div
se ha modificado para sustituir el nombre del paciente por su infoType,[PERSON_NAME]
. El valor de la fecha de nacimiento del paciente se ha transformado de la misma forma que el valor del campobirthDate
.
Desidentificar rutas FHIR específicas
Para especificar qué rutas FHIR se deben desidentificar y cómo transformarlas, configure fieldMetadataList
en el objeto FhirConfig
.
Dentro de fieldMetadataList
, especifica una lista separada por puntos de nombres de campos o nombres de tipos de recursos FHIR en una lista paths
. A continuación, especifique un Action
valor que se aplicará a todo lo que se indique en paths
. Consulta los posibles valores en la Action
documentación.
Para obtener información sobre cómo definir el campo paths
en la API Cloud Healthcare, consulta paths
.
El formato de los valores de paths
se basa en FHIRPath.
Perfil de desidentificación de FHIR predeterminado
De forma predeterminada, si no especificas ninguna ruta de FHIR en fieldMetadataList
, la API Cloud Healthcare aplica los siguientes perfiles de desidentificación para seleccionar y transformar las rutas de FHIR. El perfil que se aplica depende de la versión de FHIR que utilices. Puedes desplegar las siguientes secciones para ver los perfiles de la versión que estés usando. También puedes descargar los perfiles (DSTU2, STU3 y R4).
Usar rutas para anonimizar recursos
En los siguientes ejemplos se muestra cómo configurar la anonimización del recurso Patient con los siguientes criterios:
- Los valores
HumanName
(DSTU2, STU3, y R4) del recurso Patient tienen unaTRANSFORM
(ocultación) aplicada automáticamente. En el caso del paciente de ejemplo, los valores de HumanName son"family": "Smith"
y"given": [ "Darcy" ]
.
No se proporcionan otros valores en la lista paths
dentro de fieldMetadataList
,
por lo que los datos restantes no cambian.
En los siguientes ejemplos se muestra cómo desidentificar los valores de HumanName del recurso Patient:
curl
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': { 'fieldMetadataList': [ { 'paths': [ 'Patient.HumanName' ], 'action': 'TRANSFORM' } ] } } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify"
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID"
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/fhir+json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732"
{ "address": [ { "city": "Anycity", "district": "Anydistrict", "line": [ "123 Main Street" ], "period": { "start": "1990-12-05" }, "postalCode": "12345", "state": "CA", "text": "123 Main Street Anycity, Anydistrict, CA 12345", "type": "both", "use": "home" } ], "birthDate": "1980-12-05", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMAA" }, "name": [ { "family": "", "given": [ "" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: Smith, Darcy</p><p><b>DateOfBirth</b>: 1980-12-05</p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
PowerShell
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': { 'fieldMetadataList': [ { 'paths': [ 'Patient.HumanName' ], 'action': 'TRANSFORM' } ] } } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify" | Select-Object -Expand Content
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" | Select-Object -Expand Content
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_NUMBER", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-RestMethod ` -Method Get ` -Headers $headers ` -ContentType: "application/fhir+json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732" | ConvertTo-Json
{ "address": [ { "city": "Anycity", "district": "Anydistrict", "line": [ "123 Main Street" ], "period": { "start": "1990-12-05" }, "postalCode": "12345", "state": "CA", "text": "123 Main Street Anycity, Anydistrict, CA 12345", "type": "both", "use": "home" } ], "birthDate": "1980-12-05", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMAA" }, "name": [ { "family": "", "given": [ "" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: Smith, Darcy</p><p><b>DateOfBirth</b>: 1980-12-05</p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
Verás que se han transformado los siguientes valores para desidentificar el recurso:
- El valor de
name.family
se ha ocultado. - El valor de
name.given
se ha ocultado.
Sin embargo, a diferencia del ejemplo de desidentificación de FHIR predeterminada, que transformó información personal sensible común, el address
y el birthDate
del paciente, así como el texto libre de text.div
, no se transformaron porque no se añadieron a la lista paths
de fieldMetadataList
.
Usar infoTypes y transformaciones primitivas con recursos FHIR
La API Cloud Healthcare puede usar tipos de información (infoTypes) para definir los datos que analiza al desidentificar recursos FHIR. Un infoType es un tipo de datos sensibles, como el nombre de un paciente, una dirección de correo electrónico, un número de teléfono, un número de identificación o un número de tarjeta de crédito. Los infoTypes que se usan en la operación de desidentificación de la API Cloud Healthcare incluyen los que se encuentran en Cloud Data Loss Prevention.
Las transformaciones primitivas son reglas que se usan para transformar un valor de entrada.
InfoTypes de FHIR predeterminados
Los infoTypes predeterminados que se usan al desidentificar datos FHIR son los siguientes:
AGE
CREDIT_CARD_NUMBER
DATE
EMAIL_ADDRESS
IP_ADDRESS
LOCATION
MAC_ADDRESS
PASSPORT
PERSON_NAME
PHONE_NUMBER
SWIFT_CODE
US_DRIVERS_LICENSE_NUMBER
US_SOCIAL_SECURITY_NUMBER
US_VEHICLE_IDENTIFICATION_NUMBER
US_INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER
Opciones de transformación primitiva
Las opciones de transformación primitivas de la API Cloud Healthcare incluyen las siguientes:
RedactConfig
: oculta un valor eliminándolo.CharacterMaskConfig
: enmascara una cadena total o parcialmente sustituyendo los caracteres de entrada por un carácter fijo especificado.DateShiftConfig
: cambia las fechas en un número aleatorio de días, con la opción de mantener la coherencia en el mismo contexto.CryptoHashConfig
: usa SHA-256 para sustituir los valores de entrada por una representación codificada en base64 de una cadena de salida cifrada con hash generada mediante una clave de cifrado de datos determinada.ReplaceWithInfoTypeConfig
: sustituye un valor de entrada por el nombre de su infoType.
Especificar configuraciones en TextConfig
Los infoTypes y las transformaciones primitivas se especifican en un
InfoTypeTransformation
,
que es un objeto dentro de
TextConfig
.
Especifica los infoTypes en la matriz infoTypes
como valores separados por comas.
Especificar un infoType es opcional. Si no especifica al menos un infoType, la transformación se aplicará a todos los infoTypes integrados de los datos.
Si especifica algún infoType en InfoTypeTransformation
, especifique al menos una transformación primitiva.
En las siguientes secciones se muestra cómo usar las transformaciones primitivas disponibles en InfoTypeTransformation
junto con los infoTypes para personalizar la forma en que se anonimizan los recursos FHIR.
RedactConfig
Si se especifica redactConfig
, se oculta un valor determinado eliminándolo por completo. El mensaje redactConfig
no tiene argumentos. Si lo especificas, se habilita la transformación.
En los siguientes ejemplos se muestra cómo ocultar la fecha de nacimiento del recurso Patient en el campo Patient.text.div
.
Para ello, se define el infoType DATE
con la ruta Patient.text.div
y la transformación redactConfig
.
Después de enviar la solicitud de desidentificación a la API Cloud Healthcare, se oculta la fecha de nacimiento en el valor Patient.text.div
.
curl
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': { 'fieldMetadataList': { 'paths': [ 'Patient.text.div' ], 'action': 'INSPECT_AND_TRANSFORM' } }, 'text': { 'transformations': [ { 'infoTypes': [ 'DATE' ], 'redactConfig': {} } ] } } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify"
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID"
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/fhir+json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732"
{ "address": [ { "city": "Anycity", "district": "Anydistrict", "line": [ "123 Main Street" ], "period": { "start": "1990-12-05" }, "postalCode": "12345", "state": "CA", "text": "123 Main Street Anycity, Anydistrict, CA 12345", "type": "both", "use": "home" } ], "birthDate": "1980-12-05", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMAA" }, "name": [ { "family": "Smith", "given": [ "Darcy" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: Smith, Darcy</p><p><b>DateOfBirth</b>: </p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
PowerShell
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': { 'fieldMetadataList': { 'paths': [ 'Patient.text.div' ], 'action': 'INSPECT_AND_TRANSFORM' } }, 'text': { 'transformations': [ { 'infoTypes': [ 'DATE' ], 'redactConfig': {} } ] } } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify" | Select-Object -Expand Content
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" | Select-Object -Expand Content
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_NUMBER", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-RestMethod ` -Method Get ` -Headers $headers ` -ContentType: "application/fhir+json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732" | ConvertTo-Json
{ "address": [ { "city": "Anycity", "district": "Anydistrict", "line": [ "123 Main Street" ], "period": { "start": "1990-12-05" }, "postalCode": "12345", "state": "CA", "text": "123 Main Street Anycity, Anydistrict, CA 12345", "type": "both", "use": "home" } ], "birthDate": "1980-12-05", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMAA" }, "name": [ { "family": "Smith", "given": [ "Darcy" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: Smith, Darcy</p><p><b>DateOfBirth</b>: </p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
El resultado muestra que se ha eliminado el valor de DateOfBirth
en text.div
. Esto contrasta con el ejemplo de Anonimizar rutas FHIR específicas, donde el valor de DateOfBirth
en text.div
no se eliminó con la configuración predeterminada.
CharacterMaskConfig
Si se especifica characterMaskConfig
, se sustituyen las cadenas que corresponden a los infoTypes indicados por un carácter fijo especificado. Por ejemplo, en lugar de ocultar el nombre de un paciente o transformarlo mediante un hash criptográfico, puedes sustituirlo por una serie de asteriscos (*
). Especifica el carácter fijo como valor del campo maskingCharacter
.
En los siguientes ejemplos se muestra cómo ampliar el ejemplo utilizado en Desidentificar rutas FHIR específicas, pero ahora incluyen la configuración de PERSON_NAME
infoType con la transformación characterMaskConfig
. No se proporciona ningún carácter fijo, por lo que la máscara usa un asterisco de forma predeterminada. Después de enviar la solicitud de desidentificación a la API Cloud Healthcare, los valores de name.family
y name.given
se sustituyen por asteriscos.
curl
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': { 'fieldMetadataList': { 'paths': [ 'Patient.HumanName' ], 'action': 'TRANSFORM' } }, 'text': { 'transformations': [ { 'infoTypes': [ 'PERSON_NAME' ], 'characterMaskConfig': { 'maskingCharacter': '' } } ] } } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify"
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID"
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/fhir+json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732"
{ "address": [ { "city": "Anycity", "district": "Anydistrict", "line": [ "123 Main Street" ], "period": { "start": "1990-12-05" }, "postalCode": "12345", "state": "CA", "text": "123 Main Street Anycity, Anydistrict, CA 12345", "type": "both", "use": "home" } ], "birthDate": "1980-12-05", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMAA" }, "name": [ { "family": "*****", "given": [ "*****" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: Smith, Darcy</p><p><b>DateOfBirth</b>: 1980-12-05</p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
PowerShell
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': { 'fieldMetadataList': { 'paths': [ 'Patient.HumanName' ], 'action': 'TRANSFORM' } }, 'text': { 'transformations': [ { 'infoTypes': [ 'PERSON_NAME' ], 'characterMaskConfig': { 'maskingCharacter': '' } } ] } } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify" | Select-Object -Expand Content
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" | Select-Object -Expand Content
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_NUMBER", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-RestMethod ` -Method Get ` -Headers $headers ` -ContentType: "application/fhir+json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732" | ConvertTo-Json
{ "address": [ { "city": "Anycity", "district": "Anydistrict", "line": [ "123 Main Street" ], "period": { "start": "1990-12-05" }, "postalCode": "12345", "state": "CA", "text": "123 Main Street Anycity, Anydistrict, CA 12345", "type": "both", "use": "home" } ], "birthDate": "1980-12-05", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMAA" }, "name": [ { "family": "*****", "given": [ "*****" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: Smith, Darcy</p><p><b>DateOfBirth</b>: 1980-12-05</p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
El resultado muestra que los valores de name.family
y name.given
se han sustituido por asteriscos. Esto contrasta con el ejemplo de Anonimizar rutas FHIR específicas, donde se han ocultado los valores de name.family
y name.given
.
DateShiftConfig
La API de Cloud Healthcare puede transformar las fechas desplazándolas dentro de un intervalo predefinido. Para que las transformaciones de fechas sean coherentes en todas las ejecuciones de anonimización, usa DateShiftConfig
con una de las siguientes opciones:
- Obsoleto: una clave sin formato de 128, 192 o 256 bits de AES codificada en Base64.
- (Recomendado) Una clave encapsulada de Cloud Key Management Service (Cloud KMS). Consulta Desidentificar y reidentificar texto sensible para ver un ejemplo de cómo usar claves envueltas de Cloud KMS.
Debes asignar un rol con el permiso cloudkms.cryptoKeyVersions.useToDecrypt
a la cuenta de servicio del agente de servicio de Cloud Healthcare para descifrar la clave envuelta de Cloud KMS. Te recomendamos que uses el rol Encargado de desencriptar claves de CryptoKey de Cloud KMS (roles/cloudkms.cryptoKeyDecrypter
).
Cuando usas Cloud KMS para operaciones criptográficas, se aplican cargos. Consulta la página de precios de Cloud Key Management Service para obtener más información.
La API Cloud Healthcare usa esta clave para calcular la cantidad en la que se desplazan las fechas, como la fecha de nacimiento de un paciente, en un diferencial de 100 días.
Si no proporcionas ninguna clave, la API Cloud Healthcare generará una cada vez que se ejecute la operación de desidentificación en los valores de fecha. Esto puede provocar que las fechas de salida sean incoherentes entre ejecuciones.
En los siguientes ejemplos se muestra cómo definir el infoType DATE
con la transformación DateShiftConfig
en las rutas Patient.birthDate
y Patient.text.div
. Después de enviar la solicitud de desidentificación a la API de Cloud Healthcare, el valor de birthDate
y la fecha de nacimiento de Patient.text.div
se desplazarán 100 días como máximo con respecto a la fecha de nacimiento original, 1980-12-05
.
La clave criptográfica proporcionada en el ejemplo, U2FsdGVkX19bS2oZsdbK9X5zi2utBn22uY+I2Vo0zOU=
, es una clave sin formato de 256 bits cifrada con AES y codificada en Base64 que se ha generado con el siguiente comando. Cuando se te pida, proporciona una contraseña de tu elección al comando:
echo -n "test" | openssl enc -e -aes-256-ofb -a -salt
curl
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': { 'fieldMetadataList': { 'paths': [ 'Patient.birthDate', 'Patient.text.div' ], 'action': 'INSPECT_AND_TRANSFORM' } }, 'text': { 'transformations': { 'infoTypes': [ 'DATE' ], 'dateShiftConfig': { 'cryptoKey': 'U2FsdGVkX19bS2oZsdbK9X5zi2utBn22uY+I2Vo0zOU=' } } } } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify"
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID"
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/fhir+json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732"
{ "address": [ { "city": "Anycity", "district": "Anydistrict", "line": [ "123 Main Street" ], "period": { "start": "1990-12-05" }, "postalCode": "12345", "state": "", "text": "123 Main Street Anycity, Anydistrict, CA 12345", "type": "both", "use": "home" } ], "birthDate": "1981-02-19", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMAA" }, "name": [ { "family": "Smith", "given": [ "Darcy" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: Smith, Darcy</p><p><b>DateOfBirth</b>: 1981-02-19</p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
PowerShell
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': { 'fieldMetadataList': { 'paths': [ 'Patient.HumanName', 'Patient.text.div' ], 'action': 'INSPECT_AND_TRANSFORM' } }, 'text': { 'transformations': { 'infoTypes': [ 'DATE' ], 'dateShiftConfig': { 'cryptoKey': 'U2FsdGVkX19bS2oZsdbK9X5zi2utBn22uY+I2Vo0zOU=' } } } } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify" | Select-Object -Expand Content
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" | Select-Object -Expand Content
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_NUMBER", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-RestMethod ` -Method Get ` -Headers $headers ` -ContentType: "application/fhir+json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732" | ConvertTo-Json
{ "address": [ { "city": "Anycity", "district": "Anydistrict", "line": [ "123 Main Street" ], "period": { "start": "1990-12-05" }, "postalCode": "12345", "state": "", "text": "123 Main Street Anycity, Anydistrict, CA 12345", "type": "both", "use": "home" } ], "birthDate": "1981-02-19", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMAA" }, "name": [ { "family": "Smith", "given": [ "Darcy" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: Smith, Darcy</p><p><b>DateOfBirth</b>: 1981-02-19</p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
La salida muestra que el valor de birthDate
y la fecha de nacimiento de Patient.text.div
se han transformado en el nuevo valor 1981-02-19
. Esta transformación se ha producido como resultado de combinar la diferencia de 100 días con el ID de paciente y el valor cryptoKey
proporcionado.
Los nuevos valores de birthDate
y la fecha de nacimiento en Patient.text.div
son coherentes para este paciente entre las ejecuciones de anonimización siempre que se proporcione el mismo cryptoKey
.
CryptoHashConfig
La API Cloud Healthcare puede transformar datos sustituyendo valores por hashes criptográficos (también denominados valores sustitutos). Para ello, especifica un mensaje cryptoHashConfig
.
Puedes dejar el campo cryptoHashConfig
vacío o proporcionar uno de los siguientes elementos:
- Obsoleto: una clave sin formato de 128, 192 o 256 bits de AES codificada en Base64.
- (Recomendado) Una clave encapsulada de Cloud Key Management Service (Cloud KMS). Consulta Desidentificar y reidentificar texto sensible para ver un ejemplo de cómo usar claves envueltas de Cloud KMS.
Debes asignar un rol con el permiso cloudkms.cryptoKeyVersions.useToDecrypt
a la cuenta de servicio del agente de servicio de Cloud Healthcare para descifrar la clave envuelta de Cloud KMS. Te recomendamos que uses el rol Encargado de desencriptar claves de CryptoKey de Cloud KMS (roles/cloudkms.cryptoKeyDecrypter
).
Cuando usas Cloud KMS para operaciones criptográficas, se aplican cargos. Consulta la página de precios de Cloud Key Management Service para obtener más información.
Si se proporciona una clave coherente, se generan valores sustitutos que son coherentes entre las ejecuciones de anonimización. Si no proporcionas una clave, la API Cloud Healthcare generará una nueva cada vez que se ejecute la operación. Si se usa otra clave, se obtienen valores subrogados diferentes.
En los siguientes ejemplos se amplía el ejemplo usado en Desidentificar rutas FHIR específicas, pero ahora se incluye la definición del infoType PERSON_NAME
con la transformación cryptoKey
en la ruta Patient.HumanName
. Después de enviar la solicitud de desidentificación a la API Cloud Healthcare, los valores name.family
y name.given
se sustituyen por valores sustitutos.
La clave criptográfica proporcionada en el ejemplo, U2FsdGVkX19bS2oZsdbK9X5zi2utBn22uY+I2Vo0zOU=
, es una clave sin formato de 256 bits cifrada con AES y codificada en Base64 que se ha generado con el siguiente comando. Cuando se te pida, proporciona una contraseña de tu elección al comando:
echo -n "test" | openssl enc -e -aes-256-ofb -a -salt
curl
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': { 'fieldMetadataList': { 'paths': [ 'Patient.HumanName' ], 'action': 'INSPECT_AND_TRANSFORM' } }, 'text': { 'transformations': { 'infoTypes': [ 'PERSON_NAME' ], 'cryptoHashConfig': { 'cryptoKey': 'U2FsdGVkX19bS2oZsdbK9X5zi2utBn22uY+I2Vo0zOU=' } } } } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify"
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID"
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/fhir+json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732"
{ "address": [ { "city": "Anycity", "district": "Anydistrict", "line": [ "123 Main Street" ], "period": { "start": "1990-12-05" }, "postalCode": "12345", "state": "CA", "text": "123 Main Street Anycity, Anydistrict, CA 12345", "type": "both", "use": "home" } ], "birthDate": "1980-12-05", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMAA" }, "name": [ { "family": "NlVBV12Hhb5DD8WNqlTpXboFxzlUSlqAmYDet/jIViQ=", "given": [ "FSH4D/IGb80a1rS0L0kqfC3DCDt6//17VPhIkOzH2pk=" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: Smith, Darcy</p><p><b>DateOfBirth</b>: 1980-12-05</p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
PowerShell
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': { 'fieldMetadataList': { 'paths': [ 'Patient.HumanName' ], 'action': 'TRANSFORM' } }, 'text': { 'transformations': { 'infoTypes': [ 'PERSON_NAME' ], 'cryptoHashConfig': { 'cryptoKey': 'U2FsdGVkX19bS2oZsdbK9X5zi2utBn22uY+I2Vo0zOU=' } } } } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify" | Select-Object -Expand Content
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" | Select-Object -Expand Content
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_NUMBER", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-RestMethod ` -Method Get ` -Headers $headers ` -ContentType: "application/fhir+json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732" | ConvertTo-Json
{ "address": [ { "city": "Anycity", "district": "Anydistrict", "line": [ "123 Main Street" ], "period": { "start": "1990-12-05" }, "postalCode": "12345", "state": "CA", "text": "123 Main Street Anycity, Anydistrict, CA 12345", "type": "both", "use": "home" } ], "birthDate": "1980-12-05", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMAA" }, "name": [ { "family": "NlVBV12Hhb5DD8WNqlTpXboFxzlUSlqAmYDet/jIViQ=", "given": [ "FSH4D/IGb80a1rS0L0kqfC3DCDt6//17VPhIkOzH2pk=" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: Smith, Darcy</p><p><b>DateOfBirth</b>: 1980-12-05</p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
El resultado muestra que los valores de name.family
y name.given
se han transformado mediante un cifrado hash. Esta transformación se ha producido como resultado de la combinación del ID de paciente y el valor cryptoKey
proporcionado.
Los nuevos valores de name.family
y name.given
de este paciente son coherentes entre las ejecuciones de anonimización siempre que se proporcione el mismo cryptoKey
.
ReplaceWithInfoTypeConfig
La API Cloud Healthcare puede transformar datos sustituyendo valores por el nombre del infoType
del valor. Para ello, especifica un replaceWithInfoTypeConfig
mensaje.
Los siguientes ejemplos amplían el ejemplo utilizado en Desidentificar rutas FHIR específicas, pero definen la transformación replaceWithInfoType
en PERSON_NAME
y la ruta fieldMetadataList
definida como Patient.HumanName
.
Después de enviar la solicitud de desidentificación a la API Cloud Healthcare, los valores name.family
y name.given
se sustituyen por el valor infoType
.
curl
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': { 'fieldMetadataList': { 'paths': [ 'Patient.HumanName' ], 'action': 'INSPECT_AND_TRANSFORM' } }, 'text': { 'transformations': { 'infoTypes': [ 'PERSON_NAME' ], 'replaceWithInfoType': {} } } } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify"
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID"
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/fhir+json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732"
{ "address": [ { "city": "Anycity", "district": "Anydistrict", "line": [ "123 Main Street" ], "period": { "start": "1990-12-05" }, "postalCode": "12345", "state": "CA", "text": "123 Main Street Anycity, Anydistrict, CA 12345", "type": "both", "use": "home" } ], "birthDate": "1980-12-05", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMAA" }, "name": [ { "family": "[PERSON_NAME]", "given": [ "[PERSON_NAME]" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: Smith, Darcy</p><p><b>DateOfBirth</b>: 1980-12-05</p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
PowerShell
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID', 'config': { 'fhir': { 'fieldMetadataList': { 'paths': [ 'Patient.HumanName' ], 'action': 'TRANSFORM' } }, 'text': { 'transformations': { 'infoTypes': [ 'PERSON_NAME' ], 'replaceWithInfoTypeConfig': {} } } } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify" | Select-Object -Expand Content
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
get
para hacer un seguimiento del estado de la operación:
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" | Select-Object -Expand Content
"done": true
.
{ "name": "projects/PROJECT_ID/locations/REGION/datasets/SOURCE_DATASET_ID/operations/OPERATION_NUMBER", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.dataset.DatasetService.DeidentifyDataset", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/viewer/CLOUD_LOGGING_URL" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifySummary", "successStoreCount": "1", "successResourceCount": "1" } }
$cred = gcloud auth print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-RestMethod ` -Method Get ` -Headers $headers ` -ContentType: "application/fhir+json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/datasets/DESTINATION_DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/r77433dd-dkeuc-633743nfd-383nfdsjds732" | ConvertTo-Json
{ "address": [ { "city": "Anycity", "district": "Anydistrict", "line": [ "123 Main Street" ], "period": { "start": "1990-12-05" }, "postalCode": "12345", "state": "CA", "text": "123 Main Street Anycity, Anydistrict, CA 12345", "type": "both", "use": "home" } ], "birthDate": "1980-12-05", "gender": "female", "id": "r77433dd-dkeuc-633743nfd-383nfdsjds732", "meta": { "lastUpdated": "2018-01-01T2018-01-01T00:00:00+00:00", "versionId": "MTU0MDU4NTcxNjI2MTUxNDAwMAA" }, "name": [ { "family": "[PERSON_NAME]", "given": [ "[PERSON_NAME]" ], "use": "official" } ], "resourceType": "Patient", "text": { "div": "<div><p><b>Patient</b></p><p><b>Name</b>: Smith, Darcy</p><p><b>DateOfBirth</b>: 1980-12-05</p><p><b>Gender</b>: Female</p></div>", "status": "generated" } }
En el resultado se muestra que los valores de name.family
y name.given
se han sustituido por el infoType del valor.
Desidentificar datos a nivel de almacén FHIR
En los ejemplos anteriores se muestra cómo desidentificar datos FHIR a nivel de conjunto de datos. Para cambiar una solicitud de desidentificación de un conjunto de datos a una solicitud de desidentificación de un almacén FHIR, haz los siguientes cambios:
- Modifica el
destinationDataset
en el cuerpo de la solicitud adestinationStore
. - Añadir
fhirStores/DESTINATION_FHIR_STORE_ID
al final del valor dedestinationStore
- Añade
fhirStores/SOURCE_FHIR_STORE_ID
cuando especifiques la ubicación de los datos de origen.
Por ejemplo:
Desidentificación a nivel de conjunto de datos:
'destinationDataset': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID' … "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID:deidentify"
Desidentificación a nivel de almacén FHIR:
'destinationStore': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID/fhirStores/DESTINATION_FHIR_STORE_ID' … "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/fhirStores/SOURCE_FHIR_STORE_ID:deidentify"
En los ejemplos siguientes se amplía la información sobre cómo desidentificar rutas FHIR específicas, pero la desidentificación se produce en un solo almacén FHIR y los datos desidentificados se copian en un nuevo almacén FHIR. Ten en cuenta que la tienda FHIR a la que hace referencia DESTINATION_FHIR_STORE_ID ya debe existir.
curl
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'destinationStore': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID/fhirStores/DESTINATION_FHIR_STORE_ID', 'config': { 'fhir': { 'fieldMetadataList': [ { 'paths': [ 'Patient.HumanName' ], 'action': 'TRANSFORM' } ] } } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/fhirStores/SOURCE_FHIR_STORE_ID:deidentify"
Si la solicitud se realiza de forma correcta, el servidor devuelve la respuesta en formato JSON:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
La respuesta contiene un nombre de operación. Puedes usar el método Operation get
para hacer un seguimiento del estado de la operación:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID"
Si la solicitud se realiza de forma correcta, el servidor devuelve la respuesta en formato JSON.
Al finalizar el proceso de desidentificación, la respuesta contiene "done": true
.
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.deidentify.DeidentifyService.DeidentifyFhirStore", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/query/CLOUD_LOGGING_URL", "counter": { "success": "SUCCESS_COUNT" } }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifyFhirStoreSummary" } }
PowerShell
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'destinationStore': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID/fhirStores/DESTINATION_FHIR_STORE_ID', 'config': { 'fhir': { 'fieldMetadataList': [ { 'paths': [ 'Patient.HumanName' ], 'action': 'TRANSFORM' } ] } } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/fhirStores/SOURCE_FHIR_STORE_ID:deidentify" | Select-Object -Expand Content
Si la solicitud se realiza de forma correcta, el servidor devuelve la respuesta en formato JSON:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
La respuesta contiene un ID de operación. Puedes usar el método Operation get
para hacer un seguimiento del estado de la operación:
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" | Select-Object -Expand Content
Si la solicitud se realiza de forma correcta, el servidor devuelve la respuesta en formato JSON. Al finalizar el proceso de desidentificación, la respuesta contiene "done": true
.
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.deidentify.DeidentifyService.DeidentifyFhirStore", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/query/CLOUD_LOGGING_URL", "counter": { "success": "SUCCESS_COUNT" } }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifyFhirStoreSummary" } }
Desidentificar un subconjunto de un almacén FHIR
Cuando desidentificas datos FHIR a nivel de almacén FHIR, puedes desidentificar un subconjunto de los datos especificando un filtro.
El filtro tiene la forma de una lista de IDs de recursos FHIR. Los IDs se especifican en un objeto Resources
dentro del objeto FhirFilter
.
En el siguiente ejemplo se amplía la información de la sección Desidentificar datos a nivel de almacén FHIR, pero se proporciona una lista de dos IDs de recursos FHIR (uno para un paciente y otro para una observación) que determina qué recursos se desidentifican.
curl
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'destinationStore': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID/fhirStores/DESTINATION_FHIR_STORE_ID', 'config': { 'fhir': { 'fieldMetadataList': [ { 'action': 'TRANSFORM', 'paths': [ 'Patient.HumanName' ] } ] } }, 'resourceFilter': { 'resources': { 'resources': [ 'Patient/PATIENT_ID', 'Observation/OBSERVATION_ID' ] } } }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/fhirStores/SOURCE_FHIR_STORE_ID:deidentify"
Si la solicitud se realiza de forma correcta, el servidor devuelve la respuesta en formato JSON:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
La respuesta contiene un nombre de operación. Puedes usar el método Operation get
para hacer un seguimiento del estado de la operación:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID"
Si la solicitud se realiza de forma correcta, el servidor devuelve la respuesta en formato JSON.
Al finalizar el proceso de desidentificación, la respuesta contiene "done": true
.
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.deidentify.DeidentifyService.DeidentifyFhirStore", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/query/CLOUD_LOGGING_URL", "counter": { "success": "SUCCESS_COUNT" } }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifyFhirStoreSummary" } }
PowerShell
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Post ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body "{ 'destinationStore': 'projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID/fhirStores/DESTINATION_FHIR_STORE_ID', 'resourceFilter': { 'resources': { 'resources': [ 'Patient/PATIENT_ID', 'Observation/OBSERVATION_ID' ] } }, 'config': { 'fhir': { 'fieldMetadataList': [ { 'paths': [ 'Patient.HumanName' ], 'action': 'TRANSFORM' } ] } } }" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/fhirStores/SOURCE_FHIR_STORE_ID:deidentify" | Select-Object -Expand Content
Si la solicitud se realiza de forma correcta, el servidor devuelve la respuesta en formato JSON:
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" }
La respuesta contiene un ID de operación. Puedes usar el método Operation get
para hacer un seguimiento del estado de la operación:
$cred = gcloud auth application-default print-access-token $headers = @{ Authorization = "Bearer $cred" } Invoke-WebRequest ` -Method Get ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID" | Select-Object -Expand Content
Si la solicitud se realiza de forma correcta, el servidor devuelve la respuesta en formato JSON. Al finalizar el proceso de desidentificación, la respuesta contiene "done": true
.
{ "name": "projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.OperationMetadata", "apiMethodName": "google.cloud.healthcare.v1.deidentify.DeidentifyService.DeidentifyFhirStore", "createTime": "CREATE_TIME", "endTime": "END_TIME", "logsUrl": "https://console.cloud.google.com/logs/query/CLOUD_LOGGING_URL", "counter": { "success": "SUCCESS_COUNT" } }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.healthcare.v1.deidentify.DeidentifyFhirStoreSummary" } }
Desidentificar datos en la Google Cloud consola
Puedes desidentificar datos en la Google Cloud consola de un conjunto de datos o de un almacén FHIR. La configuración de desidentificación de FHIR predeterminada se usa para desidentificar tanto conjuntos de datos como almacenes FHIR. Para obtener más información, consulta Desidentificación predeterminada de datos FHIR.
Desidentificar datos de un conjunto de datos
Para anonimizar los datos de un conjunto de datos, sigue estos pasos:
En la Google Cloud consola, ve a la página Conjuntos de datos.
En la lista Acciones del conjunto de datos que quieres anonimizar, selecciona Anonimizar.
Se mostrará la página Desidentificar conjunto de datos.
Selecciona Definir conjunto de datos de destino e introduce un nombre para el nuevo conjunto de datos en el que se almacenarán los datos desidentificados.
Haz clic en Desidentificar para desidentificar los datos del conjunto de datos.
Desidentificar datos de un almacén FHIR
Para anonimizar los datos de un almacén FHIR, sigue estos pasos:
En la Google Cloud consola, ve a la página Conjuntos de datos.
Haga clic en el conjunto de datos del que quiera desidentificar los datos.
En la lista de almacenes FHIR, elija Desidentificar en la lista Acciones del almacén FHIR que quiera desidentificar.
Se muestra la página Desidentificar almacén FHIR.
Seleccione Seleccionar almacén de datos de destino y elija el conjunto de datos y el almacén de FHIR en los que se guardarán los datos anonimizados.
Nota: Si quieres almacenar los datos desidentificados en un nuevo almacén FHIR, primero debes crear el almacén y, a continuación, seleccionarlo como almacén FHIR de destino.
Haga clic en Desidentificar para desidentificar los datos del almacén FHIR.
Solucionar problemas de operaciones de desidentificación de FHIR
Si se producen errores durante una operación de desidentificación de FHIR, se registran en Cloud Logging. Para obtener más información, consulta Ver registros de errores en Cloud Logging.
Si toda la operación devuelve un error, consulta Solucionar problemas de operaciones de larga duración.