Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En esta página, se explica el concepto de integridad referencial en relación con los recursos dentro de un almacén FHIR en la API de Cloud Healthcare.
El almacén de FHIR aplica la integridad referencial en las referencias a otros recursos dentro del mismo almacén:
Cuando se crea, se actualiza o se aplica un parche a un recurso, la operación fallará si el contenido resultante del recurso contiene una referencia a un recurso o a una versión del recurso que no existe.
La operación fallará si hay otros recursos en el almacén que hagan referencia a ese recurso cuando lo borras.
La integridad referencial se puede inhabilitar mediante la configuración de la opción disableReferentialIntegrity en el momento de la creación del almacén.
Exclusiones y limitaciones
La especificación de FHIR permite varias formas de referencias, algunas de las cuales la integridad referencial no abarca:
una URL especifica una referencia externa que no coincide con la URL base del almacén de FHIR.
Un identificador de empresa que especifica una referencia lógica.
Una referencia que contiene solo una string visible legible.
Las referencias dentro de las extensiones de FHIR solo están sujetas a la integridad referencial si complexDataTypeReferenceParsing se establece en ENABLED. Este es el valor predeterminado para los almacenes de FHIR nuevos.
Algunos métodos de la API pueden provocar que se infrinja la integridad referencial en algunas condiciones:
FHIR permite que las referencias apunten a una versión del historial específica de un recurso mediante el formulario [resource type]/[resource ID]/_history/[version ID]. La integridad referencial se aplica a estas referencias cuando se crean o se actualizan, pero cuando se usa el método Resource-purge para quitar versiones históricas de un recurso, las referencias entrantes no se verifican.
El método import de FHIR no aplica la integridad referencial. El método se puede usar en casos en los que no se requiere la integridad referencial o cuando se sabe que la entrada cumple con la integridad referencial. En el último caso, las referencias dentro del almacén de FHIR alcanzarán la coherencia eventual después de que cada recurso se importe de forma correcta.
El método deidentify puede crear un almacén de FHIR en un estado que no cumple con la integridad referencial de forma temporal durante la operación o de forma permanente si se usan filtros para seleccionar un subconjunto de recursos.
Un estado en el que se aplica la integridad, pero se infringió en uno de los casos anteriores, hará que las actualizaciones de recursos se rechacen en un recurso que contenga una referencia no válida, a menos que la actualización corrija o quite todas las referencias no válidas. Este estado también puede crear dificultades para las aplicaciones mediante el almacén que asume la integridad.
Recursos contenidos
La especificación de FHIR contiene una restricción de que cada recurso contenido debe referenciarse desde algún lugar dentro del recurso que lo contiene (incluidas las referencias de otros recursos contenidos) y cada referencia a un recurso contenido debe ser válida. Esta restricción se aplica por separado de la integridad referencial y no se puede inhabilitar como se define en las invariables FHIRPath en cada recurso individual.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[[["\u003cp\u003eThis page outlines how the Cloud Healthcare API's FHIR store enforces referential integrity on references to other resources within the same store, causing operations to fail if references are invalid or if referenced resources are deleted.\u003c/p\u003e\n"],["\u003cp\u003eReferential integrity can be disabled during FHIR store creation using the \u003ccode\u003edisableReferentialIntegrity\u003c/code\u003e option.\u003c/p\u003e\n"],["\u003cp\u003eCertain types of references, such as external URLs, logical identifiers, or simple display strings, are excluded from referential integrity checks, and references within FHIR extensions are only checked if \u003ccode\u003ecomplexDataTypeReferenceParsing\u003c/code\u003e is enabled.\u003c/p\u003e\n"],["\u003cp\u003eSpecific API methods like \u003ccode\u003eResource-purge\u003c/code\u003e, \u003ccode\u003eimport\u003c/code\u003e, and \u003ccode\u003edeidentify\u003c/code\u003e can bypass referential integrity checks, potentially leading to a state where integrity is violated.\u003c/p\u003e\n"],["\u003cp\u003eThe FHIR specification's constraint on contained resources, which requires them to be referenced within their containing resource and every reference to them to be valid, is enforced independently and cannot be disabled.\u003c/p\u003e\n"]]],[],null,["# FHIR referential integrity\n\nThis page explains the concept of referential integrity as it relates to\nresources within a FHIR store in the Cloud Healthcare API.\n\nThe FHIR store enforces referential integrity on references to other resources\nwithin the same store:\n\n- When creating, updating, or patching a resource, the operation will fail if the resulting content of the resource contains a reference to a resource or resource version that does not exist.\n- When deleting a resource, the operation will fail if there are other resources in the store that reference that resource.\n\nReferential integrity can be disabled by setting the\n[`disableReferentialIntegrity`](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores#FhirStore.FIELDS.disable_referential_integrity) option at the time of store creation.\n\nExclusions and limitations\n--------------------------\n\nThe FHIR specification allows various forms of\n[references](http://hl7.org/fhir/references.html), some of which are not\ncovered by referential integrity:\n\n- An external reference specified by a URL that does not match the base URL of the FHIR store.\n- A logical reference specified by a business identifier.\n- A reference containing only a human-readable display string.\n- References inside FHIR [extensions](http://hl7.org/fhir/extensibility.html) are only subject to referential integrity if [`complexDataTypeReferenceParsing`](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores#ComplexDataTypeReferenceParsing) is set to `ENABLED`. This is the default value for new FHIR stores.\n\nCertain API methods can cause referential integrity to be violated under some conditions:\n\n- FHIR allows references to point to a specific history version of a resource using the form `[resource type]/[resource ID]/_history/[version ID]`. Referential integrity is applied to these references when created or updated, but when using the [`Resource-purge`](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores.fhir/Resource-purge) method to remove historical versions of a resource, incoming references are **not** checked.\n- The FHIR [`import`](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores/import) method does not enforce referential integrity. The method may be used either in cases where referential integrity is not required, or where the input is known to satisfy referential integrity. In the latter case, the references inside the FHIR store will reach eventual consistency after every resource is successfully imported.\n- The [`deidentify`](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores/deidentify) method can potentially create a FHIR store in a state that does not satisfy referential integrity temporarily during the operation, or permanently if filters are used to select a subset of resources.\n\nA state where integrity is being enforced but has been violated by one of the previous cases will\ncause resource updates to be rejected on a resource that contains an invalid reference, unless the\nupdate fixes or removes all invalid references. Such a state might also create difficulties for\napplications using the store that assume integrity.\n\nContained resources\n-------------------\n\nThe FHIR specification contains a constraint that every\n[contained resource](http://hl7.org/fhir/references.html#contained) must be\nreferenced from somewhere within its containing resource (including references from other\ncontained resources), and every reference to a contained resource must be valid. This constraint\nis enforced separately from referential integrity and cannot be disabled as it is defined in the\nFHIRPath invariants on each individual resource."]]