HL7 FHIR Costa Rica - Core
0.0.1-ballot - ci-build
HL7 FHIR Costa Rica - Core, published by Iniciativa HL7 Costa Rica. This guide is not an authorized publication; it is the continuous build for version 0.0.1-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7-cr/core/ and changes regularly. See the Directory of published versions
| Page standards status: Informative |
GAUDÍ (Generador de Autoridad de Documento por Unidad de Identificación) es el sistema oficial de sellado de tiempo del Banco Central de Costa Rica. Proporciona un mecanismo confiable y legalmente reconocido para sellar documentos electrónicos, incluyendo recursos FHIR, con una marca temporal verificable e irrefutable.
En el contexto de interoperabilidad clínica FHIR, GAUDÍ garantiza que los documentos clínicos digitales (Bundles de tipo "document") pueden ser sellados con una prueba de existencia e integridad reconocida legalmente.
GAUDÍ opera bajo:
┌─────────────────────────────────────────────────────────┐
│ Banco Central de Costa Rica │
│ Sistema de Sellado de Tiempo Oficial │
│ │
│ ✓ Autoridad Certificadora Nacional reconocida │
│ ✓ Infraestructura PKI de clase alta │
│ ✓ Disponibilidad 24/7/365 │
│ ✓ Sincronización UTC con servidores internacionales │
│ ✓ Auditoría permanente e inmutable │
└─────────────────────────────────────────────────────────┘
Solo los Bundles de tipo "document" pueden ser sellados con GAUDÍ:
Bundle {
type = #document ← Único tipo soportado para sellado
composition = Reference(Composition) ← Referencia obligatoria
entry[0] = Composition
entry[1] = Patient
entry[2..n] = Recursos clínicos (Observation, Medication, etc.)
signature = Signature ← Elemento opcional para GAUDÍ
}
Los Bundles de otro tipo no deben sellarse:
type = #transaction - Para operaciones en sistemastype = #batch - Para procesamiento por lotestype = #history - Para históricos de versionestype = #searchset - Para resultados de búsqueda{
"resourceType": "Bundle",
"type": "document",
"identifier": {
"system": "urn:ietf:rfc:3986",
"value": "urn:uuid:3e4130b9-e5ed-4b90-80c8-4b12f5d7f5f5"
},
"timestamp": "2026-01-20T10:30:00-06:00",
"entry": [
{
"fullUrl": "urn:uuid:composition-001",
"resource": {
"resourceType": "Composition",
"type": {
"coding": [{
"system": "http://loinc.org",
"code": "34840-9",
"display": "Neurology Consultation note"
}]
},
"subject": { "reference": "Patient/..." },
"date": "2026-01-20",
"author": [ { "reference": "Practitioner/..." } ],
"title": "Documento Clínico - Consulta de Neurología",
"section": [ { "entry": [...] } ]
}
},
{ "fullUrl": "urn:uuid:patient-001", "resource": { ... } },
{ "fullUrl": "urn:uuid:observation-001", "resource": { ... } }
],
"signature": {
"type": [{
"system": "urn:iso-std:iec:61208:2012#urn:adoc:sigform:gaudi",
"code": "GAUDI-TSA"
}],
"when": "2026-01-20T10:35:00Z",
"who": {
"reference": "Organization/laboratorio-nacional",
"display": "Laboratorio Nacional de Referencia"
},
"onBehalfOf": {
"reference": "Organization/ministerio-salud",
"display": "Ministerio de Salud de Costa Rica"
},
"sigFormat": "application/gaudi+json",
"data": "MIIDxDCC...base64-encoded-gaudi-signature...",
"extension": [
{
"url": "https://hl7.or.cr/fhir/StructureDefinition/gaudi-timestamp",
"valueDateTime": "2026-01-20T10:35:00.123Z"
},
{
"url": "https://hl7.or.cr/fhir/StructureDefinition/gaudi-reference",
"valueString": "GAUDI-2026-BCR-001234"
},
{
"url": "https://hl7.or.cr/fhir/StructureDefinition/gaudi-certificate",
"valueString": "MIIFXzCCA0e...base64-encoded-bcr-certificate..."
},
{
"url": "https://hl7.or.cr/fhir/StructureDefinition/document-hash-algorithm",
"valueString": "SHA256"
}
]
}
}
Profesional Clínico
↓
Crea Composición con datos clínicos
↓
Agrupa recursos en Bundle tipo "document"
↓
Bundle listo para sellado
Bundle JSON Canonizado
↓
Calcular SHA-256 del contenido
↓
Generar hash verificable
POST https://servidorgaudí.bcr.fi.cr/api/v1/sello-temporal
Solicitud:
{
"documento": {
"hash": "d4735d7e98...sha256...",
"algoritmo": "SHA256",
"tipo": "documento-clinico-fhir",
"institucion": "laboratorio-nacional",
"paciente-hash": "hash-del-identificador-paciente"
},
"metadatos": {
"tipos-recursos": ["Composition", "Patient", "Observation"],
"timestamp-local": "2026-01-20T10:30:00-06:00"
}
}
Respuesta:
{
"sello": {
"timestamp": "2026-01-20T10:35:00.123Z",
"referencia": "GAUDI-2026-BCR-001234",
"certificado": "MIIFXzCCA0e...X.509 certificate...",
"cadena-confianza": ["Certificado BCR", "Certificado Raíz"],
"algoritmo": "SHA256withRSA"
},
"validacion": {
"estado": "SELLADO",
"tokens-registrados": 1,
"proxima-validacion": "2026-01-20T10:36:00Z"
}
}
El sello GAUDÍ se añade al elemento Bundle.signature con:
Bundle con Sello GAUDÍ
↓
Transmisión segura (TLS/HTTPS)
↓
Sistema receptor
↓
Validación de sello (verificación de integridad)
// 1. Extraer sello GAUDÍ
const sello = bundle.signature;
const hashDocumento = sello.extension
.find(e => e.url.includes('document-hash'))?.value;
// 2. Recalcular hash del Bundle
const contenidoActual = canonicalizeBundle(bundle);
const hashActual = sha256(contenidoActual);
// 3. Comparar hashes
if (hashActual === hashDocumento) {
// 4. Validar Certificado BCR
const certificado = parseCertificate(sello.data);
const esBCR = validarCadenaConfianza(certificado);
if (esBCR) {
console.log("✓ Documento íntegro y sellado por BCR");
console.log(" Referencia:", sello.extension
.find(e => e.url.includes('gaudi-reference'))?.value);
return true;
}
}
return false;
| Estado | Significado | Acción |
|---|---|---|
| SELLADO | Documento válido con sello GAUDÍ vigente | Aceptar documento |
| EXPIRADO | Sello vencido (rara vez ocurre) | Solicitar resello |
| REVOCADO | Certificado revocado | Rechazar documento |
| NO_VERIFICADO | No tiene sello GAUDÍ | Requerir sellado |
┌──────────────────────────────────────┐
│ Laboratorio Nacional │
│ Resultado de Prueba COVID-19 │
├──────────────────────────────────────┤
│ ✓ Bundledocument con Observation │
│ ✓ Datos del paciente (Patient) │
│ ✓ Organización responsable │
│ ✓ Sellado con GAUDÍ │
│ ✓ Referencia: GAUDI-2026-BCR-00456 │
│ ✓ Timestamp: 2026-01-20T10:35:00Z │
├──────────────────────────────────────┤
│ ESTADO: ÍNTEGRO Y VERIFICADO │
└──────────────────────────────────────┘
┌──────────────────────────────────────┐
│ Clínica Médica Central │
│ Nota de Consulta - Cardiología │
├──────────────────────────────────────┤
│ ✓ Composition: Estructura clínica │
│ ✓ Observaciones diagnósticas │
│ ✓ Medicamentos prescritos │
│ ✓ Firma del médico (dentro de Comp.) │
│ ✓ Sello GAUDÍ en Bundle │
│ ✓ Cadena de confianza completa │
├──────────────────────────────────────┤
│ ESTADO: VÁLIDO LEGALMENTE │
└──────────────────────────────────────┘
┌──────────────────────────────────────┐
│ Instituto Médico Legal │
│ Informe de Autopsia (Documento) │
├──────────────────────────────────────┤
│ ✓ Bundle document con datos completos│
│ ✓ Múltiples observaciones clínicas │
│ ✓ Sellado GAUDÍ (prueba de tiempo) │
│ ✓ No repudiable │
│ ✓ Válido como prueba forense │
├──────────────────────────────────────┤
│ ESTADO: LEGAL Y ADMISIBLE │
└──────────────────────────────────────┘
┌─────────────────┐
│ Sistema Clínico │
│ (EHR/HIS) │
└────────┬────────┘
│
Crea documento
│
↓
┌─────────────────────────────────────┐
│ Generador FHIR │
│ - Composition │
│ - Bundle type=document │
└────────┬────────────────────────────┘
│
Serializa como JSON
│
↓
┌─────────────────────────────────────┐
│ Cliente GAUDÍ │
│ - Calcula hash SHA-256 │
│ - Solicita sello a BCR │
│ - Incorpora respuesta │
└────────┬────────────────────────────┘
│
Documento con sello
│
↓
┌─────────────────────────────────────┐
│ Almacenamiento / Intercambio │
│ - Base de datos clínica │
│ - Portal del paciente │
│ - Envío a otras instituciones │
└─────────────────────────────────────┘
| Elemento | Detalles |
|---|---|
| Portal Oficial | https://servidorgaudí.bcr.fi.cr |
| API de Sello | https://servidorgaudí.bcr.fi.cr/api/v1 |
| Documentación | https://www.bcr.fi.cr/regulaciones/gaudi |
| Email Soporte | gaudi@bcr.fi.cr |
| Teléfono | +506 2243-2000 (ext. GAUDÍ) |
| Disponibilidad | 24/7/365 |
| SLA | < 100ms para sellado |
GAUDÍ proporciona una solución confiable, legal y técnicamente sólida para el sellado de documentos clínicos en formato FHIR. Su integración asegura que los documentos clínicos digitales pueden circular con garantía de:
Esto es fundamental para la confianza en los sistemas de información de salud en Costa Rica.