Guía de Implementación de Homologación Regional (PH4H) de Costa Rica
0.1.0 - ci-build Costa Rica bandera

Guía de Implementación de Homologación Regional (PH4H) de Costa Rica - Versión en desarrollo (v0.1.0): borrador de trabajo de la Iniciativa HL7® Costa Rica, que puede cambiar sin aviso.

StructureMap: CRComun

URL oficial: https://hl7.or.cr/fhir/ph4h/StructureMap/CRComun Versión: 0.1.0
Standards status: Draft Nombre computable: CRComun

Identificador: el system pasa de URI a OID (ConceptMap cr-sistema-identificador-oid, opción (a) de la homologación) y el tipo conserva solo el coding de HL7 v2-0203, que entienden los demás países.

Idioma: es

map "https://hl7.or.cr/fhir/ph4h/StructureMap/CRComun" = "CRComun"

// Identificador: el system pasa de URI a OID (ConceptMap cr-sistema-identificador-oid, opción (a) de la
// homologación) y el tipo conserva solo el coding de HL7 v2-0203, que entienden los demás países.

group Identificador(source id : Identifier, target ti : Identifier) {
  id.use as v -> ti.use = v;
  id.type as st -> ti.type as tt then {
    st.coding as sc where (system = 'http://terminology.hl7.org/CodeSystem/v2-0203') -> tt.coding as c then Codificacion(sc, c) "v2";
  };
  id.system as s -> ti.system = translate(s, 'https://hl7.or.cr/fhir/ph4h/ConceptMap/cr-sistema-identificador-oid', 'code');
  id.value as v -> ti.value = v;
  id.period as p -> ti.period as tp then Periodo(p, tp);
  id.assigner as a -> ti.assigner as ta then Referencia(a, ta);
}

// Referencia: se conserva la referencia. Si es lógica (por identificador), su system también pasa a OID y se
// agrega el tipo de HL7 v2-0203, porque con el OID del país el system ya no distingue el tipo de identificador.
group Referencia(source r : Reference, target tr : Reference) {
  r.reference as v -> tr.reference = v;
  r.type as v -> tr.type = v;
  r.identifier as id -> tr.identifier as ti then {
    id.type as t -> ti.type as tt then Concepto(t, tt) "tipoExplicito";
    id where (type.exists().not() and system.startsWith('https://hl7.or.cr/fhir/sid/pasaporte/')) ->  ti.type as tt,  tt.coding as c then {
      id ->  c.system = 'http://terminology.hl7.org/CodeSystem/v2-0203',  c.code = 'PPN' "ppn";
    } "tipoPasaporte";
    id where (type.exists().not() and system.startsWith('https://hl7.or.cr/fhir/sid/pasaporte/').not()) ->  ti.type as tt,  tt.coding as c then {
      id.system as s ->  c.system = 'http://terminology.hl7.org/CodeSystem/v2-0203',  c.code = translate(s, 'https://hl7.or.cr/fhir/ph4h/ConceptMap/cr-sistema-identificador-tipo', 'code') "v2";
    } "tipoDelSystem";
    id.system as s -> ti.system = translate(s, 'https://hl7.or.cr/fhir/ph4h/ConceptMap/cr-sistema-identificador-oid', 'code');
    id.value as v -> ti.value = v;
  };
  r.display as v -> tr.display = v;
}

group Concepto(source cc : CodeableConcept, target tc : CodeableConcept) {
  cc.coding as c -> tc.coding as t then Codificacion(c, t);
  cc.text as v -> tc.text = v;
}

group Codificacion(source c : Coding, target t : Coding) {
  c.system as v -> t.system = v;
  c.version as v -> t.version = v;
  c.code as v -> t.code = v;
  c.display as v -> t.display = v;
}

group Nombre(source n : HumanName, target tn : HumanName) {
  n.use as v -> tn.use = v;
  n.text as v -> tn.text = v;
  n.family as v -> tn.family = v;
  n.given as v -> tn.given = v;
  n.prefix as v -> tn.prefix = v;
  n.suffix as v -> tn.suffix = v;
}

group Telecom(source t : ContactPoint, target tt : ContactPoint) {
  t.system as v -> tt.system = v;
  t.value as v -> tt.value = v;
  t.use as v -> tt.use = v;
  t.rank as v -> tt.rank = v;
}

// Dirección: el país pasa de alfa-3 a alfa-2 (ConceptMap cr-pais-alfa3-alfa2 de la IG terminológica).
// Provincia, cantón y distrito van con su código de la DTA; el barrio, en la extensión estándar precinct.
group Direccion(source a : Address, target ta : Address) {
  a.extension as e where (url = 'http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-precinct') -> ta.extension as te then {
    e.url as v -> te.url = v;
    e.value : string as v -> te.value = v;
  } "precinct";
  a.use as v -> ta.use = v;
  a.text as v -> ta.text = v;
  a.line as v -> ta.line = v;
  a.city as v -> ta.city = v;
  a.district as v -> ta.district = v;
  a.state as v -> ta.state = v;
  a.postalCode as v -> ta.postalCode = v;
  a.country as v -> ta.country = translate(v, 'https://hl7.or.cr/fhir/terminology/ConceptMap/cr-pais-alfa3-alfa2', 'code');
}

group Periodo(source p : Period, target tp : Period) {
  p.start as v -> tp.start = v;
  p.end as v -> tp.end = v;
}